An interesting feature of Nucleo. Two identical microcontrollers behave differently.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-05 7:45 AM
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.
Solved! Go to Solution.
- Labels:
-
UART-USART
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-05 8:33 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-05 8:33 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-05 9:21 AM
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.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-05 11:15 AM
Agree with previous comments:
- What is the hardware and what is Clock Configuration (Internal RC Oscillator, Internal Calibrated RC Oscillator, External Crystal/Resonator, other).
- Temperature and calibration can greatly affect asyncronous communications
- 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
