Hostess is a FeatherWing that provides a USB host co-processor. The FeatherWing handles all USB Host related tasks, including enumeration and running the device drivers, and communicates with the primary processor over SPI. This means the primary processor can communicate with USB devices with minimal software and CPU time.
For example, a CircuitPython-based board could communicate with a USB MIDI device with minimal code:
_spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
spi = SPIDevice(_spi, digitalio.DigitalInOut(board.D9), phase=1, polarity=0, baudrate=8000000)
hostess_midi_in = HostessMidiPortIn(spi)
while True:
midi_event = hostess_midi_in.read()
if midi_event is not None:
print(midi_event)
Presently, Hostess has basic support for the following USB devices:
- MIDI
- Keyboard
And in-progress support for the following devices:
- PS4 controller
And I hope to add support for these devices eventually:
- USB Serial (CDC)
- Generic HID Gamepad
- Mouse
Hostess's hardware is based around the Atmel SAMD21, a low-cost 32-bit ARM microcontroller with USB host capabilities. It incorporates a USB current-limiting switch to prevent devices from drawing too much current and provides the proper amount of capacitance for powering USB devices. This makes it a bit more robust compared to using an OTG adapter with existing development boards.
Hostess's hardware is the most complete part of the project. PCBs can be manufactured at OSHPark or other fabs and all of the components on the BOM are readily available at Mouser and DigiKey.
To upload the firmware and debug the device, you'll need a SOICBite and a J-Link or similar.
Hostess's firmware is written in C using Atmel START. Presently building it requires Atmel Studio 7, though I'd like to switch to a Makefile.
Communicating with Hostess is the most incomplete part of the project. Presently, there is just an example file on how to communicate with it from CircuitPython. I'd like to make this a complete library as well as create an Arduino library.
The code here is available under the MIT License, the hardware designs are available under CC BY-SA 4.0. I welcome contributors, please read the Code of Conduct first. :)