AnsweredAssumed Answered

9-bit UART receive STM32F103

Question asked by Marco Zulli on May 7, 2018
Latest reply on May 8, 2018 by Clive One

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

Outcomes