Why do we need a serial to USB converter ?

Thread Starter

ArakelTheDragon

Joined Nov 18, 2016
1,362
Hi!

Normally when we use an MCU that receives information from a USB(named as COM port) that means we use the RS232 pins. But the MCU is already at 5V or 3.3V, in which case why do we need to put a serial to USB converter. When I test this directly, it gives an receives the information with no problem. I just connect the USB RX and TX to the MCU RX and TX. So why do we need a serial to USB converter in between the MCU and USB, I see on various circuits that hey use it?
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
You need a conversion when going from USB port to either RS232 or RS485 etc, the standard is different, they can be had on ebay for a couple of $$ complete.
RS232 generally has a higher voltage as standard.
If using a MCU such as Picmicro, you can make use of the USART module.
Max.
 

Thread Starter

ArakelTheDragon

Joined Nov 18, 2016
1,362
I know of the RS232 +-25V. I am using a PIC micro, perhaps this is the reason why its works without a converter. The PIC16F690 has no problem decoding the information from the USB, I send the information through a serial terminal or through my own built serial terminal.
 

nsaspook

Joined Aug 27, 2009
13,081
If you mean a USB serial converter like this


The USB side of the converter is for the PC usually. The actual serial interface voltage needs to be matched but the root problem is two-way conversion from a uart serial asynchronous protocol to the USB packet protocol that the PC computer USB port understands. A USB serial converter 'driver' is loaded on the PC side that creates a software COM port for user applications that emulates a 'real' hardware COM port your PC serial port applications use to talk to (via the device driver) the hardware chip USB packet protocol side on the USB serial converter chip. The uart serial asynchronous protocol side on the USB serial converter chip actually talks to the MCU uart.

In software I can choose the serial port I need to open on the host PC side by looking a the type of machine it runs on. The drivers for both types have the same applications level interface so the rest of the applications software after the port is opened doesn't change.
C:
#ifdef __x86_64__ // for PC with REAL hardware serial port
    serial_port = open("/dev/ttyS0", O_RDWR);
#else // for RPi with USB converter serial port
    serial_port = open("/dev/ttyUSB0", O_RDWR);
#endif
https://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_116_USB Data Structure.pdf
 
Last edited:

Thread Starter

ArakelTheDragon

Joined Nov 18, 2016
1,362
Sorry for not being more clear.

I don't mean a MAXI232 to MCU converter. I mean a 5V signal from a 5V MCU to the 5V PC USB. Or a 3.3V MCU to a 5V USB

I know the USB pins are a twisted pair in order to reduce noise. But I am not certain how does the transmission actually happen. Are the Data+ and Data- equivalent to the MCU TX and RX or is it that both lines have to be used for a transmission only in 1 direction at the same time, unlike the MCU TX/ RX.
 

MrChips

Joined Oct 2, 2009
30,710
Because USB is not a serial COM port.

It is like trying to convert from composite video to HDMI. They don’t talk to each other. You need a translator.

Or like trying to drive a train on a multi lane expressway.
 

sagor

Joined Mar 10, 2019
903
If both signals (both devices) are at a 5V level (or 3,.3V that tolerates 5V), you do not need any "rs232" adapter. Exception would be if one of the signals is inverted, but then a simple signal inverter would handle it.
RS232 is defined as +/-12V swings (approx). It does not define serial data at other levels like 5V. I use a GPS module that is 5V and feed that to an Arduino serial port which expects 5V as well. It all works. There is no "RS232" in that circuit. Do not mix up definitions of standards with actual "serial data", the two are different. You can have serial data at 5V, 3.3V, 50V, RS232, or any other level of signals. RS232 just defines one of those voltage standards.
Serial data (UART) and RS232 are two different things, though you can use one to drive the other if you wish.
 

nsaspook

Joined Aug 27, 2009
13,081
If both signals (both devices) are at a 5V level (or 3,.3V that tolerates 5V), you do not need any "rs232" adapter. Exception would be if one of the signals is inverted, but then a simple signal inverter would handle it.
RS232 is defined as +/-12V swings (approx). It does not define serial data at other levels like 5V. I use a GPS module that is 5V and feed that to an Arduino serial port which expects 5V as well. It all works. There is no "RS232" in that circuit. Do not mix up definitions of standards with actual "serial data", the two are different. You can have serial data at 5V, 3.3V, 50V, RS232, or any other level of signals. RS232 just defines one of those voltage standards.
Serial data (UART) and RS232 are two different things, though you can use one to drive the other if you wish.
While important that's not really what the OP was asking about.
 

MrChips

Joined Oct 2, 2009
30,710
Here is my very crude analogy.

We once took the Auto Train (AT) from Lorton, Virginia to Sanford, Florida and back.
The AT is a transport system. In a similar manner, USB is a transport system and a very complex one.
Our minivan was loaded on to the AT after following some strict protocol. We and the vehicle were the payload.
Similarly, USB is a complicated protocol whose function is to deliver a payload.

The AT rides on two rails which has nothing to do with the highway that we will eventually be set upon at the end of the journey. Similarly, USB rides on two rails, +D and -D, which have nothing to do with the TXD and RXD lines at the other end.

AT "wraps" and delivers the payload in a container. USB does the same thing. It wraps and delivers the payload in a container.
At the end of the journey, the payload is unwrapped and delivered. This is where your USB-to-serial converter comes into play. It unwraps the payload and delivers it to the RXD line. In the reverse direction, TXD is packaged and sent off on the bus or "train".

To push the analogy a bit farther, the payload on the AT is a whole bunch of "cars" while the payload on USB is a whole bunch of "chars". Meanwhile the payload of the COM port is one "char" at a time.

Shown below is the USB-to-serial converter module that I use frequently. It is based on Silicon Laboratories CP2102 converter chip.
1589674227946.png
When you plug this into a USB port of a PC it shows up as a COM port in the Device Manager. This is because the USB converter driver pretends to be a COM port to the PC. All the fancy footwork is done for you and is transparent to you and the software using it.

Just do not forget, USB is not a COM port.
 
Top