Is there a reason why the Arduino TX/RX pins marked so strangely?

Why does the pin labeled "RX" mean "connect your device's RX pin here"?

Not "this is the pin that receives (RX) data from your device"? :o

This is illogical and not intuitive.

nano-pinout.jpg

Uh, 0 / RX is not where you should connect RX, it's where you connect TX.

Notice how they have the pins flipped there, ie, it's pin 1/TX, then 0/RX.

DrAzzy:
Uh, 0 / RX is not where you should connect RX, it's where you connect TX.

That's what I was thinking too, as it's just logical.

But as a matter of fact, when sending data from the PC through the USB-to-Serial chip, it is the RX (D0) pin where the data being sent by the PC is coming out.

I've had to bring out an oscope to find the problem. Swapped the pins and everything started working. ::slight_smile:

Here is the reason they are weird:

RX can be used as a regular everyday data pin if you are not using Serial at all in your sketch. It is digital pin 0.

TX can be used as a regular everyday data pin if you are not using Serial at all in your sketch. It is digital pin 0.

So that is why on the Nano they are marked with RX0 and TX1.
When you connect a serial device to the Nano, connect the device's TX pin to the Nano RX pin, and connect the device's RX pin to the Nano TX pin. Also connect a common ground. Be careful when connecting the Nano's TX pin to RX of a device if that device has 3.3V logic levels. You may need to use a logic level converter or voltage divider resistors.

Regarding signals from your computer, the FTDI or CH340G chip on your Nano converts the computer's USB to serial. If you have a look at the Nano schematic, you will see the TX pin of the USB serial converter chip is connected to the RX pin of the ATmega328. And the RX pin of the USB serial converter chip is connected to the TX pin of the ATmega328.

You haven't seen real weird yet. Are you ready? Have a look at the Pro Micro and Pro Mini. The RX pin is marked RXI (that is the letter I). It means input, so you can remember it is input (as if receive was not good enough of an indicator of data direction). This pin also serves as digital pin 0 if you're not using Serial. Digital pin 0 is not limited to just input, you can actually use it for input or output just like any other digital pin. The TX pin is marked TXO (as in the letter O). It means output as if transmit is not adequate to remember that. The TX pin serves as digital pin 1, just like on the Nano. Just like pin 0, you can use pin 1 as input or output.

RXI = digital pin 0 if you are not using Serial in your sketches (or not using Serial1 on the Pro Micro)
TXO = digital pin 1 if you are not using Serial in your sketches (or not using Serial1 on the Pro Micro)

With the small print and font used on the board surface, it is pretty hard to see the difference between I and 1. A slashed 0 helps. But, some manufacturers use RX1 (number 1) and TX0 (number 0) on these pins.

It's a matter of perspective. You're viewing it from the perspective of your PC. Look it at the other way. RX is the receiving pin for the Nano. It's the receive pin for the Atmega328. Atmel calls that pin "RXD".

jboyton:
It's a matter of perspective.

Good thing there are only 2 perspectives here, so it's easy to figure out the idiosyncrasy. :grinning:

So the TX pin on the Arduino receives data from the ATmega328, and is connected to RX on the USB-to-Serial chip.

And the RX pin on the Arduino sends data to the ATmega328, and is connected to TX on the USB-to-Serial chip.

Yes, jboyton said it very well, that it is a matter of perspective. The pins are labeled from the perspective of the ATmega328. The way I see it is:

The TX pin on the ATmega328, which is available on the header, transmits data to RX on the USB-to-Serial chip. It can also transmit to any other device connected to the TX header pin, such as transmitting to the RX pin of a Bluetooth module.

The RX pin on the ATmega328, which is available on the header, receives data from TX on the USB-to-Serial chip. It can also receive from any other device connected to the RX header pin, such as receiving from the TX pin of a Bluetooth module.

MikeX:
So the TX pin on the Arduino receives data from the ATmega328, and is connected to RX on the USB-to-Serial chip.

That's not the way I'd say it. But yes, I suppose so. In one sense each link in the chain is both receiver and transmitter.

For example, if you send me an email we would say you were the sender and I was the receiver. But what about your keyboard? Or my screen? They both receive and send the message. So it is with the Arduino pin.

To be fair, the TX/RX pins confuse me all the time. I like the fact that one of my boards actually has little arrows next to the RX and TX labels.

The silk-screen arrows on the UNO board add to the confusion. The TX-> is pointing towards the female header/receptacle suggesting that data flows into it. Vice-versa for RX<- which has its arrow pointing away from the header, suggesting that data flows out of this pin. I'm sure this wasn't the designers intention.

The pro mini is much better with pin D0 marked as RXI and D1 as TXO. I = input, O = output.

On the UNO these pins are connected to another MCU (ATMEGA16U2) via 1K resistors. The resistors allow you to use these pins for other purposes without doing damage to the ATMEGA16U2.

To clarify:

D1 is TXO for the UNO's ATMEGA328P. Serial.begin(); will configure this pin as an output. HIGH when idle, pulsing LOW during transmit. On the Uno, D1 is also attached to the ATMEGA16U2's RXI pin (via a 1K resistor), which appears to have a weak internal pull-up active. This shouldn't prevent you from using D1 effectively as an input or output.

D0 is RXI and remains an input after Serial.begin();. On the UNO, D0 is attached to the TXO of the ATMEGA16U2 (via a 1K resistor) which is itself an OUTPUT HIGH. This may limit what you can do with D0 as it effectively has a strong pull-up resistor attached to it. You can probably still use D0 as an input as long as what ever you are monitoring can sink 5mA. Using D0 as an output, take into consideration that it will be pulled-up when the arduino is being programmed or in reset.

Cheers.

Why? Because D0 is connected to the ATmega (Core arduino chip) pin labeled RXD by Atmel, and D1 is connected to the pin labeled TXD.