cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F401RE UART Interrupt

Kabeone
Associate

Hello,

I'm new to embedded software and I have 2 questions about UART communication.

I've coded UART interrupt and have no problem with the transmit function, but the HAL_UART_Receive_IT(&huart2, rx, 10);

only read the first byte I passed to the serial port.

The second one is:

Does UART store byte received in a buffer and send them each time you read it.

Tanks in advance.

3 REPLIES 3
S.Ma
Principal

the hal provides a callback for both tramsmit and receive. you need to fill the callback to implement the ram buffer fifo there. alternatively, use dma cyclically on a ram buffer and periodically poll for incoming data.

Kabeone
Associate

Thank you for your quick answer, I'm gonna try that

Your interrupt handler is supposed to call into HAL, and once HAL accumulates the requested 10 bytes, it calls you back.

Once that is done you need to resubmit a new HAL_UART_Receive_IT()

Want people to have a better idea of exactly what you've built, show code..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..