Skip to main content
MArgi
Associate II
December 13, 2018
Solved

STM32F0xx BxCAN Loop-back Transfer Delay

  • December 13, 2018
  • 1 reply
  • 724 views

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

This topic has been closed for replies.
Best answer by MArgi

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.

1 reply

MArgi
MArgiAuthorBest answer
Associate II
December 14, 2018

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.