cancel
Showing results for 
Search instead for 
Did you mean: 

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

MBond.1
Associate

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

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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

View solution in original post

3 REPLIES 3
TDK
Guru

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

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 Venmo
Up vote any posts that you find helpful, it shows what's working..
Paul1
Lead

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