AnsweredAssumed Answered

Best way to use HAL UART Receiver IT Function?

Question asked by h.hammer on Jul 18, 2014
Latest reply on Feb 11, 2016 by corporate.divum
I'm trying to understand how the interrupt handlers works for the HAL UART module. I have the UART1 set with global interrupts using stm32cubeMX generated code, and am able to send and receive data into buffers.

Using the HAL_UART_Receive_IT() function, I see the application enter the HAL_UART_RxCpltCallback function once the buffer is full. How do I ready the module for another receive interrupt when I'm done in this callback handler? If I issue the HAL_UART_Receive_IT() function again at the end of the handler, my application gets stuck after a few receive interrupts.

I essentially want to use the UART to receive various console like commands (each different in length) so plan to use the callback handler to house a table of possible commands and act on them. As the interrupt only triggers on a full buffer, would I need to read single characters at a time, or is there a better way of doing this?

Outcomes