ZigEmbeddedGroup / microzig

Unified abstraction layer and HAL for several microcontrollers
zlib License
1.25k stars 102 forks source link

Fixed RP2xxx usb reset register masks #265

Closed eugenepentland closed 1 month ago

eugenepentland commented 1 month ago

Before the rework on resets.zig the mask had all of the rp2xxx hal/resets.zig Mask had all of the values in the packed struct as false by default, so when reset.reset(.{pll_usb}) was run, it would make a bitmask for only that register. But now it makes a bitmask for every register and takes all pins out of reset mode.

I just made it so it gets the bit offset of the register and creates a bitmask for only the register in question. This should support rp2040 and rp2350, but currently is only tested with the usb cdc example on the rp2040.

eugenepentland commented 1 month ago

Turns out controlling those reset bits aren't needed because in reset.masks, it sets the usbctrl and pll_usb to be on by default.

arkadiuszwojcik commented 1 month ago

@eugenepentland I can confirm this fix works. This resolves: #261

CC: @r4gus @haydenridd