Skip to content

USB stops working after Windows host computer sleep #8107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
asafteirobert opened this issue Apr 22, 2023 · 12 comments
Open
1 task done

USB stops working after Windows host computer sleep #8107

asafteirobert opened this issue Apr 22, 2023 · 12 comments

Comments

@asafteirobert
Copy link

asafteirobert commented Apr 22, 2023

Board

LOLIN S2 mini

Device Description

LOLIN S2 mini with ESP32-S2FH4 chip

Hardware Configuration

LOLIN S2 mini with some buttons attached to IO pins, connected to a Windows PC through USB.

Version

v2.0.8

IDE Name

Arduino IDE

Operating System

Windows 10 21H2

Flash frequency

40MHz

PSRAM enabled

no

Upload speed

921600

Description

Reproduction steps:

  • Setup: LOLIN S2 mini connected to a Windows PC through USB
  • Load the examples\USB\Keyboard\KeyboardMessage\
  • Pressing the button types the message correctly.
  • Put Windows to sleep using Start->Power->Sleep
  • Wake up Windows
  • Pressing the button no longer types the message.

It appears the whole USB ends up in a broken state as uploading to the port(which still shows as connected) is no longer possible. Trying to access the debug serial port gives Error 31 "A device attached to the system is not functioning".
Unplugging the USB cable USBLogView shows the USB Composite device, USB Input Device and USB Serial Device being unplugged.
Reconnecting the USB cable (and thus also resetting the device) makes the sketch and upload port work again.

What I tried:

  • USB CDC On Boot Enabled or Disabled
  • Calling USB.usbAttributes(TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP); before USB.begin();
  • Disabling "Allow the computer to turn off this device to save power" on the HID device.

I can confirm that USB power is not turned off.

Sketch

The official example USB\Keyboard\KeyboardMessage

Debug Message

No output

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@asafteirobert asafteirobert added the Status: Awaiting triage Issue is waiting for triage label Apr 22, 2023
@No-idea-anymore
Copy link

Good day, I I was wondering if you found a solution to this problem? I'm encountering the same issue with the ESP32-S3-WROOM-1 module.

@tobwen
Copy link

tobwen commented Nov 27, 2023

Did you try this?

USB.usbAttributes(TUSB_DESC_CONFIG_ATT_SELF_POWERED | TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP);

source: https://forums.adafruit.com/viewtopic.php?p=937699

@wareya
Copy link

wareya commented Feb 16, 2024

Hi, I'm having this issue too and the fix in the above post doesn't seem to work. I think TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP is about the mouse's ability to wake up the computer, not the other way around. I'm using an ESP32-S2-DevKitM-1U.

@MRezaNasirloo
Copy link

I'm having the same issue. It's not an ESP32-* issue, but rather an issue with the TinyUSB library. I tried a different project on an RP2040 board, which also uses TinyUSB and exhibits the same behavior. You should open a bug ticket for that project as well.

@wareya
Copy link

wareya commented Apr 13, 2024

I actually remade my project on an rp2040 and this issue went away, but I'm using the mbed os core, not the arduino-pico core. Does the mbed os core also use TinyUSB?

@MRezaNasirloo
Copy link

I couldn't find any reference to TinyUSB in the mbed project. Do you use USB CDC in your project? Also, do you use USB power or a dedicated 5V voltage?

When the PC goes to sleep, the 5V is not disconnected, leaving the cdc usb stack in a broken state. I found out that if you use a 5V source from the PSU, the MCU will shut off on PC sleep and turn on again on wake up, It's a workaround, not a solution.

@Parsaabasi Parsaabasi removed the Status: Awaiting triage Issue is waiting for triage label Jan 16, 2025
@Parsaabasi
Copy link

Hello,

Due to the overwhelming volume of issues currently being addressed, we have decided to close the previously received tickets. If you still require assistance or if the issue persists, please don't hesitate to reopen the ticket.

Thanks.

@tobwen
Copy link

tobwen commented Jan 16, 2025

Please do NOT close all those tickets as "completed"... They're stale since nobody cared.

@me-no-dev
Copy link
Member

@tobwen if this issue still exists, please open a new issue referencing this one, so we can move it up the queue and try to solve it

@admire123hk
Copy link

i have the same problem with my ESP32-S3 dev board too, i program the ESP32 as USB joystick, but after windows sleep and wake up, the ESP32 joystick not working anymore, i need to reset the ESP32 in order to work

@bkaes
Copy link

bkaes commented Feb 6, 2025

Hello,

Due to the overwhelming volume of issues currently being addressed, we have decided to close the previously received tickets. If you still require assistance or if the issue persists, please don't hesitate to reopen the ticket.

Thanks.

Hi, can you please reopen this? This issue still exists.

@me-no-dev me-no-dev reopened this Feb 6, 2025
@tobwen
Copy link

tobwen commented Feb 6, 2025

Please do NOT close all those tickets as "completed"... They're stale since nobody cared.

Just to clarify: With my reply, I wanted to express that it's not appropriate to close all open/stale tickets as "completed," as this implies that the issue has been fixed. However, this is not the case and only makes the statistics look better. This doesn't help anyone... When someone takes the time to report bugs, the ticket should remain open until someone has processed it - OR be marked as "stale" accordingly. But closing tickets as "completed" is absolutely the wrong approach and punches the community into the face,

Thanks for opening! Let's try to fix this annoying bug. Maybe here or maybe somewhere else upstream.

@rftafas rftafas added Type: Bug 🐛 All bugs and removed Type: Bug 🐛 All bugs labels Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants