Using multiple UART-s on MEGA at same time

Hello there.
I do a project with Arduino MEGA and I want to use all available UART-s ( except UART0 which is already used for USB).
As I am not so familiar with MEGA chip I would like to ask a few questions...
So, little explanation... my MEGA is connected with 3 devices over 3 UART-s (UART1,UART2,UART3).
For first 2 devices MEGA is Master. MEGA sends first of them inquiry and wait for an answer. After MEGA get an answer (or time out ) MEGA sends to another and do the same. Problem is the third one, where MEGA or device3 can start communication(both are Masters)

Situation is next: device1 ( UART1) is answering to MEGA (so MEGA is getting data to Buffer) and device3(UART3) wants to start communication.

  1. Are there 3 different Buffers for 3 different UART-s?
  2. If answer on 1. is yes, is MEGA capable to receive simultaneously (at same time) data to Buffer1 and Buffer3?
  3. If answer on 1. is yes, is it possible to receive data on UART1 (buffer 1 ) and to send data from UART3 at same time?
    All these questions concerns hardware level of MEGA. Reading data from Buffer(s) will be implemented on software level.

Thanks in advance,

yes, the rx hardware FIFO buffers are separate, but reading the char arrays for processing the received data is your responsibility.

yes, the four UARTS can operate in parallel… remember to build up your code as non-blocking so the incoming streams can be handled as quickly as possible

yes, asynchronous tx/rx on multiple ports is straightforward- no special considerations than handling them as responsively as you can (above).

Thanks lastchancename !

No problem, UARTs do not distinguish master and slave, both stations on the same UART can send at the same time: full duplex.

Robin2's serial input basics tutorial will help you to write non-blocking serial receive code.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.