Elecfreak CAN-BUS Shield doesn't initialize with an Arduino UNO

Hello guys,
I'm an Arduino newbie and I want to do some car can bus sniffing with an UNO and a CAN BUS shield.

I have this exact shield MCP2515 EF02037 CAN BUS Shield Controller Board Communication Speed Hi – diymore.
They say it's an ElecFreaks EF02037 CAN-BUS Shield.
I have soldered the pin headers on the board including the SPI 2x3 pin header. The AREF and GND remained disconnected on the shield because I didn't have the proper pin header (I had a 1x6 instead of an 1x8), I'm not sure if this is a problem or not. I'll attach a photo with the boards.

Anyway, I've connected the Arduino with the CAN shield mounted to my laptop (the shield not connected to anything) and I've tried running a simple example from this library GitHub - coryjfowler/MCP_CAN_lib: MCP_CAN Library

My problem is that the MCP2515 initialization fails every time, I've tried CS pin 9 and CS pin 10, but no luck. Here's the exact code I'm trying to run.

void setup()
{  
   Serial.begin(115200);    
   // Initialize MCP2515 running at 16MHz with a baudrate of 500kb/s and the masks and filters disabled.  

    if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ) == CAN_OK)    
           Serial.println("MCP2515 Initialized Successfully!");  \
    else    
           Serial.println("Error Initializing MCP2515...");    
    
     CAN0.setMode(MCP_NORMAL);                     // Set operation mode to normal so the MCP2515 sends acks to received data.
     pinMode(CAN0_INT, INPUT);                            // Configuring pin for /INT input    
     Serial.println("MCP2515 Library Receive Example...");
}

It always fails at CAN0.begin, meaning it returns 1 (CAN_FAILINIT) instead of 0 (CAN_OK).

I'm not sure what to do or how to troubleshoot this. Can you guys help?

Thanks a lot.

Find the MCP2515 chip. Find pin 16 (CS) . Use a magnifying glass to see where it goes.
Older versions of the shield had CS going to Arduino pin 11.

Is it the third pin from the top on that last pic that goes into a hole? I followed it on the back of the board and it seems to go into PIN 10.

I've also tried using CS PIN 11 in the code but still the same result.

Use a multimeter together with a steady hand to check that the chips on the shield are being powered by 5v.

Borrow or buy an oscilloscope and look for activity on the SPI lines and CS.

mikb55:
Use a multimeter together with a steady hand to check that the chips on the shield are being powered by 5v.

Borrow or buy an oscilloscope and look for activity on the SPI lines and CS.

I'm not really an expert in electrical stuff, but I've tried to check the MCP2515 chip on the board with a multimeter. I've checked the VDD pin on the chip together with GND and it seems I have 5V on that. There's also 5V on the CS pin, I don't have an oscilloscope to test for activity otherwise.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.