This is an automated email from the ASF dual-hosted git repository.
linguini pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 734068890a0 arch/xtensa/esp32[-|-s3]: Fix exception issue when pm
active
734068890a0 is described below
commit 734068890a0f3a80071294404761b98e5edc319c
Author: Eren Terzioglu <[email protected]>
AuthorDate: Mon Oct 13 16:54:07 2025 +0200
arch/xtensa/esp32[-|-s3]: Fix exception issue when pm active
Fix exception issue when PM and DEBUG_ASSERTIONS enabled for esp32 and
esp32s3.
This error happens due to PM system workflow, when system gets into
sleep-modes with
removing PM_NORMAL count, system is raising an exception for not having
enough number of PM_NORMAL state count if DEBUG_ASSERTIONS enabled.
Signed-off-by: Eren Terzioglu <[email protected]>
---
arch/xtensa/src/esp32/esp32_idle.c | 12 ++++++++++++
arch/xtensa/src/esp32s3/esp32s3_idle.c | 12 ++++++++++++
2 files changed, 24 insertions(+)
diff --git a/arch/xtensa/src/esp32/esp32_idle.c
b/arch/xtensa/src/esp32/esp32_idle.c
index d2e3c1f5a4a..45769863f30 100644
--- a/arch/xtensa/src/esp32/esp32_idle.c
+++ b/arch/xtensa/src/esp32/esp32_idle.c
@@ -167,6 +167,18 @@ static void esp32_idlepm(void)
static enum pm_state_e oldstate = PM_NORMAL;
enum pm_state_e newstate;
int ret;
+ int count;
+
+ count = pm_staycount(PM_IDLE_DOMAIN, PM_NORMAL);
+ if (oldstate != PM_NORMAL && count == 0)
+ {
+ pm_stay(PM_IDLE_DOMAIN, PM_NORMAL);
+
+ /* Keep working in normal stage */
+
+ pm_changestate(PM_IDLE_DOMAIN, PM_NORMAL);
+ newstate = PM_NORMAL;
+ }
/* Decide, which power saving level can be obtained */
diff --git a/arch/xtensa/src/esp32s3/esp32s3_idle.c
b/arch/xtensa/src/esp32s3/esp32s3_idle.c
index 8f59ce567a2..91b0a18800f 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_idle.c
+++ b/arch/xtensa/src/esp32s3/esp32s3_idle.c
@@ -90,6 +90,18 @@ static void up_idlepm(void)
static enum pm_state_e oldstate = PM_NORMAL;
enum pm_state_e newstate;
int ret;
+ int count;
+
+ count = pm_staycount(PM_IDLE_DOMAIN, PM_NORMAL);
+ if (oldstate != PM_NORMAL && count == 0)
+ {
+ pm_stay(PM_IDLE_DOMAIN, PM_NORMAL);
+
+ /* Keep working in normal stage */
+
+ pm_changestate(PM_IDLE_DOMAIN, PM_NORMAL);
+ newstate = PM_NORMAL;
+ }
/* Decide, which power saving level can be obtained */