Skip to main content
Khetag Goiaev
Associate II
Jul 9, 2021 8:25 PM UTC
Question

Trying to understand why USART is not working properly on high baud rates

While USART (receive from PC and transfer of gained information back, pic. 1) perfectly works on low baud rates like 9600, use of high baud rates leads to obscure results (bad receive and OK transmit, pic. 2)

STM32L476VGT6

This topic has been closed for replies.

15 replies

TDK
Jul 9, 2021 8:41 PM UTC

Higher rates are less tolerant to jitter or clock mismatch. Although 14400 shouldn't be a problem. Check to make sure the clock is accurate, pipe MCO out and measure frequency. If you're using HSI, ensure HSITRIM is set properly per the datasheet/reference manual.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Khetag Goiaev
Associate II
Jul 13, 2021 3:43 PM UTC

@TDK​ 

Not sure I can measure frequency (the only tool I have is logic analyzer).

Also tried to use different clock sources (including HSI) but no change.

Is there anything else that can cause the problem?

I start hating this board and myself for not being able to set up such a simple interface

TDK
Jul 13, 2021 4:31 PM UTC

This is exactly how a mismatch in clock rates would manifest. A logic analyzer will be enough to show the signal rate on the line. Double check that the speed, parity, and stop bits settings are identical on both the STM32 and the receiving PC.

It can be frustrating, but there is an explanation and solution if you want to spend the time to find it.

"If you feel a post has answered your question, please click ""Accept as Solution""."
waclawek.jan
Super User
Jul 13, 2021 4:12 PM UTC

> (the only tool I have is logic analyzer).

Then observe the USART pins using that tool.

What do you use as interface between STM32 and PC?

JW

Khetag Goiaev
Associate II
Jul 13, 2021 5:04 PM UTC

@Community member​ 

FT232R, if I'm not mistaken

waclawek.jan
Super User
Jul 13, 2021 5:31 PM UTC

OK and now show the waveforms on the STM32 UART pins observed by the logic analyzer.

JW

LMI2
Senior III
Jul 13, 2021 4:23 PM UTC

I wonder. If you have your clock frequencies high enough that you can divide good frequencies to the UART, then what else can go wrong. Is your ARM fast enough. Can your chip drive IO well. Can your system handle single bytes, but not several with zero delay between them.

waclawek.jan
Super User
Jul 14, 2021 7:32 AM UTC

Even your LA does not receive the data properly, why do you think this is problem in STM32?

Check your ground connections. Try using a different UART/USB transceiver.

JW

TDK
Jul 14, 2021 1:10 PM UTC

The STM32 TX looks perfect. The PC TX isn't a valid UART signal at any baud rate, but that's not the fault of the STM32.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Javier1
Principal
Jul 29, 2021 11:13 AM UTC

I see you got a nice logic analyzer, what if you use also an oscilloscope? ¿did you ruled out noise in the data lines already?

hit me up in https://www.linkedin.com/in/javiermuñoz/
S.Ma
Principal
Oct 5, 2021 9:59 AM UTC

I don't understand, 115200bps is typical baudrate for many applications, maybe because long ago the 2 wire I2C bus was 100kbps. I can make rs232 with HC05 module at 115200bps using HSI internal clock. No sweat bringup. It seems the issue is something like something obvious and overlooked.