What is a UART?
When you first start getting involved with flight controllers, one of the first things you notice popping up all over the place is UART. I certainly noticed it. No matter what video I watched, it always left me with the same questions. What is a UART? The videos were great in explaining how to wire stuff up, but never explained on their channels what they actually mean.
So, what is a UART?
A UART is a serial data port that allows devices to communicate with each other. It actually stands for Universal Asynchronous Receiver Transmitter. From this we can understand that it is universal, so anything can use it. It has receiver and transmitter pins to do the communication. And it is asynchronous, which means it can transmit and receive data at the same time.
How do you connect up a UART?
UARTs are very simple interfaces. They have two pads which deal with the power for the device. Plus, two pads for the data communications. On the flight controller, you will have multiple UARTs to connect multiple devices. Each set of UART pads will have GND, 5v, TX, and RX. The TX and RX may be shortened to just T and R. Following the TX and RX will be a number. This is the UART number that you will need to set up the device in your flight controller configuration software.
The power side is pretty straight forward. There will be a ground pad, usually labelled GND. This will connect to a ground pad on your flight controller. Next up is the power pad. Sometimes this is labelled with the actual voltage, such as 5v. Again, this connects to the corresponding power pad on the flight controller.
Next we have to connect up the data side of the UART. As we’ve mentioned before, there is a Transmitter (TX) and Receiver (RX) on each UART. The transmitter sends out the data and the receiver listens for it. So to correctly wire up the UART, the TX on the device must connect to the RX on the flight controller. Then the TX on the flight controller connects to the RX on the device. This way they can talk and listen to each other.
So that’s it, the UART is set up and ready to go. But, there is one thing that can throw a spanner in the works!
So far, I have only come across one company that inverts UARTs in the hobby, and that is FrSky. There’s no real reason for it, and it is a pain.
UART inversion means that the data has been inverted. If you think of the data as zeros and ones, a normal signal could look like 01000101 11010110. When that signal is inverted, it would look like 10111010 00101001. As you can imagine, these devices will not be able to understand each other. So the inverted signal needs to be run through an inverter again to become uninverted.
F3 and F7 based flight controllers have inverters built in to the processors. So any UART on an F3 or F7 flight controller can by switched to communicate normally or inverted.
On F4 based flight controllers, it’s not so straight forward. Most F4 flight controllers will have a specific pad, usually labelled SBUS. This UART RX has a hardware inverter added between the pad and the processor. This is fine for getting the data from the receiver. But, this usually leaves sending telemetry data back to the receiver high and dry.
On the left is a Matek F405-WING flight controller. I have highlighted UART 2 in yellow. This is the UART that Matek recommend you use, to connect your receiver. It has an extra pad for that reason.
- The Tx2 pad is a regular, uninverted UART Tx.
- The Rx2 pad is a regular, uninverted UART Rx.
- The Sbs pad connects to the Rx2 pad through a hardware inverter.
- The 4.5 and G pads are the power. You could use the 5v pad under Tx2 instead of the 4.5 pad to provide power to the receiver.
The F405-WING with iNav has another trick up it’s sleeve. If you connect an SBUS receiver to UART 2 (Sbs pad), it sets Tx2 up as an inverted soft-serial port. This allows you to just connect your S.Port data wire to Tx2 and telemetry will work. You can use soft-serial on other flight controllers to get S.Port telemetry working. But its usually not as simple as with the Matek board. For example the Omnibus F4 involves resistors and soldering to tiny pads.
You can build hardware inverters yourself, but I think that’s a topic worth looking in to all on its own.
I hope this was helpful
Thank you for reading this article. I hope you found it useful. There are more articles on this site that may answer more questions. I also have a YouTube channel at www.youtube.com/c/MrDFallingwithstyle with content like this. A like and subscribe on there would be greatly appreciated.
This article has helped 213 people. For more useful things, please check out my YouTube Channel.