Quite a few of my boards have a 4-pin UART output. And it's always the same:
[TXD GND RXD VCC]. But this pinout seems strange to quite a few people. I promise, there's a method to the madness.
First of all, what is the most common UART pinout and why don't use it? Well, the most common output I've seen on other people boards is
[VCC RXD TXD GND] and I hate it because it's really unforgiving if you accidentally plug it the wrong way. When I started playing with electronics, I used to use this pinout and, after frying a couple of boards, I've learned to triple-check that I don't plug it rotated 180°. Even so, it still makes me nervous.
The other common pinout I've seen around is
[VCC GND RXD TXD] and this one is slightly better as you can safely rotate it 180°. When it comes to common accidents (180° or off-by-one), it's really hard to fry the board using this one. But this pinout also has its twin brother
[VCC GND TXD RXD] thus ensuring you need 1x1 Dupont connector for each wire.
For my "standard" pinout I wanted to be able to easily switch TXD and RXD lines. Since UART really needs only three pins, it was clear that the first three pins had to be
[TXD GND RXD]. This way rotating 180° allows you to connect two cables together allowing for point-to-point connection.
In order to provide power, I just added the extra pin for the final
[TXD GND RXD VCC] pinout. If you accidently rotate it 180°, nothing happens. If you plug it off-by-one, nothing happens. And, if you don't need power, you can plug only the first 3 pins and everything still works.
It's as full-proof as it gets for me.
2 thoughts to “Overthinking UART Pinout”
What’s your opinion on [RST TXD GND RXD VCC]? Same as yours but adding a reset pin.
If you plug this in backwards, GND is correct but TXD/RXD are reversed, RST is usually active low so at worst it’ll power the chip, at best do nothing again.
I like it. Any pinout that doesn’t fry stuff when reversed gets my approval. :)
That said, I usually avoid reset pin altogether. I tend to just use extra pins as signals and deal with resets in software.
But pinout is well thought and allows for not only reversal but also for “missed-by-one” plugins without killing stuff.