USB support#295
Conversation
the addresses look like MMIO registers
or at least they seem to work
to ensure the external oscillator has been enabled
Fixes compilation by pointing to current versions and takes in @unrelentingtech's fork of usb-device and suggestion in nrf-rs#144 (review) I folded in the hello world portion from japaric's PR summary text. refs: rust-embedded-community/usb-device#51 closes: nrf-rs#144
|
Current problems:
|
wez
left a comment
There was a problem hiding this comment.
Looks like you're making great progress! I got about 60% of the way that you did; I'm pleased to see some similarities with the stuff in my local hack branch, and happy that spending the time on that means that I can more easily reason about your PR!
| return true; | ||
| } | ||
|
|
||
| if ep0_state.direction == UsbDirection::Out { |
Co-authored-by: Wez Furlong <wez@wezfurlong.org>
|
Current status: serial stress test works better but still fails. One of the IN packets is not followed by EPDATASTATUS change, so "busy" flag is not erased and driver ends up in a locked state. |
This helps in a situation when `poll()` is not called periodically, for example, when main loop is busy writing data to an endpoint. This situation happens in the usb_serial example.
|
There was a problem in the serial example: it doesn't call |
|
I tested this version of the driver:
|
jonas-schievink
left a comment
There was a problem hiding this comment.
Did a first pass, this looks pretty good so far!
| regs.events_endepout[i].reset(); | ||
| dma_end(); | ||
|
|
||
| // TODO: ISO |
There was a problem hiding this comment.
What's the current behavior when trying to use an ISO endpoint?
Dirbaio
left a comment
There was a problem hiding this comment.
Looks great! Excited to finally have USB support in :)
Commented a few minor nits
|
|
||
| pub use nrf_usbd::Usbd; | ||
|
|
||
| #[allow(dead_code)] // fields are unused and only hold ownership |
There was a problem hiding this comment.
minor nit: I think if you name the field _clocks the warning goes away
| #[allow(dead_code)] // fields are unused and only hold ownership | ||
| pub struct UsbPeripheral<'a> { | ||
| usbd: USBD, | ||
| clocks: &'a (), |
There was a problem hiding this comment.
&() is not ZST even if () is. Maybe use PhantomData<&'a ()>?
|
Build succeeded: |
This PR is based on #144 and previous attempts.