cancel
Showing results for 
Search instead for 
Did you mean: 

CAN Rx interrupt sometimes misses one

Maddi.Mike
Associate II
Posted on May 02, 2013 at 15:12

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.

#can-stm8s208
1 REPLY 1
Maddi.Mike
Associate II
Posted on August 19, 2013 at 21:25

I have not yet solved this problem. Can anyone help?