Skip to main content
Visitor II
June 16, 2025
Solved

CAN bit timing configuration for STM32 G4 series

  • June 16, 2025
  • 3 replies
  • 886 views

Hello! I am using Zync SOC with STM 32 G4 series. I am targeting 1Mbps baud rate using CAN protocol. I am able to achieve 1Mbps using external loopback on STM. Can someone help me out with bit timing and prescaler values for STM 32 and Zync SOC

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

    What clock source are you using? HSI or HSE with a crystal?

    You need to use HSE with a crystal or any other accurate clock source with HSE in bypass mode.

    3 replies

    Technical Moderator
    June 18, 2025

    Hello,

    What is the exact MCU part number of that G4? and what board are you using for the STM32?

    I don't have any idea about that "Zync SOC" is it using classic or CAN FD protocol?

     

    Visitor II
    June 19, 2025

    Hello! I am using custom board with G474RETx MCU chip. The other node is Xilinx's Zynq FPGA SoC (7030) using classic CAN. 
    The bit timing configurations for G474RETx MCU chip for 1Mbps at 88% sample point and clock 170MHz are-

    Nominal Prescaler = 20

    Sync Jumpwidth = 1

    Time Segment1 = 14  

    Time Segment2 = 2

    The bit timing configurations for Xilinx's Zynq FPGA SoC (7030) for 1Mbps at 75% sample point and clock 25MHz are-

    Baud Prescaler = 3

    Sync Jumpwidth = 1

    Time Segment1 = 2  

    Time Segment2 = 1

     
    Technical Moderator
    June 19, 2025

    Hello,

    We cant' help you for Zynq SoC may be you need to ask your question in their forums, but we can help you with STM32:

    I propose these timings for 1Mb/s and sample point set at 82%:

    mALLEm_0-1750321273424.png

     

    PS: as per the info you provided the CAN bitrate is at 500kb/s

    Hope that helps

    Visitor II
    June 19, 2025

    We are using the internal clock source. We will try with the external clock source 

    Graduate II
    June 19, 2025

    Obaid_tanveer_0-1750334614617.png

    use this website for can bit timing calculations , they also have support for CAN FD, just provide your clock , which is being fed to the FDCAN peripheral (You can look for it in the clock configuration in the project's ioc file)

    Obaid_tanveer_1-1750334843627.png

    and the required bitrate as well as the tolerance.
    below is an example of CANFD bit-timings for a NUCLEO-755zi-Q board 
    I am using CANFD (Classic mode)
    Bitrate required was 250kbits adn the clock frequency is 10Mhz

    Obaid_tanveer_2-1750334893347.png

    Obaid_tanveer_3-1750334909213.png

    NOTE: These bit timings are not MCU specific, the dependencies are Clock source to FDCAN / CAN and the required bit rate , also the Bitrate can be limited depending upon the CAN transceiver used.