cancel
Showing results for 
Search instead for 
Did you mean: 

CAN: Clock Frequency Scaling Issues to Achieve Baud Rate

KMew
Senior III

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

1 ACCEPTED SOLUTION

Accepted Solutions
Javier1
Principal

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

we dont need to firmware by ourselves, lets talk

View solution in original post

3 REPLIES 3
Javier1
Principal

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

we dont need to firmware by ourselves, lets talk

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

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

That means youre just getting started here.

0693W00000YAiSyQAL.gif

we dont need to firmware by ourselves, lets talk