Skip to main content
Kabeone
Associate
July 26, 2020
Question

STM32F401RE UART Interrupt

  • July 26, 2020
  • 3 replies
  • 952 views

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.

This topic has been closed for replies.

3 replies

S.Ma
Principal
July 26, 2020

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
KabeoneAuthor
Associate
July 26, 2020

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

Tesla DeLorean
Guru
July 26, 2020

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..