cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 CAN interrupt latency problem

markus-muc
Associate II
Posted on April 05, 2016 at 12:21

I am using an STM32F105 on a CAN network. I have initialized the CAN to use an external 8MHz crystal, 100k baud, and enabled the FIFO message pending interrupt. My CAN interrupt service routine reads the CAN message and the current time stamp from the running RTC and printf both to USART (putty). 

Now, I can see from the putty output that the interrupt service routine is fast enough to handle a CAN message about every 1 millisecond. However, once in a while there is a latency of ~100 milliseconds until the next CAN interrupt is served. As a result, the CAN FIFO is already full (3 messages) and the overflow bit is set (see attached putty screenshot). 

Any idea what is causing these dead times of ~100msec in which the CAN interrupt is not served?
2 REPLIES 2
markus-muc
Associate II
Posted on April 06, 2016 at 15:23

Problem solved. Culprit was indeed the USART, and I could resolve it by adding a software managed buffer and increase the USART speed to 268800 baud.

Walid FTITI_O
Senior II
Posted on April 06, 2016 at 18:20

Hi t.markus,

Thanks for your contribution and sharing what you have found.

-Hannibal-