SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By Catttdaddy
#198803
I purchased a CAN BUS Shield and originally was planning to use is with the UNO. I have now decided that I would like to use it with the Arduino Mega. I have interchanged other shields in the past and they have worked fine. When I try to use the CAN BUS Shield on the mega I can not read or right to the SD Card.
I have looked over the SparkFun_SD_Demo and I am confused on what I should do.
SparkFun_SD_Demo says :
* SD card attached to SPI bus as follows:
** MOSI - pin 11
** MISO - pin 12
** CLK - pin 13
** CS - pin 4
On the Ethernet Shield, CS is pin 4. Note that even if it's not
// used as the CS pin, the hardware CS pin (10 on most Arduino boards,
// 53 on the Mega) must be left as an output or the SD library
// functions will not work.
// Chip Select pin is tied to pin 9 on the SparkFun CAN-Bus Shield


I read this and wonder What pin is CS? 4,10, 53, or 9???
I assume this is where my problem is.

From what I have read, on the Mega the pins are as followed
MOSI-51
MISO-50
CLK-52
CS-53
Do I have to patch a line for each of these?
Should I patch a line from 9 on the CAN BUS Shield over to 53 on the mega?

Can someone explain the best way to do this?
User avatar
By darrellg
#198871
This is a common problem with shields that use SPI. Yes, you will need to patch those pins to the correct pins on the Mega.
By utesh1993
#198972
I am using Arduino Mega with CAN BUS shield and my connections are as follows
10-53
11-51
12-50
13-52
Leave pin 9(SS)without any connection
Also you have to change the pin configuration in defaults.h in the library folder for it work