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 send a message periodically (100 Hz) with the CAN-SHIELD (MPC2515).
In parallel, I execute the following function:
while (CAN_MSGAVAIL == CAN.checkReceive())
{
CanRxInterrupt();
//Serial.println("MSG detects on RX");
}
void CanRxInterrupt() {
unsigned int canId = CAN.getCanId();
unsigned char len;
unsigned char buf[8];
CAN.readMsgBuf(&len, buf);
Serial.println(canId, HEX);
CAN_MSGAVAIL == CAN.checkReceive()
works perfectly with an incoming message and CanRxInterrupt() is called when a MSG is incomming. However, the following line:
unsigned int canId = CAN.getCanId()
always returns the ID of the just periodically sent message and not that of the incoming message. Sommetimes when the incomming MSG ist sent with a verry high frequence i got the correct ID, but nearly never.
OS: Windows 11, Arduino, VS Code
The text was updated successfully, but these errors were encountered:
I send a message periodically (100 Hz) with the CAN-SHIELD (MPC2515).
In parallel, I execute the following function:
CAN_MSGAVAIL == CAN.checkReceive()
works perfectly with an incoming message and CanRxInterrupt() is called when a MSG is incomming. However, the following line:
unsigned int canId = CAN.getCanId()
always returns the ID of the just periodically sent message and not that of the incoming message. Sommetimes when the incomming MSG ist sent with a verry high frequence i got the correct ID, but nearly never.
The text was updated successfully, but these errors were encountered: