top of page
Suche

Serial Communication: How does UART work?

  • Autorenbild: Elias Themeßl
    Elias Themeßl
  • 12. Feb.
  • 4 Min. Lesezeit

UART stands for Universal Asynhronour Receiver/Transmitter and is a very widespread and popular standard. As the name suggests, it is asynchronous data transmission. This is the actual standard. In some cases, you may also encounter USART, which stands for Universal Synchronous Asynchronous Receiver Transmitter. In this case, there is indeed a common clock frequency.

The advantage of UART lies in bidirectional communication. Both participants can send and receive. Only three wires are needed for this.


  • RX – Receive

  • TX – Transmit

  • GND – Ground



It is important to connect RX to TX and TX to RX. GND is the ground and is connected to GND on the other side.


For communication via UART, the following properties must also be defined:

  • Baud rate – Number of bits per second. A baud rate of 9600 is the most commonly used standard. However, there are also other baud rates. The most commonly used are: 9600, 38400, 19200, 57600, 115200. The baud rate must be determined experimentally when reading UART if it is not known.

  • Byte length – Number of bits per byte. As mentioned earlier, the standard is 8 bits per byte. However, UART has the property that multiple bits can be combined into one byte.

  • Parity – The parity bit can be used to compensate for errors. N means no parity bit is used. E stands for even, and O stands for odd. The parity bit indicates whether the sum of the transmitted ones in a byte is even or odd.

  • Stop bits – Length of the stop bit, which is appended to the end of the byte. By sending a stop bit, it is made clear when the transmission is over. The stop bit can be 1, 1.5, or 2 bits long.


The most commonly used standard is known by the abbreviation 8N1. This stands for 8 bits of data, no parity bit, and one stop bit.


As with all other protocols, there are always innovations and newer protocols that build on the original standard. However, the basic functionality of UART should now be clear.

To read UART, it is first necessary to find the pins and headers on the circuit board. In many cases, these are labeled on the circuit board. If this is not the case, you must look for "suspicious-looking pins." In some cases, there may be no specific labeling. In this case, the use of a multimeter or a logic analyzer is recommended.For this reason, I will now explain how to identify UART pins using a multimeter.


If you have found three to four test points on the circuit board that are not labeled, they could be the UART pins. You can be lucky to have headers already soldered in, because most of the time there will only be testpoints on the pcb for UART and you would have to attach your own pins or wires directly to it.



Make sure the device to be tested is turned off. Now set the multimeter to "continuity test." The two test leads should now be plugged into the multimeter. The black test lead goes into the COM port of the multimeter, and the red one goes into the port labeled V or Ω. Under no circumstances should you plug the red test lead into the ampere socket for this measurement!

Now turn the rotary switch of the multimeter to the position for continuity testing. If you now hold both ends of the test leads together, a beep should sound. This tone signals that two contacts are electrically connected. Hence the name continuity.


If the device to be tested is turned off, hold the black test lead to any ground point on the circuit board. Test the individual pins with the other test lead. Congratulations! The pin where the meter beeps is the ground pin.


If there are four pins in a row on the circuit board, one of them is almost certainly for VCC, i.e., the positive pole, 5V, or 3.3V.

To identify this, set the meter to voltage measurement. The two test leads can remain plugged into the multimeter as they are. An upper voltage limit of 20 volts is sufficient for the multimeter.

Now turn on the device and measure the voltage at the pins with the multimeter. The black test lead remains on the ground. Test the individual pins with the red one. If there is a constant voltage of 5 volts or 3.3 volts, it is most likely the supply voltage.


Now you only need to find the pins for RX and TX.


Start by looking for TX! Turn off the device and turn it back on after a short time while the test leads are already placed on the circuit board. The TX pin has the property that the voltage fluctuates during the power-on process and stabilizes after a few seconds. This is because data is sent on the TX pin during the boot process. If there is no response, the pin is put into idle mode after a certain time, a few seconds, i.e., to 5V or 3.3V.


The last pin is almost certainly the RX pin.


Congratulations!


Communication with UART is done using special UART to USB adapters that are connected to the PC. With the right software, you can then communicate with the components on the circuit board. An example of this is the terminal emulator GTKTerm.



This adapter has the additional advantage that the correct voltage can be selected via the jumper. The wires on the right are connected to the correct pins on the circuit board.


It is important to note that VCC should never be confused with GND. If TX and RX are swapped when connecting to the reader, it is not a big deal as no damage can occur. In this case, simply swap RX and TX. However, if VCC is swapped with GND, it will cause a short circuit, and the circuit may be damaged.

 
 
 

ความคิดเห็น


bottom of page