Skip to main content
Visitor II
September 29, 2025
Solved

CAN wrong bit timing: bit time larger than expected

  • September 29, 2025
  • 2 replies
  • 530 views

Title edited to give an accurate idea of the issue.

Hello together,

i had a problem with setting a correct bit time on a CAN-port.

On my nucleo-h755ZI-Q board, I want to operate the FDCAN1 by the CM4 in classic-can mode with a baud rate of 1 MHz.

I supply the FDCAN with a clock of 50MHz:

HiSt_0-1759130563982.png

HiSt_1-1759130584276.png

Therefore the corresponding registers are set as follows:

HiSt_2-1759130618964.png

With:

HiSt_3-1759130645218.png

this excerpt in the reference manual, the calculation is:

tfdcan_tq_ck = 0,02 µs  <- (1/50MHz)

tq = 0,1µs          <-             (0,02 *  5)

The bit time ist 1µs   <-  (0,1 *( 7+1+0+1+1))

-> baudrate is 1 Mhz    -> 1/1µs

But in the outgoing frames, I measure a bit time of approx. 3µs.

HiSt_4-1759130686774.png

Enlarged:

HiSt_5-1759130708152.png

How can that be? What did I do wrong or overlook?

Thank you and best regards,

HiST

 

 

    This topic has been closed for replies.
    Best answer by mƎALLEm

    Just forget that you are using a nucleo-h755ZI-Q while in the Clock config you set the crystal to 25MHz in a crystal mode! But there is no external crystal in that board connected to OSC_IN/OSC_OUT.

    This is the schematic:

    mALLEm_0-1759140281245.png

    What I suggest is to use the bypass mode but for that you need some steps:

    1- Modify the STLINK MCO output to generate 5MHz instead of 8MH generated from HSI. Ensure SB72 is soldered. Please refer to this article to do that: How to use STLINK-V3 MCO output on Nucleo boards as a precise clock source for STM32

    2- In your ioc file you need to update the RCC config: HSE in Bypass mode with HSE value = 5MHz

    mALLEm_0-1759140641754.png

    mALLEm_1-1759140663420.png

    + use the same bit timing config I provided in my previous post.

     

    2 replies

    Graduate II
    September 29, 2025

    Was the CAN communication established between the two nodes at 1Mbps? Were you able to receive and transmit messages? Just for confirmation.

    HiStAuthor
    Visitor II
    September 29, 2025

    No, due to incorrect bit timing and the resulting incorrect baud rate, I cannot communicate with another participant.

    Technical Moderator
    September 29, 2025

    Hello,

    Attach your ioc file and tell more about what you are connecting to nucleo-h755ZI-Q as a second CAN node.

    mƎALLEmAnswer
    Technical Moderator
    September 29, 2025

    Just forget that you are using a nucleo-h755ZI-Q while in the Clock config you set the crystal to 25MHz in a crystal mode! But there is no external crystal in that board connected to OSC_IN/OSC_OUT.

    This is the schematic:

    mALLEm_0-1759140281245.png

    What I suggest is to use the bypass mode but for that you need some steps:

    1- Modify the STLINK MCO output to generate 5MHz instead of 8MH generated from HSI. Ensure SB72 is soldered. Please refer to this article to do that: How to use STLINK-V3 MCO output on Nucleo boards as a precise clock source for STM32

    2- In your ioc file you need to update the RCC config: HSE in Bypass mode with HSE value = 5MHz

    mALLEm_0-1759140641754.png

    mALLEm_1-1759140663420.png

    + use the same bit timing config I provided in my previous post.

     

    HiStAuthor
    Visitor II
    September 29, 2025

    Hello m3ALLEm,

    yes, thank you, this was the solution. 

    And also responsible for some other problems I had.

    Now I also measure the correct bit time.

    Best regards,

       HiST