UART data corrupt when reading from terminal, how do I know whether my clock settings are correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-04-12 9:38 AM
I've written a simple program which should write data through UART to a PuTTY terminal on my laptop. I have the L4R5ZI Nucleo board, connected to my laptop via USB. I'm only sending 'Hello World \r\n' however, I get 'H9Go]oG #' back every time. All of the baud rate settings in the terminal are the same as my configuration, so I think it must be a clock error. I don't have an oscilloscope to check. Can anyone help? Thanks in advance.
Solved! Go to Solution.
- Labels:
-
STM32L4 series
-
UART-USART
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-04-12 11:32 AM
No, use PCLK1 or SYSCLK as the clock mux and use HSE bypass as the source for the PLL (or SYSCLK). The Nucleo board should output 8MHz to HSE bypass.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-04-12 9:44 AM
The MSI is not very suitable as a clock source for UART, on account of its inaccuracy.
If you have no means to calibrate this and choose an appropriate MSICalibrationValue, using the provided HSE bypass clock source would be better choice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-04-12 9:49 AM
Do you mean like this? I have the same issue when I use this setup.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-04-12 9:53 AM
Some reason to use 7-bit rather the 8-bit? Terminal configured to match?
hlpuart1.Init.WordLength = UART_WORDLENGTH_7B;
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
‎2022-04-12 10:14 AM
Yes it matches, doesn't change anything ​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-04-12 11:32 AM
No, use PCLK1 or SYSCLK as the clock mux and use HSE bypass as the source for the PLL (or SYSCLK). The Nucleo board should output 8MHz to HSE bypass.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-04-12 12:59 PM
Get the typical 115200/8-N-1 working and only then try unpopular options.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-04-12 1:06 PM
Does the HAL_UART_Init return an ERROR?
If you unpack the LPUART1->BRR does the math work for the baud rate?
Board jumpered for low voltage VDDIO ?
NUCLEO-L4R5ZI
or
NUCLEO-L4R5ZI-P ??
Engineer buys a scope...
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
‎2022-04-13 1:42 AM
Thank you, this worked!
