Skip to content

rp2 usb host: device won't enumerate during sleep() #9905

@jepler

Description

@jepler

CircuitPython version

d73473b647d76516d15c7c483951afb5cfd1af81 (#9901) on Metro RP2350

Code/REPL

import board, digitalio, time, usb, usb_host
pwr = digitalio.DigitalInOut(board.USB_HOST_5V_POWER)
port = usb_host.Port(board.USB_HOST_DATA_PLUS, board.USB_HOST_DATA_MINUS)
pwr.switch_to_output(True)
usb.core.find(find_all=True)
print("Here are the devices", list(usb.core.find(find_all=True)))
print("Sleeping 3s")
time.sleep(3) 
print("Here are the devices", list(usb.core.find(find_all=True)))
print()
 
print("busy-waiting 3s")
t = time.monotonic_ns()
e = t + 3_000_000_000
while (now := time.monotonic_ns()) < e:
    devices = list(usb.core.find(find_all=True))
    if devices:      
        print(f"busy-waiting found device after {(now-t)*1e-9}s")
        break
    pass  
print("Here are the devices", list(usb.core.find(find_all=True)))
print()

Behavior

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Here are the devices []
Sleeping 3s
Here are the devices []

busy-waiting 3s
busy-waiting found device after 0.0511474s

Description

Something is failing to happen during time.sleep() that prevents an attached USB device from enumerating. When a busy-loop is used, my particular keyboard enumerates in about 1/20s. But even a long sleep of 3s doesn't work.

Additional information

No response

Activity

added this to the 9.2.x milestone on Dec 22, 2024
self-assigned this
on Feb 13, 2025
modified the milestones: 9.2.x, 10.0.0 on Mar 17, 2025
removed their assignment
on Apr 16, 2025
dhalbert

dhalbert commented on Jul 24, 2025

@dhalbert
Collaborator

@tannewt could not reproduce, some time ago.

modified the milestones: 10.0.0, 10.x.x on Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @tannewt@jepler@dhalbert

        Issue actions

          rp2 usb host: device won't enumerate during sleep() · Issue #9905 · adafruit/circuitpython