-4
\$\begingroup\$

Can anybody explain how FT232R or CP2102 or some Serial to USB converter and it magically appears as COM port on PC?

I would appreciate a detailed explanation on how the conversion happens. Some basics on USB protocol also. I have thoroughly read the datasheet. Couldn't comprehend it.

\$\endgroup\$
  • 1
    \$\begingroup\$ The question is too broad. Please indicate more clearly, what you coulnd't comprehend? \$\endgroup\$ – Martin Zabel Dec 12 '15 at 14:03
  • \$\begingroup\$ why downvote? I got my answer. \$\endgroup\$ – ammar.cma Dec 12 '15 at 17:23
1
\$\begingroup\$

There is no magic and if there was it is on the PC side not in the actual chip.

When a USB device is connected to a host it enumerates, it communicates to the PC ID numbers and requests power and endpoints. Endpoints are how USB communicates, data is moved from device endpoint to host endpoint and back. All the USB protocol guarantees is this endpoint to endpoint flow of data.

When the host receives the ID numbers it loads drivers for the device. If anything else it's these drivers that have the magic. It is up to them to interpret the data coming into the endpoints and place data to go out of the endpoints.

The actual implementation is proprietary but there are some opens source USB to serial device code you can read.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

The actual implementation is a secret of the vendor of the converter.

It works like this. Upon receiving, the serial stream of bits is sampled by the UART of the converter to a stream of bytes. The bytes are then send to the PC via USB packets. The OS driver then makes the bytes available to the receiving process via the COM API (Windows) or device files (Linux, ...).

The other way round, the process writes bytes to the COM API or device file. These bytes are then send to the converter via USB packets. After that, the UART converts the stream of bytes to a serial bit stream which is then outputted.

Basics of the USB protocol can be found in the USB Standard documents or in a tutorial on the internet.

| improve this answer | |
\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.