cancel
Showing results for 
Search instead for 
Did you mean: 

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

Khetag Goiaev
Associate II

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

15 REPLIES 15
TDK
Guru

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

@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

> (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

LMI2
Lead

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.

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

@Community member​ 

FT232R, if I'm not mistaken

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

JW

@Community member​ 

Sending "6" to STM, receiving back "Hi" and interpreted 60693W00000BdawNQAR.png

I don't understand what do you display here. Why don't you do the same "echo" test as above, so that we can see both waveforms on Rx and on Tx pins and compare them.

JW