CAN-Bus sheild int fail on any Arduino except Seeeduino


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.

The Leonardo only has SPI available on the ICSP header.

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.

Any good reason it’s not supported?

Don’t have another uno to try it on.

Just another reason to port over to mbed, I’ve outgrown Arduino…

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.

This is more appropriate:

Thanks for the information.
I’ll play with it some more.

:question: Hi.
I use Arduino Mega2560 and CAN BUS shield.
Initialization failed. I don’t know why?

About SPI in pins_arduino.h :
static const uint8_t SS = 53;
static const uint8_t MOSI = 51;
static const uint8_t MISO = 50;
static const uint8_t SCK = 52;
oll correct

Chip select pin in mcp_can_dfs.h
#define SPICS 10
same as Arduino UNO

What else??? :nerd:

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.

:mrgreen: WORK Arduino Mega 2560 + CAN BUS shield

  1. in file “mcp_can_dfs.h” replace rows:
#define MCP2515_SELECT()   digitalWrite(SPICS, LOW)
#define MCP2515_UNSELECT() digitalWrite(SPICS, HIGH)


#define MCP2515_SELECT()   digitalWrite(SPICS, HIGH)
#define MCP2515_UNSELECT() digitalWrite(SPICS, LOW)
  1. in file “mcp_can.cpp” function “INT8U MCP_CAN::begin(INT8U speedset)”
    after row SPI.begin(); insert row SPI.setDataMode(SPI_MODE1);

In result we have:
"Enter setting mode success
set rate success!!
Enter Normal Mode Success!!

CAN BUS Shield init ok!"

when can bus shield connect to Mega(Leonardo), should be some different, refer to the attach image.

good news is that the canbus shield v1.1 is coming soon, it had fix the bug that can only support Arduino UNO(Seeeduino). :laughing:

So, does this CAN-Bus shield work only with seeedstudio UNO, or should it work with normal “Arduino” UNO?

Or is there something wrong with the code on Github? I tried the changed mentioned above and it still does not init.

Or both?


Can support all Arduino(only atemga… maybe Arduino Due is no include).

I think the code is correct, what 's the version of your hardware?

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.

How about post setup() of your test code.
Maybe the cs pin was select wrong.

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…