2020-07-26 03:03 AM
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.
2020-07-26 04:36 AM
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.
2020-07-26 05:05 AM
Thank you for your quick answer, I'm gonna try that
2020-07-26 07:21 AM
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..