Repository navigation
x4prosim: X4 Pro deep sleep with ext0, ext1 and RTC timer wake - #7
Merged
Merged
Conversation
SLEEP_EN with DIG_PWC DG_WRAP_PD_EN is deep sleep: the VM suspends until ext0 (RTC_IO EXT_WAKEUP0 pad at EXT_WAKEUP0_LV), ext1 (any EXT_WAKEUP1 pad high or low) or the RTC timer fires, then resets with reason DEEPSLEEP so the ROM boots again; SLP_WAKEUP_CAUSE and EXT_WAKEUP1_STATUS report the cause and pads. The GPIO model feeds GPIO0..21 to the RTC controller on new rtc-pad lines. The RTC counter advances by the time asleep (host time, since the virtual clock stops while suspended). x4prosim/deepsleep-test.py checks all three wake sources over qtest. Verified with CrossDink 1014a (x4-pro-debug): Power sleeps, a short press wakes and re-sleeps, a held press boots to Home with reset=DEEPSLEEP wake=EXT1. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KosmddRTwNJCr1dFtsAsE1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Clankmaster · project thread
Before: on the X4 Pro machine, firmware that entered deep sleep just stopped (the CPU spun forever with the log silent); Power did nothing.
After: deep sleep suspends the VM, and a Power press (ext1), the charger STAT pad (ext0) or the RTC timer wakes it into a reset with reason DEEPSLEEP, so the ROM boots again and the firmware's wake-cause code sees the real cause.
How:
esp32s3_rtc_cntltreatsSLEEP_ENwithDIG_PWCDG_WRAP_PD_EN as deep sleep and modelsEXT_WAKEUP_CONF,EXT_WAKEUP1(+_STATUS) and RTC_IOEXT_WAKEUP0. The GPIO model feeds GPIO0..21 to it on newrtc-padlines. A timer wake runs on host time (the virtual clock stops while suspended) and the RTC counter is advanced by the time asleep.x4prosim/deepsleep-test.pychecks ext0, ext1 and the timer over qtest without firmware.Checked with CrossDink 1014a (x4-pro-debug CI bin): Power sleeps (
info status= suspended); a short press wakes, the firmware counts a false wake and sleeps again; a held press boots to Home withreset=DEEPSLEEP wake=EXT1,slept=21 s.Not changed: the systimer still isn't reset by a system reset (pre-existing), so
millis()carries on across a deep-sleep wake, as it already did acrossesp_restart().🤖 Generated with Claude Code
https://claude.ai/code/session_01KosmddRTwNJCr1dFtsAsE1
Generated by Claude Code