cancel
Showing results for 
Search instead for 
Did you mean: 

how to calculate usart ''Error calculation'' - desired baud rate != actual baud rate

John Doe1
Associate III
Posted on December 30, 2017 at 23:17

Hello all,

I have no idea how to calculate usart '% error calculation' for stm32f429. There is difference between actual baud rate and desired baud rate. Why actual baud rate != desired baud rate?

I try to calculate usart % of error for 90mhz. The last calculation in documentation is for 84mhz (see attach).

thanks in advance

#percentage #usart #calculate #stm32f4-uart-brr-sampling-8 #error
5 REPLIES 5
Andrew Neil
Evangelist III
Posted on December 30, 2017 at 23:35

Calculating the error is easy - it's just the difference between your actual baud rate, and the desired baud rate.

I guess you really mean how to calculate the actual baud rate?

Posted on December 30, 2017 at 23:41

The BRR is an integer register, at OVER16  brr = apbclk / baud;

actualbaud = apbclk / brr;

error = 100 - ((actualbaud / baud) * 100)

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on December 31, 2017 at 12:35

Thanks for reply.

Yes - exactly - how to calculate actual baud rate?

i.e. 460.8KBps(desired) = 461.54KBps(actual) - why?

Posted on December 31, 2017 at 12:38

Right . That's just simple math.

I realized that actual baud rate is different than desired baud rate. No idea why desired is different than actual.

Any hints how to calculate actual baud rate and why it's different than desired?

Posted on December 31, 2017 at 13:53

You are using integers so fractional precision is lost. You can use rounding, or start with source clocks which are exact multiples.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..