SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By socriscul
#186987
I am trying to use the can bus shield with an arduino mega 2560 and the canbus.h library.

I have rerouted pins 10-13 of the shield to 50-53 of the mega.

defined the following

// Pins remapped to Arduino Mega 2560
#define P_MOSI B,2 // pin 51
#define P_MISO B,3 // pin 50
#define P_SCK B,1 // pin 52
#define MCP2515_CS B,0 // pin 53
//#define MCP2515_INT E,4 // pin 2
#define MCP2515_INT D,2 // pin 2
#define LED2_HIGH H,5 // pin 8
#define LED2_LOW H,5 // pin 8

I only get a "Can't init CAN" message. My understanding is that the board should initialize even when not connected to my vehicle. I've searched the internet and have not been able to find any help. How can I troubleshoot?
By djowlrid
#188313
I used sparkfun can bus ( https://learn.sparkfun.com/tutorials/ca ... e-overview )
and used arduino mega2560 board

and I didn't used OBD II cable but used CAN serial.

First I added jumper wires between my CAN bus shield and the SPI pin on the MEGA2560.
you can see a pin out diagram here http://forum.arduino.cc/index.php?topic=125908.0

Sparkfun D10 -> Arduino 53
Sparkfun D11 -> Arduino 51
Sparkfun D12 -> Arduino 50
Sparkfun D13 -> Arduino 52

Next, I changed the example code, defaults.h

#define P_MOSI B,3 -> #define P_MOSI B,2
#define P_MISO B,4 -> #define P_MISO B,3
#define P_SCK B,5 -> #define P_SCK B,1
#define MCP2515_CS B,0 -> #define MCP2515_CS B,0


then, I could initialize the CAN BUS shield!