Skip to main content
VadymS
Associate
Dec 7, 2020 1:19 PM UTC
Solved

UART example for STM32WB55 "printf" prints gibberish. I see, the characters are sent to "HAL_UART_Transmit" are correct. BLE HRT example prints debug messages correct.

The printed message is:

▒▒RT ▒▒▒n▒▒ E▒amp▒▒ ▒▒▒a▒g▒▒ ▒h▒ C ▒▒b▒a▒y p▒▒n▒▒ ▒un▒▒▒▒n ▒▒ ▒h▒ ▒▒RT▒

Instead

printf("UART Printf Example: retarget the C library printf function to the UART\n\r");

This topic has been closed for replies.
DJC
DJCBest answer
Senior
Dec 7, 2020 1:49 PM UTC

Looks to me like you simply don't have the UART setting matching between sender and receiver. Ie: sending 8bits with no parity, recieving 7 bits with parity.

A classic issue I hit EVERY 6 months is that the STMIDE setting for UART says "word lenght 8 bits (including parity).

Where as my receiving software says something like "data length = 8 bits" and then the parity is extra. ... these kinds of broken chars is what I see as a result.

I'm too lazy to do the hard-work here, so i just keep trying receiver settings until i see clean text : P

3 replies

Tesla DeLorean
Guru
Dec 7, 2020 1:42 PM UTC

You'll need to chase down the plumbing, perhaps code in syscalls.c or otherwise implementing _io_putchar() type functionality.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
DJC
DJCBest answer
Senior
Dec 7, 2020 1:49 PM UTC

Looks to me like you simply don't have the UART setting matching between sender and receiver. Ie: sending 8bits with no parity, recieving 7 bits with parity.

A classic issue I hit EVERY 6 months is that the STMIDE setting for UART says "word lenght 8 bits (including parity).

Where as my receiving software says something like "data length = 8 bits" and then the parity is extra. ... these kinds of broken chars is what I see as a result.

I'm too lazy to do the hard-work here, so i just keep trying receiver settings until i see clean text : P

VadymS
VadymSAuthor
Associate
Dec 7, 2020 1:55 PM UTC

Thanks!!!

The parity was defined ODD in both sides. But, it starts to work without the parity.