full-duplex UART?

Thread Starter

Kittu20

Joined Oct 12, 2022
511
Hello everyone,

I have a question about UART communication. As far as I know, UART is supposed to be a full-duplex communication , which means it should be able to transfer and receive data simultaneously. However, when I examined some code, I noticed that we have separate functions for sending and receiving bytes. This seems to contradict the idea of full duplex communication.

Could someone clarify if UART is indeed full duplex, and if so, how do these separate functions fit into that concept?
 

nsaspook

Joined Aug 27, 2009
16,250
Why to you think separate functions for sending and receiving bytes contradict the idea of full duplex communication. You can hear and talk at the same time, right?
 

MrChips

Joined Oct 2, 2009
34,628
Full duplex means that the receiver is able to receive data even while data is being transmitted.
In order to transmit, you need a transmit function. In order to receive, you need receive capabilities. These can be implemented in separate functions and are usually implemented as separate functions.
 

Papabravo

Joined Feb 24, 2006
22,058
In code you can only do one thing at a time. Assume for a minute we have a processor with interrupts for TDRE (Transmit Data Register Empty) and RDRF (Receive Data Register Full). As long as both interrupts can be serviced in the time than it takes to send or receive a character, there will never be a problem regardless of which interrupt is serviced first.
 

nsaspook

Joined Aug 27, 2009
16,250
I typically do high speed serial data using DMA (even on 8-bit controllers with DMA capabilities) with separate DMA channels on the receive and transmit because they are separate functional modules of the UART. I can send and receive data directly to program memory with only a single DMA interrupt when the transaction is done. The code only does a start transaction trigger .
 
Top