cancel
Showing results for 
Search instead for 
Did you mean: 

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.

VadymS
Associate II

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");

1 REPLY 1
PMuld.1
Associate

Thought I'd answer this, even if it's more than one year late. I recently ran into this, too. The issue is the Virtual COM Port (exposed by the ST-Link bit of the nucleo board) doesn't support 7 (or lower) bit word length, apparently. For USART, the parity bit is included in the word length. The example sets the word length to 8 with "UartHandle.Init.WordLength  = UART_WORDLENGTH_8B;", so this makes the example not function with the VCP. You'd have to connect solder bridges to expose the serial RX/TX, but then your VCP probably doesn't work anymore (refer to the manual). Or, as a better option, you could just change the example to use "UartHandle.Init.WordLength  = UART_WORDLENGTH_9B;" and connect to the VCP with your utility of choice (putty, screen, whatever) with word length 8, 1 stop bit, parity odd