cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F0xx BxCAN Loop-back Transfer Delay

MArgi
Associate II

Hi,

I am working on STM32F042.

I have setup the BxCAN peripheral into loop-back silent mode, and it works fine. I can transfer and receive every single frame I am transmitting and no error conditions are detected.

However, I have noticed that when I want to transmit a frame, there is a delay of about 37 ms (!) between setting the TXRQ (request to transmit) bit and the call to the CAN interrupt handler once the flag RQCP (transmission completed) is set.

Has anyone experienced similar delays? Is this happening only in loopback mode?

Thank you,

Marco

1 ACCEPTED SOLUTION

Accepted Solutions
MArgi
Associate II

Found the bug: the prescaler variable was assigned an erroneously calculated value: zero. The library function CAN_Init() was then decremeting it (0x3FF) and setting it in one of the CAN peripheral registers. This was causing the time quantum to be the longest possible, thus causing the 37ms delay.

View solution in original post

1 REPLY 1
MArgi
Associate II

Found the bug: the prescaler variable was assigned an erroneously calculated value: zero. The library function CAN_Init() was then decremeting it (0x3FF) and setting it in one of the CAN peripheral registers. This was causing the time quantum to be the longest possible, thus causing the 37ms delay.