You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I sucessfully used the mcp2515 with an Arduino Nano Every. Now I tried to upload the same code to the Adafruit Metro M0 Express, unfortunately this causes the Metro to "crash".
After uploading the code, the Metro stops the program (I added a blinking LED to the Code, so you can see if it is running). Also it loses the connection to the PC, since the Port does not show up anymore and I can't see the serial monitor. The only thing working is the "ON" LED on the Metro. Everything else seems to stop working after uploading the code.
I need to enable verbose mode for uploading and double press reset while uploading, so the Metro resets and the Port shows up again.
Down below is the code I am using. It is very similar to the "read" example.
I uncommented a lot of lines to see when the problem occurs. Already at the top there is a command to set a pin: MCP2515 mcp2515(10)
At this point the Metro already seems to have problems. I also tried using different pins instead of D10, but without any luck. Why would the Metro already have problems with this part? Could this be a problem with the missing EEPROM of the Metro M0?
`#include <SPI.h>
#include <mcp2515.h>
struct can_frame canMsg;
// MCP2515 mcp2515(10); // this line causes problems? After uncommenting this line, the Metro loses connection
Hi,
I sucessfully used the mcp2515 with an Arduino Nano Every. Now I tried to upload the same code to the Adafruit Metro M0 Express, unfortunately this causes the Metro to "crash".
After uploading the code, the Metro stops the program (I added a blinking LED to the Code, so you can see if it is running). Also it loses the connection to the PC, since the Port does not show up anymore and I can't see the serial monitor. The only thing working is the "ON" LED on the Metro. Everything else seems to stop working after uploading the code.
I need to enable verbose mode for uploading and double press reset while uploading, so the Metro resets and the Port shows up again.
Down below is the code I am using. It is very similar to the "read" example.
I uncommented a lot of lines to see when the problem occurs. Already at the top there is a command to set a pin: MCP2515 mcp2515(10)
At this point the Metro already seems to have problems. I also tried using different pins instead of D10, but without any luck. Why would the Metro already have problems with this part? Could this be a problem with the missing EEPROM of the Metro M0?
`#include <SPI.h>
#include <mcp2515.h>
struct can_frame canMsg;
// MCP2515 mcp2515(10); // this line causes problems? After uncommenting this line, the Metro loses connection
void setup() {
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
// mcp2515.reset();
// mcp2515.setBitrate(CAN_125KBPS);
// mcp2515.setNormalMode();
//
// Serial.println("------- CAN Read ----------");
// Serial.println("ID DLC DATA");
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // aktiviere LED
delay(500);
digitalWrite(LED_BUILTIN, LOW); // deaktiviere LED
delay(500);
// 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(" ");
// }
//
//
// if(canMsg.data[0]==0x8E){ // Check if first Data of Message is correct
// Serial.print("\nFirst Data of Msg1 correct: ");
// Serial.print(canMsg.data[0], HEX);
// }
//
// Serial.println();
// }
}`
The text was updated successfully, but these errors were encountered: