Skip to content

Commit 168c709

Browse files
committed
pic32mz: Fix remote_wakeup without OS
Remote wakeup requires 10ms of delay when RESUME bit is toggled. It was covered for OS build. For non-OS build simple delay based on board_millis() is used to wait required amount of time. Without this remote wakup may not work.
1 parent 976405d commit 168c709

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/portable/microchip/pic32mz/dcd_pic32mz.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ void dcd_remote_wakeup(uint8_t rhport)
163163
USB_REGS->POWERbits.RESUME = 1;
164164
#if CFG_TUSB_OS != OPT_OS_NONE
165165
osal_task_delay(10);
166+
#else
167+
// TODO: Wait in non blocking mode
168+
unsigned cnt = 2000;
169+
while (cnt--) __asm__("nop");
166170
#endif
167171
USB_REGS->POWERbits.RESUME = 0;
168172
}

0 commit comments

Comments
 (0)