I keep getting the red flashing light of death when I upload Can bus Receiving code

I have an Arduino Nano with an mcp2515 Can transceiver sending can messages to another mcp2515 connected to a Arduino Giga. But when I upload the read code to the Giga I just the the red flashing light of death.

The Pinouts I'm using on the Giga are as Follows: VCC=5V, GND=GND, CS=CS(10), MISO=CIPO(12), MOSI=COPI(11), SCK=SCK(13), INT=2

Here Is the code I am trying to upload as well

#include <SPI.h>
#include <mcp2515.h>

struct can_frame canMsg;
MCP2515 mcp2515(10);


void setup() {
  Serial.begin(115200);
  SPI.begin();
  mcp2515.reset();
  mcp2515.setBitrate(CAN_125KBPS);
  mcp2515.setNormalMode();
  
  Serial.println("------- CAN Read ----------");
  Serial.println("ID  DLC   DATA");
}

void loop() {
  if (mcp2515.readMessage(&canMsg) == MCP2515::ERROR_OK) {
    Serial.print(canMsg.can_id, HEX); // print ID
    Serial.print(" "); 
    Serial.print(canMsg.can_dlc, HEX); // print DLC
    Serial.print(" ");
    
    for (int i = 0; i<canMsg.can_dlc; i++)  {  // print the data
      Serial.print(canMsg.data[i],HEX);
      Serial.print(" ");
    }

    Serial.println();      
  }
}

I'm just trying to run a simple send/receive setup. It tried uploading the read code to the Nano and it worked so it appears to be something with the Giga.

No clue as to what you are saying. Post an annotated schematic showing exactly how you have wired each unit and post links to technical information on the hardware devices.

Does adding while (!Serial) {} after the begin help?

I’ll try that when I get home

I Will provide you with more information when I get home

It did not appear to do anything.

I would try a library that explicitly states mbed compatibility, like this one. https://docs.arduino.cc/libraries/107-arduino-mcp2515/

Ok, I'll try it and let you know if it works. Thank you

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