Skip to content

Instantly share code, notes, and snippets.

@dglaude
Created September 24, 2022 21:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dglaude/e779f4cf3635bd78b08bdeecb8807453 to your computer and use it in GitHub Desktop.
Save dglaude/e779f4cf3635bd78b08bdeecb8807453 to your computer and use it in GitHub Desktop.
USB Host in CircuitPython

STATUS

CircuitPython does not support USB Host yet, but the basis API and partial implementation.

adafruit/circuitpython#6527

The idea is for CircuitPython to rely on TinyUSB, the same way it does for USB Client activities.

Some hardware that run CircuitPython are designed with USB Host in mind such as:

For better understanding of the status of USB Host in CP, please check those two tickets:

But at least they can be used with Arduino until proper support is available.

The most promising hardware that is largely available and low cost is to do it on RP 2040 board such as the Pico from Raspberry Pi:

The discussion on this possibility take place in this issue:

There was an impressive demo using PIO on the RP2040 to support USB Host with minimum additional hardware:

The goal is to integrate that in TinyUSB and be able to use that from CP.

INTEREST

The persone or team most interested with USB Host is Bill Binko founder of ATmakers.

In Assistive Technology, it is frequently needed to create custom device that help communicate with computer, emulating a keyboard or a mouse. But sometimes devices do exist, but talk a legacy USB protocol or need modification. The most flexible way to interface and reuse those device is by creating USB Filter. That is a device with a USB Host interface and a USB Device interface where USB HID can be used. This explain the particular interest in that kind of feature in CircuitPython.

ALTERNATIVE

Some very old assistive device might have a PS2 interface to generate mouse/keyboard input to old computer. It is supported by CircuitPython https://gist.github.com/dglaude/67585e5be7f59e0f080afbe1f8a25ba9

But that solution is not helping to read from USB Device...

Waiting for native USB support, a coprocessor can be used. The Trinket M0 with special software and a USB OTG adaptor is a very low cost and powerfull such coprocessor:

Github user gdsports made a lot of ready to use firmware and demo of the possibilities:

@MrMino
Copy link

MrMino commented Oct 29, 2023

usb_host has been available since a bit of time already

Right. I was actually looking at support for RP2040 boards and forgot this gist is more general than just those. 8.x doesn't have the support for RP2040 usb_host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment