USB host/device implementation using PIO of raspberry pi pico (RP2040).
You can add additional USB port to RP2040.
demo.mp4
Planned Features | Status |
---|---|
FS Host | ✔ |
LS Host | ✔ |
Hub support | ✔ |
Multi port | ✔ |
FS Device | ✔ |
- capture_hid_report.c is a USB host sample program which print HID reports received from device. Open serial port and connect devices to pico. Default D+/D- is gp0/gp1. Call
pio_usb_add_port()
to use additional ports. - usb_device.c is a HID USB FS device sample which moves mouse cursor every 0.5s. External 1.5kohm pull-up register is necessary to D+ pin (Default is gp0).
- host_hid_to_device_cdc.c is similar to capture_hid_report.c which print mouse/keyboard report from host port to device port's cdc. TinyUSB is used to manage both device (native usb) and host (pio usb) stack.
cd examples
mkdir build
cd build
cmake ..
make
# Copy UF2 file in capture_hid_report/ or usbdevice/ to RPiPico
Another sample program for split keyboard with QMK
https://github.com/sekigon-gonnoc/qmk_firmware/tree/rp2040/keyboards/pico_pico_usb
- 1 PIO, 3 state machines, 32 instructions
- Two GPIO for D+/D- (Series 22ohm resitors are better)
- 15KB ROM and RAM
- (For Host) One 1ms repeating timer
- (For Device) One PIO IRQ for receiver