1. Home
  2. Boards
  3. USB disconnects when going into deep sleep

USB disconnects when going into deep sleep

On Unexpected Maker ESP32-S2 and ESP32-S3 boards, that is the correct behaviour.

Unexpected Maker boards leverage the new native USB capabilities of the S2 and S3 chips, and native USB runs on the main cores, like regular code does, so when you put your board into deep sleep, the cores are shut down, and therefor USB can’t run.

When your board wakes fro deep sleep, the USB will start up again and re-enumerate.

NOTE: Keep in mind that USB wont start up until after your code has loaded and is running, so if you print something to the serial port before that happens, it won’t appear. You need to add a small delay (maybe 1 second) before your first print, to ensure the USB has time to start up.

On ESP32 based boards, like the TinyPICO, the USB port stays active during deep sleep because the port is actually controlled by the onboard SerialUART chip, not the ESP32 itself, but with the ESP32 sleeping, the SerialUART chip can’t communicate with the ESP32, so though the port might stay alive, the connection to the ESP32 is down.

Wait, but USB doesn’t disconnect in CircuitPython when it does into deep sleep!

That’s not actually true – in CircuitPython, with the USB connected, it actually doesn’t go into deep sleep at all – it fakes it, so you don’t lose the drive!

It’s just a simulation of deep sleep!

Updated on August 10, 2023

Related Articles