AnsweredAssumed Answered

CAN Rx interrupt sometimes misses one

Question asked by madroadbiker on May 2, 2013
Latest reply on Aug 19, 2013 by madroadbiker
I am using a STM8S208CB in an embedded device on a CAN network. I have initialized the CAN to use an external 8MHz crystal, 250k baud, and enabled the FIFO message pending interrupt. I have my interrupt function process all messages in the FIFO at each interrupt, in case there are more than one, before resetting the interrupt and exiting. This seems to work fine except for one little anomaly. Every once in a while, it misses an interrupt and fails to trigger.
To test this, I am injecting only one CAN message on the bus at a very slow rate - once per second. I have added an output signal in my interrupt function to produce a scope trace so I can see each time an interrupt is triggered. I have my code stripped down to doing nothing except responding to CAN Rx interrupts. The scope output signal negates at each interrupt so that I see a nice steady square wave with a pulse width of one second corresponding to the message input rate. At random times, I see the pulse width double indicating it has missed an interrupt. I can correlate this with output timestamps on the CAN interface device I am using to inject messages (Netronics CANdo in case anyone is familiar with that tool). I see a steady output of once per second with no gaps so I can verify that a message has been sent and that the micro has indeed missed it.
I am totally stumped on this. I would appreciate any help anyone can give. Let me know what code you would like to see or any questions about my application.
Thanks.

Outcomes