I'd like to share something that works well for me and why I have ended up with the pinout I use for many of the connectors on my microcontroller boards. You are welcome to disagree but I hope you'll find something useful here anyway.
Years back, when getting a printed circuit board made was a large investment compared to the cost of lunch, I decided a flexible, general purpose board would be handy for my PIC18F-series projects. This board would be the central building block for most of my projects and I could sell them at a reasonable cost to others. I designed the board and made a 100 or 150 copies which was required to get the price down.
On this board, for 28 pin PICs, I had three 6 pin connectors: ICSP, UART and I2C/SPI. The starting point was ICSP. There's a standard pinout for that:
1 - /MCLR
2 - V+
3 - GND
4 - PGD
5 - PGC
6 - Aux
I wanted to keep power and ground the same on each 6 pin connector. If they are all wired the same, there are less of those "oh crap" moments. Pin 6 Aux is always shown for the ICSP connector but seldom used as I understand it.
So, power and ground were defined. How about the connections for the UART connector? Lacking any standardization, I looked back to my PICkit 2. What pins does the UART tool use for RxD and TxD? Making these pins align, I can program a chip with the PICkit 2, then switch the cable to the UART connector, fire up the PICkit's UART tool and interact with the board. Neat. The two remaining pins of the connector also get port pins. If you connect a serial board, changes are you'll need some additional I/O.
If I recall correctly, the I2C/SPI connector follows the pinout of Microchip's serial analyzer.
The table below shows the result of the above discussion. Power and ground are always in the same place. For the general case, each 6 pin connector has 4 general purpose port pins, with hardware features in logical places. I may have to look up which port pin is on pin 6 of a particular connector, but I know there is a port pin available.
It appears that somebody at Microchip was thinking when they came up with this power and ground arrangement. I have reversed a connector inadvertently a few times (both supplying power to the micro board or supplying power to another board) and despite the "oh crap" moment, no damage has resulted.
I use whichever pins are "extra" for non-specifically-defined pins, but I always include them. Maybe I'll just want a few remote switches and LEDs for a project but maybe I'll need a reset and interrupt pin for a connected board. A recent board design shows the flexibility of this approach. I'm working on a small 50mm × 50mm board to monitor critical voltages. I didn't see any particular need for an I2C connector, but that could make the board useful for other purposes too. As I was finishing up the design, I realized in some applications, the LEDs on the board might not be enough indication. I can program the 4 pins on the I2C connector to drive relays. Problem solved and features enhanced at no cost.
Pin 6 was still open on the ICSP connector. I thought I should connect some port pin to that. I had plenty to choose from so it seemed like a pretty random choice. No, wait a minute. If I connect the TxD, I would have the opportunity to squirt out serial data. Perhaps in some cases, my simple voltage monitor board could be used as a power monitor. Connect a INA219 board to the I2C, and stream data out the TxD pin. Maybe it will never be used that way, but the cost of adding a huge amount of flexibilty is just a little time laying out the board.
I hope the idea of standardizing connector pinouts makes some sense. I have found it very useful to keep connections the same, and thank you Microchip for helping me keep the magic smoke in!
Years back, when getting a printed circuit board made was a large investment compared to the cost of lunch, I decided a flexible, general purpose board would be handy for my PIC18F-series projects. This board would be the central building block for most of my projects and I could sell them at a reasonable cost to others. I designed the board and made a 100 or 150 copies which was required to get the price down.
On this board, for 28 pin PICs, I had three 6 pin connectors: ICSP, UART and I2C/SPI. The starting point was ICSP. There's a standard pinout for that:
1 - /MCLR
2 - V+
3 - GND
4 - PGD
5 - PGC
6 - Aux
I wanted to keep power and ground the same on each 6 pin connector. If they are all wired the same, there are less of those "oh crap" moments. Pin 6 Aux is always shown for the ICSP connector but seldom used as I understand it.
So, power and ground were defined. How about the connections for the UART connector? Lacking any standardization, I looked back to my PICkit 2. What pins does the UART tool use for RxD and TxD? Making these pins align, I can program a chip with the PICkit 2, then switch the cable to the UART connector, fire up the PICkit's UART tool and interact with the board. Neat. The two remaining pins of the connector also get port pins. If you connect a serial board, changes are you'll need some additional I/O.
If I recall correctly, the I2C/SPI connector follows the pinout of Microchip's serial analyzer.
The table below shows the result of the above discussion. Power and ground are always in the same place. For the general case, each 6 pin connector has 4 general purpose port pins, with hardware features in logical places. I may have to look up which port pin is on pin 6 of a particular connector, but I know there is a port pin available.
It appears that somebody at Microchip was thinking when they came up with this power and ground arrangement. I have reversed a connector inadvertently a few times (both supplying power to the micro board or supplying power to another board) and despite the "oh crap" moment, no damage has resulted.
I use whichever pins are "extra" for non-specifically-defined pins, but I always include them. Maybe I'll just want a few remote switches and LEDs for a project but maybe I'll need a reset and interrupt pin for a connected board. A recent board design shows the flexibility of this approach. I'm working on a small 50mm × 50mm board to monitor critical voltages. I didn't see any particular need for an I2C connector, but that could make the board useful for other purposes too. As I was finishing up the design, I realized in some applications, the LEDs on the board might not be enough indication. I can program the 4 pins on the I2C connector to drive relays. Problem solved and features enhanced at no cost.
Pin 6 was still open on the ICSP connector. I thought I should connect some port pin to that. I had plenty to choose from so it seemed like a pretty random choice. No, wait a minute. If I connect the TxD, I would have the opportunity to squirt out serial data. Perhaps in some cases, my simple voltage monitor board could be used as a power monitor. Connect a INA219 board to the I2C, and stream data out the TxD pin. Maybe it will never be used that way, but the cost of adding a huge amount of flexibilty is just a little time laying out the board.
I hope the idea of standardizing connector pinouts makes some sense. I have found it very useful to keep connections the same, and thank you Microchip for helping me keep the magic smoke in!
Last edited: