AnsweredAssumed Answered

USART - reading 1 byte at a time

Question asked by Rami Rosenbaum on Feb 19, 2017
Latest reply on Feb 20, 2017 by T J

Hi,

I need to parse incoming data from UART, with unknown length.

The packet length is sent within the packet, so I need to parse the packet as it arrives.

So - I need to read 1 byte at a time, and parse the packet while receiving.

I'm using CubeMX generated code and HAL libraries, and will probably work with interrupts.

Should I be calling HAL_UART_Receive_IT(&huart1, &nextByte, 1) within my HAL_UART_TxCpltCallback() method, and move the received byte to the foreground thread' for parse?

Outcomes