Closed mciantyre closed 1 year ago
Another way to frame this effort: a log
implementation that works with usbd-serial
. Or maybe a defmt
implementation that works with some USB class (maybe serial, HID, or something custom). This general package could be a win for other embedded Rust users. I've seen hints of people working on this kind of package in chats and issues, but I haven't found working code. Let me know here if you're aware of something like this.
I'd happily contribute, and integrate it in the BSP. Since it would work beyond this BSP, I would recommend maintaining it elsewhere.
Any docs on how to attach to device and see the bsp::usb
logs included with template?
//! Success criteria: you see log messages when connecting
//! to the Teensy 4 using PuTTY of another serial console.
//! Baud rate is 9600.
screen /dev/cu.usbmodem67030201 9600
Hi @mciantyre, this seemed like a nice thing to have so I gave it a shot.
I've mainly borrowed from imxrt-usbd
+ imxrt-uart-log
and haven't found a way to make it HAL-agnostic yet.
Some feedback and ideas for improvements would be appreciated.
You can find the repo here: https://gitlab.com/jspngh/imxrt-usb-log
Thanks for giving this a go. It's great to see this support for today's BSP and USB driver. I'll take a look through to see what kind of uses you're considering.
I'm sorry, I've haven't kept this issue up to date. I've been working on another logging solution in my imxrt-hal fork. This other approach requires a whole change in the imxrt-rs ecosystem, so it'll take longer to realize and would only be usable in a future Teensy 4 BSP.
No problem, it looks like a more powerful and flexible solution, I'll keep an eye on your work! If anything, my attempt served as a learning process. But maybe someone else finds it useful in the short term, so I wanted to share it.
The
imxrt-usbd
package provides a USB driver that's compatible with theusb-device
Rust ecosystem.imxrt-usbd
should be sufficient to replace the BSP's custom USB stack. Remove the C-based USB driver, and provide a replacement logger that's written in Rust.The design should not prohibit others from bringing their own USB driver.