cancel
Showing results for 
Search instead for 
Did you mean: 

UART Receive Buffer Clear

anuj
Associate II
Posted on September 03, 2016 at 00:50

I am working on STM32F0. I am little confused between

USART1_IRQHandler

and

HAL_UART_RxCpltCallback
HAL_UART_RxHalfCpltCallback
HAL_UART_TxHalfCpltCallback
HAL_UART_TxCpltCallback

Is it necessary to use Callback when UART is setup as interrupt. What does Callback do? I am sending a string for example ''1234'' to STM The string is stored in buffer using

HAL_UART_Receive_IT

When I send another string for example ''ABCD''. the Buffer is filled up like this ''1234ABCD''. But both are separate strings, how can I clear previous buffer so that everytime I send string it do not add up with previous one. Is callback necessary for this. Kindly help please! #usart #stm32 #uart #interrupt #!stm32f030-!usart
3 REPLIES 3
Posted on September 03, 2016 at 02:58

I'm not a HAL user, but a serial stream of data doesn't understand the two consecutively sent strings are separate. You'd need to send some delimiter, like a carriage return, and line feed pair, or a comma?

The IRQHandler calls HAL service routines, that decompose the nature of the interrupt, handle aspects of its service, and then call back routines to allow you to manage the data. It provides a pretty heavy level of abstraction.

You might want to dig through examples provided in the Cube directories.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Anh Le
Associate
Posted on July 05, 2017 at 06:43

Did you clear Uart Receive Buffer yet?

Can you show me the way to clear it for the next interrupt Uart??

Posted on August 27, 2017 at 09:55

Actually reading from the Uart clears the receive buffer, using HAL_UART_Receive or HAL_UART_Receive_DMA or other types of functions.