The Seeed Studio CAN-BUS shield is designed specifically to be used with an Arduino Uno but with a simple modification you can use it with several other Arduino boards. I sourced this info from a few different forums and thought I would write up a complete post on exactly how to do this. The Seeed website had some info on how to use the shield with a Mega but their info was not complete and did not work for me. In this post I am going to show how to use the Seeed CAN-BUS shield with an Arduino Mega 2560.
The CAN-BUS shield incompatibility with Arduino boards other than the Uno arises from where Seeed chose to access the SPI pins. They used pins 11,12,13 to access SPI on the Uno. On the Mega the SPI pins are 50,51,52. A better design would have been to use the SPI pins on the ICSP header which is consistent on the Uno, Mega, Due and Leonardo but such is life and we have to work with what is available right now. Seeed's site does mention they are working on a 1.1 version of the board that moves SPI to the ICSP header.
Here is an Arduino Uno with the SPI pins labeled
Arduino Uno SPI pins |
And here is an Arduino Mega 2560 with the SPI pins labeled
Arduino Mega 2560 SPI pins |
Here is what the Seeed Studio CAN-BUS Shield looks like if you don't already own one
Seeed Studio CAN-BUS Shield v1.0 |
The mod
Here is how to modify the CAN-BUS Shield to work with a Mega. The basic overview of the mod is that we need to change the SPI pins that the CAN-BUS Shield is using. There are two ways to do this modification. One one is reversible and the other is more permanent. First the reversible method.
The reversible method is to bend three pins on the CAN-BUS Shield like this:
When you plug the shield into the Mega it will look like this:
|
Now you need to use three jumper wires to connect the SPI pins on the shield to the SPI pins on the Arduino board. In my example I connected the wires to pins 50,51,52 on the Arduino because I only had male-male jumper wires. If you have male-female jumper wires you can connect to the ICSP header instead.
Jumper wire connections
Mega Pin | Shield Pin | SPI Desc |
---|---|---|
50 | 12 | MISO |
51 | 11 | MOSI |
52 | 13 | SCK |
Here is what it looks like with the jumper wires installed
I would recommend you use coryjfowler's MCP2515 library instead of the Seeed's because his fork of the library has a configureable SS pin but Seeed's version will work with this mod because they hard coded the SS pin as digital pin 10.
I then loaded up one of the examples and the shield started up correctly.
If you want to make this modification more permanent you can simply snip off the three pins instead of bending them.
I found some male-female jumper wires at Fry's Electronics yesterday. Here is what it looks like when using the ICSP headers
ICSP Pin | Shield Pin | SPI Desc |
---|---|---|
1 | 12 | MISO |
4 | 11 | MOSI |
3 | 13 | SCK |
Sources
http://arduino.cc/en/Reference/SPI
http://forum.arduino.cc/index.php?topic=123367.0
http://www.seeedstudio.com/forum/viewtopic.php?f=23&t=5172
http://www.seeedstudio.com/wiki/Talk:CAN-BUS_Shield
http://www.seeedstudio.com/wiki/CAN-BUS_Shield
[Updated 2014-09-29] - Added photos of shield with the pins snipped off. Also added photo showing the male-female jumpers with the ICSP header.
[Updated 2014-10-23] - Added table with pinouts for connecting the shield to the ICSP header.