2025-06-18 6:00 AM - last edited on 2025-06-18 6:06 AM by mƎALLEm
Hi,
I'm currently working on the STM32G491 board and implementing CAN communication.
With the system clock configured using PLL at 80 MHz, I have set up the CAN peripheral with the following parameters:
hfdcan1.Init.NominalPrescaler = 10;
hfdcan1.Init.NominalSyncJumpWidth = 2;
hfdcan1.Init.NominalTimeSeg1 = 13;
hfdcan1.Init.NominalTimeSeg2 = 2;
hfdcan1.Init.DataPrescaler = 2;
hfdcan1.Init.DataSyncJumpWidth = 2;
hfdcan1.Init.DataTimeSeg1 = 13;
hfdcan1.Init.DataTimeSeg2 = 2;
hfdcan1.Init.StdFiltersNbr = 10;
hfdcan1.Init.ExtFiltersNbr = 0;
With this configuration:
The nominal time quantum (TQ) is 125 ns
Nominal bit time is 2000 ns
Bitrate is 500 kbps
This setup works as expected.
Now, I need to run the same CAN configuration using the internal HSI clock at 16 MHz. I updated the CAN settings accordingly:
hfdcan1.Init.NominalPrescaler = 2;
hfdcan1.Init.NominalSyncJumpWidth = 2;
hfdcan1.Init.NominalTimeSeg1 = 13;
hfdcan1.Init.NominalTimeSeg2 = 2;
hfdcan1.Init.DataPrescaler = 2;
hfdcan1.Init.DataSyncJumpWidth = 2;
hfdcan1.Init.DataTimeSeg1 = 13;
hfdcan1.Init.DataTimeSeg2 = 2;
hfdcan1.Init.StdFiltersNbr = 10;
hfdcan1.Init.ExtFiltersNbr = 0;
This also results in:
Nominal time quantum of 125 ns
Bit time of 2000 ns
Bitrate of 500 kbps
However, communication is not happening with this 16 MHz configuration.
Is a higher system clock (like 80 MHz) required for CAN to function reliably, or can 16 MHz be used with the right settings?
2025-06-18 6:06 AM - edited 2025-06-18 6:07 AM
Hello,
What do you mean by "However, communication is not happening with this 16 MHz configuration." You mean the transmission?
Did you try the External loopback mode and probe what happens on CAN_Tx?
Knowing that HSI is not recommended for CAN communication in Normal mode.
What board are you using? also better to share your ioc file.
2025-06-18 7:08 AM
Hi @mƎALLEm ,
I am using PCAN view in PC and transmitting CAN messages to my MCU. in 80 MHZ config the transmission happens on both side. but in 16 mhz I am not getting any data on both side.
2025-06-18 7:18 AM
Before going ahead with Normal mode please try with the External Loopback mode at least to discard any hardware effects.