-
Notifications
You must be signed in to change notification settings - Fork 203
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 Support #11
Comments
This commit is the first working enumeration of USB in rust on the metro m0 hardware! In order to compile, it uses an unsafely modified version of the usb_device crate that avoids the use of missing atomics (Refs: rust-embedded-community/usb-device#2) I'm able to enumerate and communicate on the basic CDC implementation borrowed from https://github.com/mvirkkunen/stm32f103xx-usb/blob/master/examples/serial.rs and ported to the metro_m0 Refs: #11
This commit is the first working enumeration of USB in rust on the metro m0 hardware! In order to compile, it uses an unsafely modified version of the usb_device crate that avoids the use of missing atomics (Refs: rust-embedded-community/usb-device#2) I'm able to enumerate and communicate on the basic CDC implementation borrowed from https://github.com/mvirkkunen/stm32f103xx-usb/blob/master/examples/serial.rs and ported to the metro_m0 Refs: #11
This commit is the first working enumeration of USB in rust on the metro m0 hardware! In order to compile, it uses an unsafely modified version of the usb_device crate that avoids the use of missing atomics (Refs: rust-embedded-community/usb-device#2) I'm able to enumerate and communicate on the basic CDC implementation borrowed from https://github.com/mvirkkunen/stm32f103xx-usb/blob/master/examples/serial.rs and ported to the metro_m0 Refs: #11
FWIW I spent some time getting the USB stuff to work with RTFM (which could help with eliminating the globals) but found it hard to get both the inner references (i.e. device needs a ref to the serial object) and then return those same objects from init (because the objects constructed in |
I'm interested in working on this, but as a newbie to rust its best if I'm told what to do. How can I help? |
This is one of those thing's that's left over from when @wez was running the project and frankly I'm scared to touch it lol. |
I've been a bit too busy to pick this up in a while. Things have matured a bit more in the upstream usb-device crate so what I think needs to be done in this one now is:
With that done, we'll have a relatively low level support for USB on this class of devices and can consider actually enabling that code when publishing to crates.io, but there is still more to be done to make practical USB device implementations:
I see these as requiring some work in the upstream usb device crate with appropriate atsamd-specific support happening in this crate. There's also a distinction between low-level support (eg: it basically works) and ergonomic high-level support (eg: there's a nice way to respond to USB HID events and embed support in a consuming application crate). Beyond the bus implementation in this crate, most of the work to be done is generic USB stuff that should happen in the usb-device project. |
I'll take a look at updating the samd21 crate, but I don't have hardware so it will need someone else to test. I'll also try and get it working for samd51, which I do have hardware for. |
Looking at the samd21 code, it looks very similar to what is required for samd51. I expect there's a good amount we can put in the common crate. |
This is slowly coming along here. Some notes/changes for comment:
|
Heya @wez, how did you get the I made the mistake of writing the samd51 driver all at once, so it attaches but doesnt enumerate. I'm thinking it would be nice to have a printf out a SERCOM UART, but if thats something youve already done I'll gladly copypasta :) |
@twitchyliquid64 Did you make any progress on the samd21 port? I've got some devices I'd be willing to test with. |
@BenBergman no - haven't ported samd21 USB support over to the 0.3 version of usb-device. The original code (which ran from an earlier version) should still be usable. In terms of working on the USB peripheral, I've been side-tracked by other projects as of late, but hope to get back to this + fixing the other bug soon. |
I tried compiling the Metro-M0 usb-serial example but it is failing to compile for me, so I'm guessing some other change broke something. I poked at it a bit but low level USB is a bit beyond me and the limited time I have to focus on it. Let me know when you get back to it and I can test on a few Adafruit M0 boards I have lying around. |
This commit is the first working enumeration of USB in rust on the metro m0 hardware! In order to compile, it uses an unsafely modified version of the usb_device crate that avoids the use of missing atomics (Refs: rust-embedded-community/usb-device#2) I'm able to enumerate and communicate on the basic CDC implementation borrowed from https://github.com/mvirkkunen/stm32f103xx-usb/blob/master/examples/serial.rs and ported to the metro_m0 Refs: atsamd-rs#11
* New interrupt binding scheme. * Add multiple interrupt sources to single handler * Fix examples
This issue is tracking the implementation of USB.
Mutex
around the inner portion of the UsbBus impl? This currently satisfies the 'Sync' requirement but may to too coarsestatic
or look at an existing heap allocation crate for this purposeep!
helper macro invocations. Likely don't need so many of these nowis_stalled
methodThe text was updated successfully, but these errors were encountered: