cancel
Showing results for 
Search instead for 
Did you mean: 

Facing Issues on Receiving from multiple UARTS at the same time.

Rahul.Santhosh
Associate II

Hello,

I'm Using STM32H7A3RIT MCU and I'm trying to communicate to 5 sensors at a time, through the UART interface. I configured 5 UARTS in my MCU. But I'm facing some issues while transmitting and receiving from all these at the same time. Is it possible to receive UART data from different UART peripherals at the same time? currently, I'm receiving data in interrupt mode. Is it possible or Do I need to use DMA?

--

Thank you in advance.

5 REPLIES 5
Peter BENSCH
ST Employee

Welcome, @RS.8anthosh​, to the community!

Whether this works via interrupt depends on your parameters (load on the STM32, baud rate, etc). If the UARTs deliver the data faster than they can be fetched via interrupt, for example, data will inevitably be lost. In this case the best thing is to actually work with DMA.

Does it answer your question?

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Should work fine with interrupts, depending on speeds, DMA can improve efficiency and loading.

T​hings which can cause issues are excessive processing and dawdling in interrupt handlers and callbacks. Buffer or queue data quickly and leave, perform consumption and processing of data in secondary threads/tasks.

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

actually, the baud rate is less. All sensors are working on 9600 baudrate

Piranha
Chief II

These MCUs can handle up to few tenths of Mbps total data rate even with interrupts. Of course, not with the HAL, but with a sane code. 9600 bps is next to nothing...

Get inspired here:

https://github.com/MaJerle/stm32-usart-uart-dma-rx-tx

Pavel A.
Evangelist III

Just be warned that the HAL library has a very notorious problem with invalid handling of RX overrun (unless it's fixed in the latest version 1.10).

It can be worked around by disabling the overrun detection *in the UART itself* - but this also effectively disables the RX FIFO. So, if you're using interrupts, enable the FIFO, enable overrun detection and be sure to handle it correctly.

With DMA, the UART FIFO is less important and even can be disabled.