RP2040 microcontroller PCB design made easy.
The best microcontrollers these days are those that you can actually buy. The Raspberry Pi RP2040 features a dual ARM Cortex-M0+ core, supports up to 16MB of off-chip flash memory, and includes a notably unique capability in its flexible Programmable I/O (PIO) state-machine hardware. Having been designed largely to target the hobbyist market, the RP2040 is very available… albeit in a QFN-56 surface mount package that most hobbyists will struggle to solder by hand.
I designed the RP2040 In-System Programming (ISP) Stamp to make it easy to drop the RP2040 chip into any future project. At 1” square and with castellated vias all along the perimeter, the stamp takes up significantly less space than the typical Raspberry Pi Pico development board.
When using the stamp, the designer need only concern themselves with the IO connections:
- Power the stamp with 3.3V or 5V (even simultaneously, if necessary).
- Includes the crystal oscillator, the full 16MB flash memory, and separate boot/reset buttons.
- Features a power indicator LED and a NeoPixel (serial-controlled multi-color LED).
- Supports serial-wire debug (SWD) programming over a Tag-Connect interface.
The design files are hosted on GitHub. Panels were fabricated and assembled for cheap in China (approximately $8 per stamp).
A quick demonstration
In my opinion, the genius of the RP2040 ISP Stamp is that the carrier board can hold the sockets required to hold the leg-less Tag-Connect in place. Don’t waste your money on that silly retaining clip! I also designed a simple breadboard-compatible carrier board to test out SWD programming over Tag-Connect.
To program the RP2040 over SWD, the typical method is to use… another RP2040. By flashing one RP2040 with the picoprobe firmware it effectively becomes the programmer. The programmer uses its GPIO to drive the target’s SWD pins (as well as receive serial communication from the target over UART).
The video above shows the programmer on the right, connected to a computer over USB. The Tag-Connect plugs into a 6-pin IDC header and carries power/ground, SWD, and UART over to the target on the left. The target is running a NeoPixel example sequence provided by Adafruit.
Design notes
There were a couple interesting design decisions I made while creating the stamp. The complete schematic is available here. Shown below is a snippet of the power section and the NeoPixel.
The internet is full of people who power the NeoPixel at 3.3V (with mixed success) despite the datasheet clearly stating its power input must be between 4.5V and 5.5V. The RP2040 itself is powered at 3.3V which impacted the design in two ways:
- To support both 3.3V and 5V input voltages to the stamp while also supporting the 5V NeoPixel, the 3.3V input power has to be stepped up to 5V and then down-regulated by an LDO back to 3.3V again. The HX4002 (U2) was a great find for this exact purpose!
- Level-shifting is required to drive the 5V NeoPixel with the RP2040 3.3V GPIO. A typical method would be to drive a N-channel transistor (open-drain) with a pull-up resistor to 5V. The design here is simplified even further by instead using a pull-up resistor and a diode (R5, D4).
A worst case analysis was performed to verify that the voltage tolerances, diode-drops, and logic-level thresholds were all mutually compatible. This analysis was completed using the worstcase Python software package that I’ve written about previously.