Just got two CAN-Bus shields and one Seeeduino. I loaded the example “Send” file on the Seeeduino and loaded the “Receive-Check” example on a Leonardo. The Seeeduino can bus int is successful but the leonardo it fails. I reverse the CAN shield, same thing. I reverse the scetches, same thing. I try the files on a Arduno MEGA1280, same issue. I try it on a Arduino Pro Mini - same issue.
Has anyone been able to use the CAN bus lib on anything other than a Seeduino? Either file works just fine on that. I’m thinking the CAN bus shields are only compatible with the Seeeduino.
OK, what does that have to do with it? I’m not connected using the ICSP header. What about the MEGA and the Pro?
I don’t think that’s the problem, but thanks.
Shields are supposed to be compatible with other Arduinos, this one seems that it is not.
And this isn’t the only one. I have a motor shield from Seeed studio and I can’t get it to work on other Arduinos. I haven’t tried it on the seeeduino yet but willing to bet it works fine then.
The CAN Shield uses SPI on pins 11-13 to talk to the Arduino. The Uno and other ATmega328 based Arduinos have SPI on pins 11-13 as well as the ICSP header. The Leonardo does not have SPI on pins 11-13, therefore initialization fails since there is no SPI connection to the MCP2515.
The mega also uses the ICSP header for SPI.
Try it on an Uno, Diecimila, or Duemilanove before assuming it does not work on other Arduinos as those are the pseudo-standard that a majority of shields were designed around.
My apologies, that guide is apparently grossly outdated… SPI is definitely supported in the Arduino IDE at this time, however the Leonardo has SPI connected only to the ICSP header and any shield that does not derive SPI from the ICSP header (i.e., CAN BUS Shield) will not work stacked. You can use jumper wires and get it working.
I’m pretty sure the Mega uses the ICSP header for its SPI communication which is incompatible with the current version of the CAN shield since it uses the Digital IO (Uno pins 13 to 11) for its SPI. Try using jumper wires instead of stacking the shield, it should work.
Version is v1.1 06/27/2014 with dark/black pcb. When on an Arduino Uno, the board never passes init. This is the code downloaded from github: Seeed-Studio/CAN_BUS_Shield
Specifically, upon placing debug code, inside the function
MCP_CAN::mcp2515_init( )
the call to
mcp2515_setCANCTRL_Mode(MODE_CONFIG)
on line 341 of mcp_can.cpp is returning non-zero. Wasn’t sure what to do to coax your
#if DEBUG_MODE
statements to work, so I used my own statements.
I literally used the sample code. Didn’t change anything. I did end up making use of a competitor’s CAN bus shield… I soldered jumpers to pins 1 and 4 of the mcp2551 transceiver and then connected those to the CAN controller port of a chipKIT max32.
The real trick with the max32 was to set up the CAN clock correctly. I am wondering if there’s a problem with the sample code all over the internet for the mcp2510. On the max32, it wasn’t enough to set the baud to 500k, I also had to use a bit calculator and adjust the quanta timing vales. As I have this working, I’ll revisit the mcp2510-based can shields later…