-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
USB Host Example #122
Comments
I'm not aware of any Rust-based USB host drivers for the i.MX RT MCUs. Generally, the embedded Rust ecosystem doesn't have much for developing USB host drivers. Here's what I'm finding:
|
Thanks for the feedback on this. The two references that you provided do offer paths forward. Of note is that the USBHost_t36 library from Stoffregen is more adaptable to being a USB Host with serial versus tinyUSB. With that said, the Rust binding to TinyUSB are showing a path forward, it is just that the details of working with serial over usb with that library will have some discovery effort. The question may arise why do need serial over usb and not just use a standard type FTDI or similar type connection, and the answer is that I had to develop a coprocessor type solution to an existing STM32F4 MCU that had built in USB, so the connection to it had to be as a USB Host. I will attempt to get the rust binding to TinyUSB to work and then progress with serialUSB method. |
One more approach to consider: custom Rust bindings to USBHost_t36. Pre-allocate some of the USB host objects in a C++ library, and expose a C FFI to Rust that manipulates those objects. That USB host serial example might demonstrate the objects and behaviors that Rust would need. Personally, I've not mixed C++ and Rust, so I'm not sure of the risks with this approach. One limitation I can think of: the teensy4-bsp's runtime isn't calling static constructors. This would need to change if we must allocate USB host objects at global scope. Best of luck. I'm happy to keep this open until we have other approaches for Rust-based USB host drivers. |
Thank you for the very valuable insight here. I really like this approach. Based on your suggestion, and further looking around, I am thinking to try to make the binding with Cxx which is from here: This is of particular value from the perspective that the USBHost_t36 library is well proven and tested in my experience with the device side being USB Serial. The Cxx is developed by KDAB and is meant to be a bridge between C++ and Rust in general, and specifically for Qt GUI framework. It seems to have substantial resources and effort engaged with it. Thanks. James |
Very helpful feedback ! |
The existing USB examples are great, but just looking for a USB Host example for SerialUSB similar to the USBHost_t36 library example found here https://github.com/PaulStoffregen/USBHost_t36/tree/master/examples/Serial
Thanks. James
The text was updated successfully, but these errors were encountered: