RX pin 0 or 1?

Hey guys,

I was reading this tutorial on board design on Sparkfun: http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=109

And I saw this:

Routing TX and RX correctly? What does this mean? I can't tell you how many times I've heard newbies say 'well my PCB would have worked, but the manufacturer swapped the TX and RX pins'. No, the manufacturer did not swap them, the newbie neglected to actually read the datasheet (RTFD!). Sometimes an RX pin is an input. Sometimes an RX pin is an output. If you get it wrong, you'll look like a dunce. Read the datasheet and verify that everything is kosher. In the case of our FT232RL breakout, the TX pin is an output and RX pin is an input (pretty standard). I'm going to change the silkscreen indicators to read 'RX-I' and 'TX-O'. This should remove any doubt in my mind when I'm using the board a year from now - and so I don't have to go digging up the datasheet.

Which led me to check my Pro Mini, and sure enough, what I thought were RX1, TX0 indicating the pin numbers, were actually RXI, TXO indicating input and output.

This led me to question whether I may have wired my circut incorrectly. So I went into board data section here and I found this:

Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the TX-0 and RX-1 pins of the six pin header.

Which only served to confuse me more.

So which is it? Is RX pin 0, or pin 1?

I've been doing some searching, and all posts I've found seem to indicate that RX is pin 0.

Well that's just wrong!

They really laid the pins out like this? 9 8 7 6 5 4 3 2 Gnd Rst 0 1

And then put I on RX and O on TX which could easily be confused for 1 and 0, especially when reinforced by the order of all the other pins on that side?

Ugh. I very nearly made a costly mistake because of that.

Also, while I'm at it... why in the world did they stick A4 and A5 in the center of the board, rather than at the edge where they'd be more easily utilized? They've got two pins right there, RST and GND which they could have used, seeing as they duplicated them on the other side of the board. Was there simply no way to run the traces over there? They're so close it seems like they could have made it.

Pin 1 on the Arduino is an output, pin 0 is an input. Wether you call these TX & RX OR RX & TX depends on if you consider the Arduino to be DTE (Data Terminal Equipment) http://en.wikipedia.org/wiki/Data_terminal_equipment

OR

DCE (Data Computer Equipment) http://en.wikipedia.org/wiki/Data_circuit-terminating_equipment

Shouldn’t what I call them depend on how they’re labeled on the board? :slight_smile:

I wasn’t aware that the different Arduinos might have the pins labeled differently. My question is specifically about the function of the pins labeled RXI and TXO on the Sparkfun Pro Mini.

Anyway, assuming O and I mean output and input, then it is as I suspected: RXI is pin 0 and TXO is pin 1.

Glad I found this out now. That would have been fun to debug once I soldered everything in place. Those go to the first two rows on my display. I’d have been looking for a bug in my code.

Sometimes people get confused on this issue as follows. It is related to what Grumpy Mike said.

Suppose you have an Arduino communicating over a serial link with a card reader.

There's a wire to carry info from the card reader to the Arduino. As far as the card reader is concerned, that line is a "transmit" line.... but from the Arduino's point of view, it is the wire from which it is going to RECIEVE data....

Clear? There's more on this and similar things at....

http://www.arunet.co.uk/tkboyd/ele1spp.htm

I've been messing with serial so long, I don't even bother to think about it unless hardware handshake is involved.

DCE-DCE or DTE-DTE one unit's TXData goes to the others RXData and vice versa like RX-TX and TX-RX

DTE-DCE, one unit's RXData Out goes to the other's RXData In and vice versa like RX-RX and TX-TX

Pretty simple to sort out, if the units are both set for the same baud rate, start, stop bits and parity, then just swap the connections if at first nothing happens.

Oh, and on a final note, don't forget the common signal ground between the two pieces of equipment.

This is another follow-up on what Grumpy_Mike has said about DTE and DCE.

In a system using the RS-232 'standard' the DTE devices are labled 'properly', the way you would expect, with data flowing out of the TxD pin and into the RxD pin. On the other hand the DCE devices are labeled 'backwards' since data flows out of the RxD pin and into the TxD pin. This comes about because of the desire to be able to connect these two types of device with a 'straight' cable rather than a 'crossover' cable.

The Arduino is labeled 'properly', like DTE devices, with data flowing out of the Tx pin (pin 1) and into the Rx pin (pin 0).

If the device to which you are connecting the Arduino is similarly labeled 'properly' then in order to communicate you are going to have to connect the Tx pin of the Arduino to the Rx pin of the other device and the Rx pin of the Arduino to the Tx pin of the other device. It's as simple as that. Only if one of the devices is labeled 'backwards' will you be able to communicate by connecting the Tx pins together and the Rx pins together.

Don

I'm getting the impression you fellows think I want to transmit and recieve data on those pins, and so you're getting overcomplicated with your explanations. (Not that it's not useful information... I'd have assumed RX was always an input.)

I just wanted to know if the pin labeled RX on the Arduino Pro Mini is pin 0 because I'm using the pin in my circuit to drive one of the rows of my LED array.

(And yes, I'm aware I need to disconnect the Arduino from my circuit to program it if I do this.)

scswift:

The source of your concern comes from the following statement on the Arduino Pro Mini page which you included in your original post:

Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the TX-0 and RX-1 pins of the six pin header.

The problem is that TX-0 should be TX-O (the letter 'O' as in 'Output', not the number 'zero'). Similarly TX-1 should be TX-I (the letter 'I' as in 'Input', not the number 'one').

According to the Arduino Pro Mini schematic, pin 30 of the chip, which is the RxD pin, is connected to header pin RX-I. Similarly pin 31 of the chip, which is the TxD pin, is connected to header pin TX-O

I just wanted to know if the pin labeled RX on the Arduino Pro Mini is pin 0 because I'm using the pin in my circuit to drive one of the rows of my LED array.

I don't see a pin labeled RX on the photo of the board. I do see one labeled RXI and according to the schematic this goes to pin 30 of the chip which in Arduino terminology is digital pin 0. So the answer is YES.

Don

Well I've also spend the last two hours trying to figure out which pin is which - I'd say it is a case of bad documentation and poor design. Labelling these types of pins always produces a risk of confusion and the way it has been done for the pro mini just makes things worse - after two hours things are finally becoming clear, it should have been alot easier, particuarly as the arduino platform is aimed at non experts.

Whilst I'm on a rant ... I'm designing a PCB to take the pro mini so I needed the dimensions of the board to locate pin holes on my own design - I'm not using Eagle, I've got EasyPC and although I've tried Eagle I found it to be an awful package but in order to find out the PCB footpring I had to install eagle, convert the PCB fie to EasyPC (which it fortunatly allows me to do) and then open it in my own package. If the Pro Mini had PROPER documentation then the device footprint would be available as a schematic in PDF form - maybe it is but I can't find it anywhere.

Also the documentation doesn't identify properly which pin is which on the extra two pin header - again I had to use Eagle to check.

There is also a confusing mismatch between the markings on the board and the schematic for the FTDI cable header (JP1) - on the board the pins are marked BLK GND VCC RXI TXO and GRN - whereas the schematic labels them as GND GND VCC RXI TXO and DTR I just don't understand why they need to add this extra source of confusion.

This came on top of trying to design for a sensor with four pins that came in a symetrical package with absolutly no way of identifying the correct orientation, and a microswitch datasheet where all the package dimensions were missing - not anything to do with Arduino but whist I was on a rant I thought I'd get if off my chest ;)