[SOLVED] Why should we use a converter?

Thread Starter

Kittu20

Joined Oct 12, 2022
470
TTL, RS232 and RS485 are the converters. UART is hardware module in microcontroller.

Can UART directly transmit and receive data without a converter? if it can't then why can't it ?
 

BobTPH

Joined Jun 5, 2013
8,942
Micros can typically put out TTL compatible levels directly, no converter needed. RS232 and RS485 both require positive and negative voltages, which micros do not do, so a converter is necessary.
 

Ian0

Joined Aug 7, 2020
9,803
TTL, RS232 and RS485 are the converters. UART is hardware module in microcontroller.

Can UART directly transmit and receive data without a converter? if it can't then why can't it ?
Three important reasons:
1. A microcontroller output can only drive about 4mA. For RS232 it might need to drive 1km of cable, and that's a lot of capacitance. 4mA into that amount of capacitance would severely limit the maximum frequency (hence maximum data rate) that you can transmit
2. RS485 is balanced line - you would need two outputs from the UART one inverting and one non-inverting, and I have never found a microcontroller that can do that; and the same arguments about capacitance apply. It's balanced line so that it can accommodate different 0V levels at each end and eliminate interference.
3. A microcontroller input can easily be damaged by interference and other voltages that can exist on long cables. RS232/485 transceivers are designed to withstand them.
If you are transmitting data from one microcontroller to another on the same board, you don't need a transceiver.
 

Thread Starter

Kittu20

Joined Oct 12, 2022
470
This means that if we have to send or receive data over long distances, then we should use RS485 converter. And at less than that distance RS232 should be used. And less than that distance TTL converter should be used.

The conclusion is that the selection of the converter depends on the transmission distance.
 

Ian0

Joined Aug 7, 2020
9,803
This means that if we have to send or receive data over long distances, then we should use RS485 converter. And at less than that distance RS232 should be used. And less than that distance TTL converter should be used.

The conclusion is that the selection of the converter depends on the transmission distance.
That's a pretty good generalisation. RS232 is going out of fashion because it needs ±12V power supplies, and because it is limited to one source and one destination. RS485 can have multiple transmitters and receivers, but you have to design the software so that only one can transmit at once.
If you want multiple transmitters and receivers but don't want the trouble of anti-collision software use CAN.
If you need multiple transmitters and receivers on the same pcb, then use I2C.
You could also use fibre-optics.
 

MrChips

Joined Oct 2, 2009
30,795
There are a number of reasons which all come down to distance.

The original requirement was to communicate with external devices that can be as much as 25 feet or 8m apart. This invites issues such as signal reflections, degradation, noise pickup, damage from high voltage EMI.

Converters are much more that voltage level shifters. They provide bandwidth limitations, line impedance matching, high voltage suppression, greater noise immunity.

If your connection is under 1 foot or 10cm it is safe to go direct UART-to-UART at low transmission rates.
 

Thread Starter

Kittu20

Joined Oct 12, 2022
470
I'm trying to understand how a one character is transferred from the microcontroller to the laptop over a USB to RS232 converter using the UART of microcontroller.

Both the microcontroller and the laptop's processor work on a 5 volt DC supply.
As mentioned above, RS232 require 12V power supply

What will be the voltage level between the microcontroller and the laptop when the microcontroller transfers a character to the laptop over usb to rs232 converter
 

nsaspook

Joined Aug 27, 2009
13,262
A common RS-232 level interface chip like the MAX232 operates on 5 volts and has the internal circuits needed to eliminate extra external power supplies.
1672155175515.png
Saves Board Space
Integrated Charge Pump Circuitry
Eliminates the Need for a Bipolar ±12V Supply
Enables Single Supply Operation from +5V Supply
Integrated Capacitors (MAX223, MAX233, MAX235, MAX245–MAX247)
Saves Power for Reduced Power Requirements
5µW Shutdown Mode
Only the physical RS-232 line circuit (RS-232 inputs/outputs) will have +- voltage, everything thing else will be at the logic level voltages (5V, 3.3V, etc ...) of the micro-controller, USB or laptop.
 

Ian0

Joined Aug 7, 2020
9,803
What will be the voltage level between the microcontroller and the laptop when the microcontroller transfers a character to the laptop over usb to rs232 converter
The microcontroller sends either 0V (for Logic 0) and 3.3V or 5V (for logic 1) (these are generally known as "TTL Levels") to the transceiver. If the input to the transceiver is 0V, the output on the RS232 line is +12V and if the input is 3.3V or 5V the output is -12V.
At the other end, the RS232 receiver reverses the process so the microprocessor in the laptop gets 0V and 3.3V, the same as the microcontroller sent to its transceiver.
 

MrChips

Joined Oct 2, 2009
30,795
As others have said, when two devices are connected via RS-232 they need RS-232 transceivers at both ends of the cabling.
Typically, the voltages used range from ±5V to ±15V. Normally, we don't worry too much about what these voltages are.

USB is a different protocol altogether, not with respect to voltage but how the data is transmitted.

UART is a single bit protocol called NRZ. You send a high voltage for a 1 and a low voltage for a 0.

USB protocol is a packaged system. Data is encapsulated in a package of many pieces of information.
In order to send a UART signal from a USB port an embedded microcontroller is required in order to decode the USB protocol and extract the single byte of data. Similarly, the reverse process has to happen when converting from a UART byte to the USB protocol.

In other words, USB ⇔ UART is a hack for compatibility with legacy devices.
 

Thread Starter

Kittu20

Joined Oct 12, 2022
470
As others have said, when two devices are connected via RS-232 they need RS-232 transceivers at both ends of the cabling.
I have downloaded this picture from internet please have a look at it. It uses only one trans receiver between two devices
1672163927763.png

Because one end of it connects to the USB port of the laptop, that's why I was thinking that it would also use the USB protocol.
 

Ian0

Joined Aug 7, 2020
9,803
I have downloaded this picture from internet please have a look at it. It uses only one trans receiver between two devices
View attachment 283999

Because one end of it connects to the USB port of the laptop, that's why I was thinking that it would also use the USB protocol.
It doesn't show the other one that is in the USB to DB9 converter.
 
Top