From f60c71d131db76b4d6a0fe465afe7783a65ab2a7 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 25 Jun 2024 16:48:39 +1000 Subject: [PATCH] rp2: Don't disable USB if going to DORMANT mode. In this mode, XOSC is stopped so can't really keep the USB PLL enabled. Signed-off-by: Angus Gratton --- ports/rp2/modmachine.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/rp2/modmachine.c b/ports/rp2/modmachine.c index 9cc15080c..2cc79369f 100644 --- a/ports/rp2/modmachine.c +++ b/ports/rp2/modmachine.c @@ -138,7 +138,8 @@ static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) { #if MICROPY_HW_ENABLE_USBDEV // Only disable the USB clock if a USB host has not configured the device - bool disable_usb = !tud_mounted(); + // or if going to DORMANT mode. + bool disable_usb = !(tud_mounted() && n_args > 0); #else bool disable_usb = true; #endif