I have a problem which I am working on for some days now. I do have knowledge in electronics, but not extensively. I also posted this question in the RFduino Forum but couldn't get any good answers.
What I am trying to do: I want to connect the Sparkfun CAN bus shield to the RFduino. I am using the code further below. It compiles without problem and does work with my Arduino Leonardo!
I used a logic analyser (ignore the filled shapes, some display error) to further narrow down the problem and found the following on the RFduino:
On the Leonardo, it looks different:
It seems like I don't get a response on the MISO line! I played around with different speeds, but nothing seemed to work.
I do have a suspicion however: The RFduino works with 3.3V, while the Leonardo works with 5V. So the logic signals on the RFduino can only achieve 3.3V P-P. I confirmed this with my old CRO, LOW is at GND and HIGH at 3.3V. The Leonardo has 5V P-P. On page 70 of the datasheet for the MCP2515 (the chip used on the shield), it says that the supply voltage VDD ranges from 2.7V to 5.5V. So supply voltage should be ok. V_INPUT_HIGH ranges from 2.31 to 4.3V. V_INPUT_LOW ranges from -0.3V to 0.495V. I am in this range! Similarly so for the V_OUTPUT_LOW (up to 0.6V) and V_OUTPUT_HIGH (at least 2.8V). Could this nevertheless be a problem?
What would you try or change?
#include <SPI.h>
// demo: CAN-BUS Shield, send data
#include <mcp_can.h>
MCP_CAN CAN0(SS); // Set CS to pin 10
unsigned char stmp[8] = {0, 1, 0, 3, 0, 5, 0, 7};
void setup()
{
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// init can bus, baudrate: 500k
if(CAN0.begin(CAN_500KBPS) == CAN_OK) Serial.print("can init ok!!\r\n");
else Serial.print("Can init fail!!\r\n");
// send data per 100ms
}
void loop()
{
// // send data: id = 0x00, standrad flame, data len = 8, stmp: data buf
// CAN0.sendMsgBuf(0x00, 0, 8, stmp);
}