pierremolinaro / acan2515

MCP2515 CAN Controller Driver for Arduino
MIT License
74 stars 29 forks source link

RX0OVR bit gets stuck #29

Closed obdevel closed 3 years ago

obdevel commented 3 years ago

Sometimes, under heavy receive load, the RX0OVR bit in the error flag register get 'stuck' on. The errorFlagRegister() method returns 64. It's difficult to reproduce reliably.

RX0OVR: Receive Buffer 0 Overflow Flag bit Sets when a valid message is received for RXB0 and RX0IF (CANINTF[0]) = 1 - Must be reset by MCU

It does coincide with a 'lost' message at the application level (I track a message sequence number in my code). Only a power cycle or grounding the reset pin will resolve it.

I am not using interrupts and am polling frequently for new messages. Receive buffers = 8 but the high watermark is never above 2.

Any thoughts ? Thanks.

MCU is an AVR (1284P).

pierremolinaro commented 3 years ago

Hello,

The MCP 2515 stores incoming message in RXB0, and the poll method transfers this message in the driver receive buffer. If RXB0 overflows and the driver receive buffer does not, it means that you don't poll for new messages often enough.

Try to insert calls to poll into the routines in your sketch that last the longest.

Best regards,

Pierre

Le 24 juin 2021 à 21:54, obdevel @.***> a écrit :

Sometimes, under heavy receive load, the RX0OVR bit in the error flag register get 'stuck' on. The errorFlagRegister() method returns 64. It's difficult to reproduce reliably.

RX0OVR: Receive Buffer 0 Overflow Flag bit Sets when a valid message is received for RXB0 and RX0IF (CANINTF[0]) = 1 - Must be reset by MCU

It does coincide with a 'lost' message at the application level (I track a message sequence number in my code). Only a power cycle or grounding the reset pin will resolve it.

I am not using interrupts and am polling frequently for new messages. Receive buffers = 8 but the high watermark is never above 2.

Any thoughts ? Thanks.

MCU is an AVR (1284P).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan2515/issues/29, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVHRDOY6VIZXNAH2HQTTUOEN3ANCNFSM47IRHETQ.

obdevel commented 3 years ago

Thanks Pierre. That makes sense.

I have a shortage of interrupts, which is why I was using the poll method instead.

I'll close this issue.