Maybe you already discovered the UART-port on the GuruPlug or the RS-232 port on the JTag module and you were wondering what they can be used for. Both of them are (almost) the same, RS-232 only uses different voltage levels for logical 0 and 1 than UART does. The UART/RS-232 port can be used for a simple communication between the GuruPlug and a PC or microcontroller, since it is (more or less) standardized and widely used.


As the name says, UART (Universal Asynchronous Receiver Transmitter) is an asynchronous (no clock for synchronization) digital interface which is used for bidirectional (both devices can be sender/receiver) serial communication between two devices. The UART-interface is very common as RS-232 or RS-485 and it is supported by almost all of the recent microcontrollers. To transmit/receive data, at least three wires are needed: RxD (receive data), TxD (transmit data) and GND (ground). Furthermore, there can be wires for flow control (hardware handshake RTS/CTS) and other signalling wires. To use the UART for example as RS-232 interface, some kind of level converter is needed since the UART on the microcontroller usually works from 0 to +3V, whereas RS-232 uses -15V to +15V.


Transmitting/Receiving data:
The word "asynchronous" means that there is not clock which synchronizes the two communicating devices. The advantage is that no additional clock wire between sender/receiver is needed, the disadvantage is that both devices need the same configuration (bit-/baud-rate, control bits, ...) and both devices need to run at the same speed. Data is sent in packages of 5 to 9 data bits (usually 8 bit are used to send 1 byte per package). plus additional control bits. Let's take a look at such a packet:

start-bit data 0 data 1 data 2 data 3 data 4 data 5 data 6 data 7 (data 8) (parity) stop-bit(s)


If no communication is going on, both devices wait for the start-bit (a change in the level of the RxD wire). During this idle time, the data lines are on a defined level (0 or 1). As soon as the receiver detects a potential change on RxD, it is interpreted as the start-bit and according to the baud-rate, the receiver now reads the level of RxD in the defined interval. After the data bits and the optional parity bit are received, the data line stays at the defined idle level which is also the level of the stop-bit and waits for the next start bit. To give the receiver more time to process the received data or to provide better resynchronization, the number of stop bits can be defined from 1.5 to 2. A more detailed description is available here: Asynchronous receiving and transmitting


Flow control:
What happens if the receiver is not able to process the received data fast enough? The sender will continue sending at the same speed and data will get lost. This is why sometimes the receiver has to signal the sender to stop or continue sending data, which is called "handshake". There are two ways: either by software handshake or hardware handshake.
Software handshake: The receiver sends a Xoff (decimal 19, hex 0x13) or a Xon (decimal 17, hex 0x11) over the TxD wire to signal transmission stop (Xoff) or to continue transmission (Xon). The advantage of this method is that no additional wire is needed, the disadvantages are that the sender has to listen what it is receiving ofer RxD during transmission and that not all 256 signs can be used, since 0x13 and 0x11 are reserved for Xoff and Xon.
Hardware handshake: For hardware handshake, two additional wires are used. They are called CTS (clear to send) and RTS (request to send). If the sender wants to send data, it sets the RTS wire to 0. The receiver then answers, if ready to receive data, by setting the CTS wire to 0. As soon as the receiver can not process the received data any more, it sets the CTS to 1 to signal the sender to stop sending data until the CTS is set to 0 again.


The described UART-type is the basic type, but there are also other modified/improved UART-types:

  • DUART (Dual Universal Asynchronous Receiver Transmitter)
  • USART (Synchronous/Asynchronous Receiver Transmitter)



Sources (mostly German):