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 am using the the CAN write and CAN read examples provided with this library, using an Arduino UNO in both ends. The transmitter is continously sending a constant message, and the receiver is able to just receive 3 messages and then nothing.
Is the CAN read example code incomplete? do I need to clear the buffers to receive more messages?
The datasheet of the MCP2515 says the following:
When a message is moved into either of the receive
buffers, the appropriate RXnIF bit (CANINTF) is set.
This bit must be cleared by the MCU in order to allow a
new message to be received into the buffer. This bit
provides a positive lockout to ensure that the MCU has
finished with the message before the MCP2515
attempts to load a new message into the receive buffer.
I try to clear that bit by using the function: mcp2515.clearInterrupts();, however that doesn' work.
Hello,
I am using the the CAN write and CAN read examples provided with this library, using an Arduino UNO in both ends. The transmitter is continously sending a constant message, and the receiver is able to just receive 3 messages and then nothing.
Is the CAN read example code incomplete? do I need to clear the buffers to receive more messages?
The datasheet of the MCP2515 says the following:
When a message is moved into either of the receive
buffers, the appropriate RXnIF bit (CANINTF) is set.
This bit must be cleared by the MCU in order to allow a
new message to be received into the buffer. This bit
provides a positive lockout to ensure that the MCU has
finished with the message before the MCP2515
attempts to load a new message into the receive buffer.
I try to clear that bit by using the function: mcp2515.clearInterrupts();, however that doesn' work.
Here is my code inside the void loop:
`
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(" ");
}
else if(mcp2515.readMessage(&canMsg) == MCP2515::ERROR_FAIL){
Serial.println("Error reading CAN message");
}
else if(mcp2515.readMessage(&canMsg) == MCP2515::ERROR_NOMSG){
Serial.println("NO MSG");
mcp2515.clearInterrupts();
delay(1000);
}
else{
uint8_t stat = mcp2515.getStatus();
Serial.println(stat);
delay(1000);
}
}
`
Thanks for your help,
The text was updated successfully, but these errors were encountered: