imxrt-rs / imxrt-hal

Rust for NXP i.MX RT
Apache License 2.0
133 stars 33 forks source link

Port imxrt-usbd examples for cross-board USB testing #130

Closed mciantyre closed 1 year ago

mciantyre commented 1 year ago

Recent USB troubleshooting (here and here) had me wanting USB examples on easily debug-able boards. The examples maintained in the imxrt-usbd repository only work on the Teensy 4, and there's no straightforward way to add new board support. Since imxrt-hal exports imxrt-usbd, I figure we could demonstrate the driver here, then receive the cross-board testing for free.

This PR ports the four primary USB examples from the imxrt-usbd repository. It rewrites them all to use RTIC. I tested them across my three available boards (Teensy 4, 1010EVK, 1170EVK) in various build and release configurations. The test-class and serial examples worked as expected against my macOS and Linux (RPi) hosts; HID examples worked on my macOS host.

See commit messages for more notes. If accepted, I'll remove the examples in the imxrt-usbd repository and refer users here.

mciantyre commented 1 year ago

If you're testing this locally, make sure you're using 0.2.1 of imxrt-usbd. A cargo update should pull in the necessary patches.