The recent ubiquity of Raspberry Pi Pico boards, combined with supply chain shortages for the bigger Raspberry Pi family boards, and more time at home over the last couple of years, has helped a certain type of ingenuity flourish in pushing those RP2040 microcontrollers to their limits.

One thing this chip has proved particularly good at is bit-banging. Using its PIO blocks, versatile hardware interfaces that set the RP2040 apart from many other microcontrollers, users have achieved input and output for a variety of I/O protocols. By simply issuing low-level instructions to the PIO peripheral, folks have achieved everything from Ethernet to DVI-over-HDMI.

Now, the geniuses at Adafruit have demonstrated a useful hack that allows USB host functionality on the RP2040 using the PIO peripheral. They use RP2040 boards in their products and need to test them before sending them to customers. Their previous workflow was to use Teensy 3.6 boards for programming, but, due to supply chain woes, those are scarce now.
 
RP2040 programming jig
RP2040 programming jig. The Teensy board on the left is made redundant by
the RP2040 host. Source: Adafruit on YouTube
Thanks to the efforts of Adafruit’s Thach Ha with the help of GitHub user sekigon-gonnoc’s work, Adafruit was able to use the PIO peripheral and its TinyUSB library to support USB over PIO and port their test jig firmware to it, and yes, it’s another bit-banging solution. This enables them to use a Raspberry Pi Pico to present itself as a USB host, read a microSD card, and program a second RP2040 using mass-storage mode.

The Pico-PIO-USB repository by sekigon-gonnoc already supported low-speed and full-speed USB host and full-speed USB device modes, and Adafruit’s work builds on this by focusing on the mass storage features, which are typically used for programming RP2040 microcontrollers; they’ve also shared a mass storage example.

Test jigs such as this are useful for PCB mass production, and the RP2040’s support for various interfaces through PIO makes it a good choice for production testing.

The spring-loaded pogo pins, much loved by Adafruit, make up the hardware connection — also a huge time saver. Have a look at Ladyada’s demo here: