cancel
Showing results for 
Search instead for 
Did you mean: 

Setting FDCAN port parameters of STM32G0B1x for communication with CAN2.0 device

PPate.1
Associate II

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.

PPate1_0-1740414729590.png

My external CAN2.0 device works at 125Kbps.

I got calculated parameter values as below:

PPate1_1-1740414856676.png

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. 

PPate1_2-1740415089315.png

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

 

3 REPLIES 3
mƎALLEm
ST Employee

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:

mALLEm_0-1740416218405.png

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%.

mALLEm_1-1740416727109.png

 

Hope that answered your question.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Hi,

In that case, with CAN Clock = 64MHz in my case, are below valid settings for 125Kbps?

PPate1_0-1740418020088.png

 

Thanks,

Pradeep

 

Hello,

I would suggest the following settings:

mALLEm_0-1740418934752.png

And you need to use an external crystal not HSI as source clock for the CAN.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.