Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with Adafruit Metro M0? #43

Open
wma12 opened this issue Jun 3, 2020 · 0 comments
Open

Not compatible with Adafruit Metro M0? #43

wma12 opened this issue Jun 3, 2020 · 0 comments

Comments

@wma12
Copy link

wma12 commented Jun 3, 2020

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();
// }
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant