espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.36k stars 7.21k forks source link

TinyUSB and DFS/Light Sleep (IDFGH-12132) #13188

Closed silverchris closed 7 months ago

silverchris commented 7 months ago

Answers checklist.

General issue report

Hello, I am wondering about the correct way to handle this. I am using an ESP32-S3 I have a self powered device that will be connected to a PC to transfer files to and from an SD card, and disconnected.

This works fine if I have DFS and light sleep off. But when turned on the computer can't configure the device. I have been trying to find good place to take and release a esp_pm_lock.

I have tried an interrupt on the vbus_monitor_io pin, but that seems to be taken over by the USB peripheral, and doesn't seem to get called.

I have also tried it in the mount and premount callbacks, but that seems like it is too late.

What is the correct solution in this case?

tore-espressif commented 7 months ago

Hello @silverchris , During light sleep, the USB-OTG is clock-gated so it will not detect any USB event.

I can suggest the following:

silverchris commented 7 months ago

Awesome, that works! Thanks for the help @tore-espressif !