Microcontroller Pin Selection Best Practices
Table of Contents
Motivation
Although many pin selection configurations can be made to work in firmware, good pin selection can save a lot of time and hassle for the firmware developer for your board. However, good pin selection can also be non-obvious to a member who has not worked with the firmware. The goal of this document is to reduce this gap by outlining some best practices for microcontroller pin selection when creating a PCB that utilizes a microcontroller. This document is co-maintained by the EFS and Electrical subteams.
Best Practices
Communicate with EFS team when uncertain
It’s a great idea to get the pinout that you’ve chosen reviewed by an EFS member or lead before finalizing your design. As this person will be working on the firmware for your board, they will be motivated to ensure you’ve chosen good pins and will appreciate you reaching out for feedback. If you’re not sure who to contact on the EFS team, feel free to ping EFS Leads on Discord and someone will be able to help.
Maintain same pinouts between revisions
Or at least as similar as possible. Aim to keep any existing pins in the same spot when adding new hardware as well. This may not always be possible due to significant changes in hardware but when possible, this can reduce or entirely eliminate any overhead on getting the firmware to work on the new hardware revision. It also makes it a lot easier to maintain the code as often we want to be able to flash multiple revisions with our firmware and thus have to maintain all revisions.
Maintain globally consistent ordering of connector pinouts
In particular SWD headers (follow STM32 Programming Connector Standard ). When the pinout of a connector changes it forces all existing tools and wires designed to work with that connector to be adapted. This is an issue because it causes an ecosystem split where some tools and wires must exist to work with the old version of the connector while others must work with the new version.