Showing results for 
Search instead for 
Did you mean: 

Multiple UART implementation


We are using a the Microcontroller for one of our products , we are using two UARTS for communication , however when both the UARTS are enabled we are facing some difficulties in the communication, can anybody help in this ?

Attached is the main file for the same.

Can we have a call or something with the concerned Engineers so that this can be resolved ?

I will give the details for this.


Senior III

Hello @Pooshan 

Can you add the reference of the MCU you are using. I personally suggest you to do debug your code and to use an oscilloscope to visualise all signals to have a clear idea on the issue.

Best regards.


Senior II

I had read your code already but I really unsure what is your idea to manage both USART.
I had saw somewhere in USART interrupt for USART2 that you didn't get USART2 data but I also do not see another configuration about USART and DMA so I don't see their relation between them.

Do you not have your own engineers?

STM32 parts should have no problem dealing with multiple UARTs concurrently and in full duplex modes. Should avoid using blocking functions, or blocking in interrupts or callbacks. Time there should be very brief, basically just buffering, with processing handled in other tasks or threads.

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

I hope this video tutorial will help: haven't tested it with L0 yet, but it surely works on F1 (3 ports), F4 and H7 (8 ports).

Senior III


Is there no transmit function?

The two UARTS seem to be putting their data in the same receive buffer viz:

  HAL_UARTEx_ReceiveToIdle_DMA(&huart1, RX_Buffer, 50);
  __HAL_DMA_DISABLE_IT(&hdma_usart1_rx, DMA_IT_HT);

  HAL_UARTEx_ReceiveToIdle_DMA(&huart2, RX_Buffer, 50);
  __HAL_DMA_DISABLE_IT(&hdma_usart2_rx, DMA_IT_HT);

Shouldn't you have RX_Buffer1 and RXBuffer2.?





BaudRate setting is different, UART1 is set to 115200 and UART2 is set to 9600

Are you related to the OP? Unfortunately forum questions will likely stall-out if the OP ceases to participate.

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