nrf5x: USBD implementation and examples#965
Conversation
|
@kotokrad This is a great looking patch. Please ignore failing macos related actions, it seems that it's too new for Zig 0.15.2. It looks like you have some unused imports. Once those are fixed this is ready for a merge. |
|
@mattnite fixed 👌 |
|
I have the MDK. Give me a few days to test it. |
|
|
||
| pub fn pre_enable() void { | ||
| if (errata_187_applies()) { | ||
| if (reg(0x4006EC00).* == 0x00000000) { |
There was a problem hiding this comment.
What registers are these? Are they documented anywhere? I guess these are internal only registers and we aren't going to get more info than this + the code in the comments above.
There was a problem hiding this comment.
The registers are not documented, only this:
Anomaly 171
Anomaly 187
| /// Temporary workaround: sizes of generated structs don't match | ||
| const USBD_BASE: usize = @intFromPtr(peripherals.USBD); | ||
| inline fn epin_ptr(i: u32) *volatile u32 { | ||
| return @ptrFromInt(USBD_BASE + 0x600 + i * 0x14); |
There was a problem hiding this comment.
You should be able to remove this now
There was a problem hiding this comment.
Done, tested on my hardware
Working USBD, both CDC and HID examples work on nrf52840 (tested on nice!nano and a clone). For PR I adapted them for
nrf52840_mdkfor consistency but haven't tested as I don't have this board.HAL structure and examples are based on usb for rp2xxx port.