Skip to content

Commit

Permalink
dcd_pic: check USBBUSY bit on PIC32s
Browse files Browse the repository at this point in the history
  • Loading branch information
ReimuNotMoe committed Dec 26, 2024
1 parent a416911 commit 655092d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/portable/microchip/pic/dcd_pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,9 @@ bool dcd_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) {
tu_memclr(&_dcd, sizeof(_dcd));

#if TU_PIC_INT_SIZE == 4
// The USBBUSY bit is present on PIC32s and we're required to check it
// prior to powering on the USB peripheral (see DS61126F page 27)
while (U1PWRCbits.USBBUSY);
U1PWRCSET = _U1PWRC_USBPWR_MASK;
#else
U1PWRCbits.USBPWR = 1;
Expand Down

0 comments on commit 655092d

Please sign in to comment.