The circuit below is used to flash firmware to a microcontroller. There is a Micro-USB port on the PCB used to connect to a host computer. The USB lines (D+, D-, etc.) then go through a bridge chip (datasheet) and form a UART connection with the microcontroller. Should I take the RXD output of the logic bridge and connect it to my microcontroller's TXD or what?

This application doesn't require flow control (correct me if I am wrong), but if it did, would I cross the RTS and CTS lines?

USB Upload

  • 2
    \$\begingroup\$ Yes. You would. The label is what the line is, not where it goes or what goes to it. \$\endgroup\$
    – DKNguyen
    Commented Apr 9, 2021 at 3:05
  • 10
    \$\begingroup\$ You definitely need to be careful with RX and TX. Dig in to the documentation and make SURE that they need to be crossed. Some devices (for example GPS or mobile modules (like GSM modules) ) name the signal with reference to the MCU. So TX on the module goes to TX on the MCU. In that case you DON'T want to cross them over. I have screwed this up before, I am embarrassed to say. \$\endgroup\$
    – user57037
    Commented Apr 9, 2021 at 3:29
  • 1
    \$\begingroup\$ I would assume both ends are “terminals” so would use a crossover cable for Tx/Rx, RTS/CTS and DTR/DSR and verify voltage is not present on the same pins before connection when enabled. \$\endgroup\$ Commented Apr 9, 2021 at 3:52

3 Answers 3


RX and TX cause all kinds of trouble because the naming is not totally consistent. In some cases, devices which are intended to be peripherals to a host will use host-centric naming. This means that the peripheral device will have an output called RX which is intended to connect to MCU RX input. And likewise it will have an input called TX which is intended to connect to the MCU TX output. Very confusing!

As a general practice, I recommend you double-check whether the TX and RX pins are inputs or outputs and make sure you connect input on one chip to output on the other and vice-versa.

In this specific case, the pin description table clearly shows that the CP2102N TXD pin is an output, and RXD is an input. So this means that they must be crossed over to connect to your MCU.

enter image description here

Historically, in the good old days when computer programs were written on punchcards, IBM categorized devices participating in UART serial links as "Data Terminal Equipment" (DTE) or "Data Circuit-terminating Equipment" (DCE). The nomenclature for the data lines was DTE-centric. So TxD was an output from the DTE and an input to the DCE. And conversely for RxD. The classic example of a DTE is a terminal on a mainframe, or a PC that is connected to a modem. The modem is the classic example of a DCE.

But when you connect your PC to a microcontroller to debug it, they are both DTE's. So crossover is required.

I believe that cellular modems still use the old-fashioned conventions. The cellular modem is a DCE, so its TXD signal is an input and its RXD signal is an output.

Probably more than you ever wanted to know about that.

  • 7
    \$\begingroup\$ We have been bitten before by exactly this problem. To our convenience and joy, some microcontrollers can swap over RX and TX in case you get it wrong. \$\endgroup\$ Commented Apr 9, 2021 at 13:36
  • 1
    \$\begingroup\$ I find it easier to remember the roles if I pretend that DCE stands for Data Communication Equipment. I'm pretty sure I'm not the only one. \$\endgroup\$ Commented Apr 10, 2021 at 17:35
  • 3
    \$\begingroup\$ My lifehack is to include the "point of view" in the name of the signals. For example if I name them MCU_TXD and MCU_RXD I have no problem connecting them right at the Bluetooth module. Or GSM_TXD and GSM_RXD when connecting them at the MCU. \$\endgroup\$
    – filo
    Commented Apr 10, 2021 at 19:25
  • \$\begingroup\$ @filo that is a good idea and I have done that also. But I still got caught off guard with a GSM modem once. Because I assumed the modem was named like a DTE. But it was not. It was named like a DCE. So I connected RX to TX and TX to RX, but that turned out to be wrong. \$\endgroup\$
    – user57037
    Commented Apr 11, 2021 at 1:06
  • 2
    \$\begingroup\$ I hadn't run into that myself yet, so I simply assumed that everything was self-centric, so that you'd always cross them. But it makes perfect sense even in that framework, without the historical context, that a manufacturer would "try to relieve the confusion" and end up creating far more. \$\endgroup\$
    – AaronD
    Commented Apr 11, 2021 at 1:35

In general, you can't safely make assumptions either way, about the labelling of communication pins that swap meanings between partner devices. A pin named "TX" on some arbitrary "downstream" device might mean "connect this to TX on the upstream device", or "this pin is used for transmitting (connect it to RX on the upstream device)."

However in this case, figure 4.1 on page 21 of the datasheet neatly answers the question, as well as your followup about the RTS and CTS lines:

enter image description here

  • \$\begingroup\$ I see, I was confused by the RS232 system label. Not sure what this is and wasn't sure if it would apply to an MCU \$\endgroup\$
    – Feynman137
    Commented Apr 9, 2021 at 3:44
  • 2
    \$\begingroup\$ RS232 is the name of the serial line protocol that we all just refer to as the "serial port". It's the protocol that the CP2102N is speaking on those TX and RX lines, to the device on the other side. So the "RS232 System" label there just means "whatever other serial device you're talking to." (Technically, the real RS232 standard also defines voltage levels, which are much higher than the 3-5V that these little UART chips all use. But we all ignore that now and say RS232 anyway.) \$\endgroup\$ Commented Apr 9, 2021 at 3:58
  • 5
    \$\begingroup\$ @GlennWillen Actually RS232 defines about everything but the protocol, it only defines the signals, voltages, connectors, i.e. only physical stuff. But everybody indeed says "RS232" to mean "serial port" or UART and completely ignores most of the spec, including voltages and connectors! \$\endgroup\$
    – jcaron
    Commented Apr 9, 2021 at 15:50
  • \$\begingroup\$ It isn't even called RS-232 anymore. Or, rather, that is what it is called in practice (including by me). But the official name changed long ago. I think it is TIA 232 or something like that. It is actually pretty remarkable how widely used it still is. It may not even be on the decline. Seems like almost every micro-controller has a serial port with no end in sight. \$\endgroup\$
    – user57037
    Commented Apr 16, 2021 at 7:11

In your case, yes.

The CP2102N TXD is an output, and RXD is an input. The MCU you don't mention, but all MCUs I've seen so far have had MCU TXD is also an output, and RXD is an input.

So since an output connects to an input, you connect RXD to TXD.

Sometimes, the naming can be different, such as a pin is named TXD as input because it kind of says to connect TXD output of the other chip here.

It is always reasiest to read which way it is from the datasheet.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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