Skip to content

feat(usb_host): esp sleep modes verification#445

Draft
peter-marcisovsky wants to merge 3 commits intomasterfrom
feat/usb_host_light_sleep
Draft

feat(usb_host): esp sleep modes verification#445
peter-marcisovsky wants to merge 3 commits intomasterfrom
feat/usb_host_light_sleep

Conversation

@peter-marcisovsky
Copy link
Copy Markdown
Collaborator

@peter-marcisovsky peter-marcisovsky commented Mar 20, 2026

Description

Verification of using light sleep and deep sleep in combination with USB Host application.

Light sleep

  • Using CONFIG_ESP_SLEEP_EVENT_CALLBACKS
  • Register enter and exit light sleep events
  • Calling root port suspend/resume upon enter/exit light sleep to effectively suspend the peripheral and the connected device
  • Connected device enters suspended state during the light sleep
  • Connected device must not undergo a reset during light sleep

Light sleep log, with light sleep callbacks enabeld

Root port enters suspended mode before entering light sleep

Screenshot from 2026-03-27 12-31-41

Light sleep log, with light sleep callbacks disabled

Missing suspend/resume sequence from host. Host just stops sending SOFs without any "reason". This pattern only appears on HS port.

Screenshot from 2026-04-01 15-42-00

Deep sleep

  • Connected device shall be disconnected upon entering deep sleep and connected back after exiting deep sleep
  • RAM is unpowered during deep sleep and any information about the connected device (cached descriptors, device state.. ) is lost during deep sleep
  • Currently, HNP cap is enabled before entering deep sleep in sleep_usb.c to prevent current leakage.

Testing

  • usb_sleep_modes target tests
    • light sleep verification
    • deep sleep verification

TODO

  • test the feature on all targets (also H4)

Limitations

  • Light sleep: a device must be present in order to call root port suspend in a light sleep callback
    • Known "issue" from the original suspend/resume implementation before HCLK clock gating was introduced
    • Will be fixed in a separate PR

Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@peter-marcisovsky peter-marcisovsky self-assigned this Mar 20, 2026
@peter-marcisovsky peter-marcisovsky added Status: In Progress Issue is being worked on Component: usb_host Issue affects usb_host component labels Mar 20, 2026
@peter-marcisovsky peter-marcisovsky force-pushed the feat/usb_host_light_sleep branch from aca937d to 4ad8b7d Compare March 25, 2026 14:10
@peter-marcisovsky peter-marcisovsky changed the title feat(usb_host): light sleep verification feat(usb_host): esp sleep modes verification Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: usb_host Issue affects usb_host component Status: In Progress Issue is being worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant