Skip to content

USB Host: Polling Uses Lots of CPU #10555

@samblenny

Description

@samblenny

Currently (10.0.0-beta.2 on Fruit Jam), it seems like polling for USB host device input events with usb.core.Device.read() uses a lot of CPU time compared to reading GPIO pins or I2C. I know this is vague. All I have at this point is anecdotal observations that USB polling in combination with picodvi and/or synthio appears to load down the RP2350 CPU (slow display updates, probability of dropped/stuck notes goes up at higher synthio sample rates, etc). For example, last year (around 9.1.4), when foamyguy ported my Pumpkin Toss game to use I2C gamepad input instead of USB gamepad input, the animation loop ended up running way faster.

I'd like to find a way to speed up USB polling for synth and game projects so that more CPU time is available for displayio and synthio background tasks. Maybe this could be improved by using asyncio or something?

I'm posting this issue at tannewt's request to split out one of the points I mentioned in USB Host Improvement Quest Umbrella Issue #10551. The point of this issue is to let people know I'm planning to work on this myself and to ask for comments and feedback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions