Why additional interface is required for UART

Thread Starter

MTech1

Joined Feb 15, 2023
161
My understanding is that when two devices have the same peripheral, such as SPI or I2C, they can communicate using those protocols. However, I'm a bit confused about UART. Why additional interface is required for UART like TTL

As far as I know, if two devices have UART peripherals, they should be able to communicate directly. But I'm puzzled because when trying to send data from a microcontroller to a laptop using UART, an interface like USB to TTL or USB to RS232 seems necessary. both the laptop and microcontroller work with five volts.

Could you help me understand why this additional interface is required for UART communication in this scenario?
 

dendad

Joined Feb 20, 2016
4,426
Most laptops do not have UARTs now, just USB. So, an additional device is needed to interface the laptop's USB to a UART with either TTL, RS232, RS485, radio....... or some other interface.
Just because both may work on 5V does not mean they can communicate directly. RS232 is not 5V by the way. Also, both ends need to use the same protocol, not just the voltage. Think of it as people all talk with sounds but they need to have the same language to communicate.
To talk between devices, both ends need to be the same, at least in the link part between them. TTL is probably the easiest but it is often better to use an interface of some sort, like RS232 or RS485 drivers to help isolate each end from faults. Also, plain TTL cannot be used over long distances as RS232 can, or even further with RS485.

This may help...
https://www.codrey.com/embedded-systems/serial-communication-basics/
 
Last edited:

Ian0

Joined Aug 7, 2020
9,502
My understanding is that when two devices have the same peripheral, such as SPI or I2C, they can communicate using those protocols. However, I'm a bit confused about UART. Why additional interface is required for UART like TTL

As far as I know, if two devices have UART peripherals, they should be able to communicate directly. But I'm puzzled because when trying to send data from a microcontroller to a laptop using UART, an interface like USB to TTL or USB to RS232 seems necessary. both the laptop and microcontroller work with five volts.

Could you help me understand why this additional interface is required for UART communication in this scenario?
Because the output from a microprocessor is limited to a small amount of current (4mA usually).
SPI and I2C are only capable of sending data a short distance - limited to devices on the same circuit board.
1) To send data down a long cable with its capacitance, more current is required to charge and discharge the cable capacitance.
2) Microprocessor outputs are not well protected from transient voltages which can be picked up on a long cable
3) At higher speeds balanced drivers are required to prevent interference.
 

MrChips

Joined Oct 2, 2009
30,488
You have to look at the legacy of serial communications.

TTL circuits work with 0-5V levels. These may be fine for communications over short distances, 30cm or 12 inches, and low data rates. As the distance increases, the signal becomes susceptible to noise, interference, and transmission line issues.

4-20mA current loop became an industry standard but was suitable for low data rates only.
RS-232 brought a robust electrical standard that was suitable for long distances (33ft or 10m) and high data rates.
This was followed by RS-422 and RS-485 (good for 4000ft or 1500m).

To conclude, two devices can communicate directly using TTL chips with UART, SPI, I2C protocol over short distances.
If you want to communicate over a distance greater than 12 inches, you need to use the appropriate line driver and receiver.

USB is a totally different can of worms.
 

Ian0

Joined Aug 7, 2020
9,502
I'm not sure why it would be an advantage to have the line driver on the processor. The driver is the part that the customer can blow up, and blowing up the microprocessor is not a great outcome.
I do note that many manufacturers can integrate USB drivers. I wonder if that is just due to demand, because USB hardware can't be that much different from RS485. I suspect that because nothing else goes in a USB socket, blowing it up is less common. (Though a USB plug does fit in a RJ45 socket where it shorts out all 8 pins - thanks to my mother for demonstrating that).
Alternatively, because USB is only a short distance and RS485 can go for miles, is it because RS485 drivers have to withstand higher input voltages (+12V/-5V) that it makes it more difficult to integrate?
 

dendad

Joined Feb 20, 2016
4,426
I'm not sure why it would be an advantage to have the line driver on the processor.
I agree that having the drivers integrated on chip is a bad idea! In fact, I now usually socket the RS485 drivers so they are easy to replace when they can get zapped. And they will!!!
As an option, DIP parts and SMT can be on the PCB as they both fit quite well.
 

Ian0

Joined Aug 7, 2020
9,502
I agree that having the drivers integrated on chip is a bad idea! In fact, I now usually socket the RS485 drivers so they are easy to replace when they can get zapped. And they will!!!
So do CAN drivers, and they claim to withstand ±70V. It generally happens if the circuit gets its positive supply but not the negative, the CAN signal provides the negative supply.
 

Thread Starter

MTech1

Joined Feb 15, 2023
161
What I understand that the two UART peripherals might not communicate directly; they need an interface like TTL, RS232, RS485, and others. The choice of interface depends on how far apart the two devices are located.
 

Ian0

Joined Aug 7, 2020
9,502
What I understand that the two UART peripherals might not communicate directly; they need an interface like TTL, RS232, RS485, and others. The choice of interface depends on how far apart the two devices are located.
And on how fast you want to send the data.
 

dendad

Joined Feb 20, 2016
4,426
You could connect 2 UARTs together as they run "TTL" but if the signals go off board, I would recommend adding a suitable interface as UART protection if nothing else.
 
Top