diff options
| author | Reimu NotMoe <[email protected]> | 2024-12-27 04:17:26 +0800 |
|---|---|---|
| committer | Reimu NotMoe <[email protected]> | 2024-12-27 04:17:26 +0800 |
| commit | 655092d568720188a3a34b9376a7ebcf274dab79 (patch) | |
| tree | 02793eca9648b3abe99248e4c0b2b60569f427b2 /src | |
| parent | a4169114ec6acb07cf8e26a1718e61c0c7af69fa (diff) | |
dcd_pic: check USBBUSY bit on PIC32s
Diffstat (limited to 'src')
| -rw-r--r-- | src/portable/microchip/pic/dcd_pic.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/portable/microchip/pic/dcd_pic.c b/src/portable/microchip/pic/dcd_pic.c index a4fa0e840..b4a698199 100644 --- a/src/portable/microchip/pic/dcd_pic.c +++ b/src/portable/microchip/pic/dcd_pic.c @@ -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; |
