USB Host On RP2040 – With PIO

Showing a board with a Pi Pico plugged into it, a USB-A socket marked "USB host", and a character display that says "PASSED" referring to the board being the brains of a testing jig.

Folks from [Adafruit] are showing off a neat hack – USB host on RP2040, using the now-famous PIO peripheral. [Adafruit] builds a lot of RP2040 boards, and naturally, you gotta test them before you ship them to customers. They’ve been using very specific Teensies for that, and at some point, those became unobtainium. Based on the work of [sekigon-gonnoc] and with help of [Thach], they’ve made their TinyUSB library support bitbanging of USB over PIO, and successfully ported their test jig firmware to it!

The base Pico-PIO-USB repo by [sekigon-gonnoc] shows a pretty impressive state of affairs – with low-speed and full-speed USB host and full-speed USB device modes supported, and quite a few examples to get you started. [Adafruit]’s work integrates this code into their TinyUSB stack, specifically focusing on MST (mass storage) features – as this is what you need to program a RP2040. Of course, they also provide a mass storage example to boot!

Test jigs are pretty important to have when making multiple pieces of a board, and with RP2040 supporting more and more interfaces thanks to PIO, it sounds like the perfect chip for your next production testing-intended PCB. With the jig brains taken care of, you’ll want to look into building no less important mechanical part, and we’ve covered quite a few ways to sort that out – here’s an OpenSCAD script that generates lasercutting files out of KiCad boards, or a jig built out of scrap copperclad FR4, and a pretty extensive tutorial on making your own lasercuttable jigs, to boot.

8 thoughts on “USB Host On RP2040 – With PIO

      1. Honestly, anything MCU with basic USB HID capabilities do that (e.g. ATTiny85 can bitbang to be a USB keyboard). The real points of interest is that this doesn’t consume the (primary) CPU bitbanging USB, doesn’t use proprietary silicon, and still is low cost.

        1. Apparently the attiny85 trick doesn’t work as well anymore on modern computers. (At least, it fails enough that Adafruit is discontinuing all their products that used it and have a big warning on the product pages for remaining stock, iirc).

          I mean, I built the USB i2c thingie a few years ago and I think it mostly works fine, but I’m never the first to upgrade computers.

      1. That’s not quite correct. The original version used one pico, but when some users complained about their peripherals not being supported, it was decided to create a twin mcu design to take advantage of the hardware usb libraries on both the client and host side.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.