Skip to main content
MBond.1
Visitor II
October 5, 2021
Solved

An interesting feature of Nucleo. Two identical microcontrollers behave differently.

  • October 5, 2021
  • 3 replies
  • 2052 views

Hello everyone. Today I ran into an interesting and at the same time unpleasant problem. The same program is loaded into two identical microcontrollers, but the result of the work is completely different. The screenshot shows the data from the UART received from one and the other microcontroller.0693W00000FBWWGQA5.png0693W00000FBWX4QAP.png

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

Looks like the baud rate is slightly off, which causes the last bit (MSB) to be sampled during the stop bit, which makes it 1.

The internal HSI is not terribly accurate, although at 9600 baud it shouldn't be an issue. There have been cases reported where the factory-calibrated HSI was off by several percent. You can calibrate it or use HSE instead.

3 replies

TDK
TDKBest answer
October 5, 2021

Looks like the baud rate is slightly off, which causes the last bit (MSB) to be sampled during the stop bit, which makes it 1.

The internal HSI is not terribly accurate, although at 9600 baud it shouldn't be an issue. There have been cases reported where the factory-calibrated HSI was off by several percent. You can calibrate it or use HSE instead.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Tesla DeLorean
Guru
October 5, 2021

Honestly it would be helpful to be specific about which STM32 model/family, and NUCLEO you're using, and the clock source you're running your code from.

MSI and HSI clocks frequently have calibration values that shouldn't be discarded.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Paul1
Senior III
October 5, 2021

Agree with previous comments:

  1. What is the hardware and what is Clock Configuration (Internal RC Oscillator, Internal Calibrated RC Oscillator, External Crystal/Resonator, other).
  2. Temperature and calibration can greatly affect asyncronous communications
  3. Even if works on the bench, you will need reliable clocks to use Async in production as products in the field will vary even more.

UART/USART Asynchronous communication requires very accurate timing since there isn't a clock signal with the data .

Either:

- use a reliable clock when using any of these (UART, CAN, USB, etc.), or

- change to Synchronous Data Communications method (I2C, SPI, ...)

Paul