STM32 classic can bit rate config
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?
