Skip to main content
KMew
Senior III
February 14, 2023
Solved

CAN: Clock Frequency Scaling Issues to Achieve Baud Rate

  • February 14, 2023
  • 1 reply
  • 1314 views

Hello,

I am attempting to add CAN communication to one of my co-worker's boards, who is using the STM32F303RE MCU with an external 30 MHz crystal oscillator. The CAN communication uses the APB1 Peripheral Clock, which is currently using 30 MHz as well.

When I attempt to make a specific baud rate (250 kBit/s), I used http://www.bittiming.can-wiki.info/ to get the parameters to achieve that. When I put the values in, it shows the baud rate in a greyed out section that says it's 249.999 kBit/s.

What I want to know is if that will cause issues when actually applied? Since it's not "exactly" 250 kBit/s. Has anyone else had this occur and can say whether it works or not?

0693W00000YAiO3QAL.png

This topic has been closed for replies.
Best answer by Javier1

I see that sometimes myself, thats a cubeMX float precission error (java?)

If the time for one bit is 4000ns you should be good

You could also try this (you get a rounded time quantum)

0693W00000YAiQsQAL.png

1 reply

Javier1
Javier1Best answer
Principal
February 14, 2023

I see that sometimes myself, thats a cubeMX float precission error (java?)

If the time for one bit is 4000ns you should be good

You could also try this (you get a rounded time quantum)

0693W00000YAiQsQAL.png

hit me up in https://www.linkedin.com/in/javiermuñoz/
KMew
KMewAuthor
Senior III
February 14, 2023

Hello Javier,

Thank you for this reply! Yes, this option should work as well. I will be testing this in a lab environment with the Vector CANalyzer that we have, but having a configuration that does explicitly state 250 kBit/s is more reassuring for the development phase.

I'm surprised the website didn't give that configuration...

Javier1
Principal
February 14, 2023

>>I'm surprised the website didn't give that configuration...

That means youre just getting started here.

0693W00000YAiSyQAL.gif

hit me up in https://www.linkedin.com/in/javiermuñoz/