Setting FDCAN port parameters of STM32G0B1x for communication with CAN2.0 device
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-24 8:41 AM - last edited on ‎2025-02-24 9:06 AM by mƎALLEm
Hi,
I am using STM32G0B1x MCU on my custom hardware and using built in FD CAN controller for communication with external CAN 2.0 device. ATA6560/1 is the CAN transceiver chip from Microchip I am using on my custom board. As per datasheet this chip is CAN FD ready.
I have gone through application note AN5348 and also video - https://www.youtube.com/watch?v=xGRvVKfs2-0 for using FDCAN in normal operating mode. It tells me to use kvaser tool to calculate values for parameters for CAN controller settings. I used this tool with following inputs to achieve Nominal and Data bit rate as 125Kbps.
My external CAN2.0 device works at 125Kbps.
I got calculated parameter values as below:
I was able to set values for Nominal parameters but for Data parameters, calculated values are far away out of range and STM32CubeIDE is a not allowing me to set these values. As per calculation, Data SJW = 255 but tool says its value can be between 1 to 16.
Same is issue with Data Time Seg1 and Data Time Seg 2. Calculated values are 256 and 255 respectively while max value as per tool should be 32 and 16 respectively.
Please help with this issue.
Thanks,
Pradeep
Solved! Go to Solution.
- Labels:
-
CAN
-
FDCAN
-
STM32G0 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-24 9:42 AM - edited ‎2025-02-24 9:44 AM
Hello,
I would suggest the following settings:
And you need to use an external crystal not HSI as source clock for the CAN.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-24 9:05 AM - edited ‎2025-02-24 9:06 AM
Hello,
As you will communicate with CAN2.0 device you need to set FDCAN to Classic Mode. The data phase is no more taken in this case:
And no need to set SEG1 and SEG2 for the data phase.
I've attached an example of FDCAN configuration in Classical mode (CAN clock = 16Mhz) with a bitrate of 125kb/s with a sample point set at ~84%.
Hope that answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-24 9:28 AM
Hi,
In that case, with CAN Clock = 64MHz in my case, are below valid settings for 125Kbps?
Thanks,
Pradeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-24 9:42 AM - edited ‎2025-02-24 9:44 AM
Hello,
I would suggest the following settings:
And you need to use an external crystal not HSI as source clock for the CAN.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-24 11:32 PM
Hi,
Thankyou for providing settings. I am using external crystal of 8MHz. From 8MHz, PCLK of 64MHz is generated using internal PLL. This PCLK is used as CAN clock. Below is my clock configuration:
Do you suggest to you HSE directly?
Thanks,
Pradeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-24 11:39 PM
You can use PLLQ:
If I answered your original question please accept as solution the comment that answered it.
