CAN bit timing configuration for STM32 G4 series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-16 2:40 AM - last edited on ‎2025-06-18 8:26 AM by mƎALLEm
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
- Labels:
-
CAN
-
STM32G4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-18 8:25 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-18 10:43 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-19 1:22 AM
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%:
PS: as per the info you provided the CAN bitrate is at 500kb/s
Hope that helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-19 1:31 AM
Hello!
I used these values to communicate between the two custom pcbs we have with G474RETx MCU chip. They are working in external loopback at 1 Mbps with above settings, but are not communicating in normal mode.
If it helps, I am using TCAN337G transceiver.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-19 1:43 AM
@Kratika_Verma wrote:
Hello!
I used these values to communicate between the two custom pcbs
Which values you are talking about here? the ones I provided or what you provided previously?
Try to connect the two custom pcbs you have and run the normal mode with the same parameter I provided.
Check the status of S pin:
I think it needs to be connected to GND according to the datasheet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-19 1:54 AM
I am using the values, which you provided.
The values are-
Nominal Prescaler = 10
Time Segment1 = 13
Time Segment2 = 3
When I am using at 125kbps, custom pcbs are communicating without at any problem in normal mode.
Any speed higher than 125kbps is not working in normal mode.
The S pin is connected to the GND.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-19 2:05 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-19 2:08 AM
We are using the internal clock source. We will try with the external clock source
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-19 5:11 AM
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)
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
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.
