forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
CircuitPython version
Adafruit CircuitPython 9.1.3 on 2024-08-30; ESP32-S3-DevKitM-1-N8 with ESP32S3
and latestCode/REPL
import alarm
import microcontroller as uc
uc.cpu.frequency = 240_000_000 # change
alarm.exit_and_deep_sleep_until_alarms()Behavior
The title is my current guess about what is going on. I am currently debugging a custom board with a ESP32-S3-Mini-1-N8 (8MB flash) which does not want to enter deep sleep and instead draws ~ 40mA, which is obviously way too high. (Note that USB is detached and the board reset before the current measurement.)
Description
- Clue 1: Sleep Current consumption depends on CPU frequency: ~15mA@40MHz, ~40mA@240MHz. This fact makes me conclude that its not an issue with the board but rather a software issue.
- Clue 2:
Waveshare ESP32-S3-Zero with ESP32S3(4MB flash) is not affected. - Clue 3: If I change this line in
main.ctoif (true || awoke_from_true_deep_sleep || !supervisor_workflow_active()) {the board sleeps correctly with the expected sleep current of a few microamps. - Clue 4: I added the line
mp_printf(MP_PYTHON_PRINTER, "tud_ready(): %d, websocket_connected(): %d, ble_serial_connected(): %d", tud_ready(), websocket_connected(), ble_serial_connected());to the top ofsupervisor_workflow_active(), which prints:
"tud_ready(): 1, websocket_connected(): 0, ble_serial_connected(): 1"
Hence I arrive at the conclusion that BLE is preventing deepsleep. This also explains why the Waveshare ESP32-S3-Zero is not affected, since it doesn't have BLE enabled at build time.
Note that I have not enabled anything regarding BLE to reproduce this. settings.toml is empty and not even adafruit_ble is installed. The above code is the only file on the board after a fresh install of CircuitPython.
Additional information
No response