cancel
Showing results for 
Search instead for 
Did you mean: 

9-bit UART receive STM32F103

Marco Zulli
Associate II
Posted on May 07, 2018 at 11:34

Hello all,

I am really new at all this, I hope someone has a simple example to help.

I am trying to receive 9-bit data using the STM32-F103 in normal polling mode example code below

uint16_t

messages[30];

HAL_UART_Receive(&huart2, (

uint8_t

*)messages,

sizeof

(messages),1000);

I thought a 16 bit register should be used to get all 9 bits, however looking at the data that is contained in the messages array, they are all over the place and I can't make sense of it and in most cases all 16 bits are populated when I'd expect only 9 bits populated in each element of the array.

Anybody got a simple solution for me?

Thank you all in advance

10 REPLIES 10
Marco Zulli
Associate II
Posted on May 30, 2018 at 03:00

Thanks for all the support. What I didn't mention was that I'm running a nucleo, turns out that uart2 is configured to support the serial programming- resoldered the links and now works. Was in the nucleo instructions....