2025-02-24 08:41 AM - last edited on 2025-02-24 09: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
2025-02-24 09:05 AM - edited 2025-02-24 09: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.
2025-02-24 09:28 AM
Hi,
In that case, with CAN Clock = 64MHz in my case, are below valid settings for 125Kbps?
Thanks,
Pradeep
2025-02-24 09:42 AM - edited 2025-02-24 09: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.