can bus shield doesn't work anymore

Hi ! I am currently on my 5th post on this forum and I have yet to see a reply. Oh well, I am still hoping.

I am using an Arduino Mega 2560 with a Sparkfun CAN BUS Shield: CAN-BUS Shield - DEV-13262 - SparkFun Electronics

Obviously I know it is not compatible with mega and that I cannot stack it because the mega has the SPI pins on pins 50-53, not 10-13 so I just stacked the shield over the mega without those 4 particular pins, for which I then used wires to connect to Mega’s SPI pins.

I also changed the pins in the defaults.h file inside the Canbus.h library

I tried to run the example code of the canbus library(which actually worked perfectly fine for 2 days)

#include <Canbus.h>
#include <defaults.h>
#include <global.h>
#include <mcp2515.h>
#include <mcp2515_defs.h>

//********************************Setup Loop*********************************//

void setup() {

  Serial.begin(9600); // For debug use
  Serial.println("CAN Read - Testing receival of CAN Bus message");  
  if(Canbus.init(CANSPEED_500))  //Initialise MCP2515 CAN controller at the specified speed
    Serial.println("CAN Init ok");
    Serial.println("Can't init CAN");

//********************************Main Loop*********************************//

void loop(){

  tCAN message;
if (mcp2515_check_message()) 
    if (mcp2515_get_message(&message)) 
        //if( == 0x620 and[2] == 0xFF)  //uncomment when you want to filter
               Serial.print("ID: ");
               Serial.print(", ");
               Serial.print("Data: ");
               for(int i=0;i<message.header.length;i++) 
                  Serial.print(" ");


My main goal for now was to see on the serial monitor “CAN init OK” which I did for 2 days.
The next day, without changing anything to the code or the boards, the serial monitor started displaying “cant init can”. (I am also going to mention that If I stack the shield normally on an arduino UNO with the initial SPI pins declared in defaults.h it works perfectly fine)

I added to the code, in setup the line : pinMode(53, OUTPUT);
53 is the SS pin for Mega

After doing this the code started working again (displaying “can init ok”)’
The next day however it stopped working again.

Anyone has any idea what is wrong with it ?

No one replied to my question about my CAN BUS query either. Very frustrating. However, I did get mine working in the end and go on to fully customise the original example script from SEEED STUDIO for their V1.2 shield.

Since I'm not familiar with the Sparkfun implementation, I'm unable to advise further and I sincerely apologise about this.

Else, maybe there is some error or issue with your SPI configuration(s) or connection? Calls to SPI in the SEEED scripts rely on SPI working reliably for any initialisation of the MCP and utlimately that would affect CAN BUS access.

Personally, without chasing up a blind alley, I would trace that (SPI calls etc) back through Sparkfun software libraries and your physical connections. I also stuck with the UNO for which the SEEED CAN BUS shield was developed to run with in the first instance, though I know it will work with the MEGA with mods.

All the best.


Thanks for the reply, I managed to get it working again eventually, I replaced the jumpers (I actually got some wires and soldered onto them some male pins myself). I don't know why those weren't making contact, because using the same ones the other 2 shields worked perfectly fine.