cancel
Showing results for 
Search instead for 
Did you mean: 

Reliable U(S)ART between two STM32 MCUs with internal oscillator

T B
Associate II
Posted on September 15, 2017 at 11:37

Hello!

I have a best practice question.

Correct UART communication requires the transmitter and receiver clocks differ by less than 5% (2.5% per MCU), otherwise communication errors may occur. For the temperature range TA = 0 to 85°C the Accuracy of the HSI oscillator is good enough. But for temperatures below 0°C, the HSI has too less accuracy.

What do you do?

•    Use external oscillator

•    Use autobaud detection.

•    Oscillator calibration with external signal

•    Do not care

•    ….0690X00000608FrQAI.png
2 REPLIES 2
Posted on September 15, 2017 at 14:39

Hello!

0690X00000608GGQAY.png

In my opinion, best practice is to use synchronous comunications in systems with inaccurate clocks

and asynchronous in systems with acceptable accuracy clocks.

The answer depend on more than one factors.(also freq stability is a factor)

Example: If  a boiler overperessure allarm system(this is a variable temperature environment) depends on this type on communication ,for sure i would use an external crystal for osc.

I tried HSI as clock with baudrate 4800 and worked OK . no calibration made. (not had frame errors)

Reliability  of such systms can increased  with other methods at higher layers(ECC CRC, tight potocols).

Regards

vf

Posted on September 15, 2017 at 16:43

>>But for temperatures below 0°C, the HSI has too less accuracy.

I'm assuming that the other isn't at 85C and both likely track in the same direction not polar opposite. ie a share experience not a combined one.

Use two crystals (same part#), again experience will be shared, but deviation tighter.

The boot loader uses USART RX pins connected to a TIM channel to time a test pattern, and set baud rate, I'd perhaps use that to trim BRR high or low. The design is awful here, the dividers were designed by a college intern...

Based on the design I'd estimate you've got a least +/-6.25% on the USARTs

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