From a28791dbed53be7c38b710d991b9bec73cfcec44 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Mon, 17 Oct 2022 10:59:26 +0200 Subject: [PATCH] ulp: fix incorrect bit-width operator while reading RTC_CNTL_LOW_POWER_ST_REG during wakeup This commit fixes a bug wherein an incorrect bit-width of 0 was being used while reading the RTC_CNTL_LOW_POWER_ST_REG in ulp_fsm example code while judging whether the system is ready for wakeup. The correct value should be a bit-width of 1 to read bit#27 (RTC_CNTL_MAIN_STATE_IDLE) of the RTC_CNTL_LOW_POWER_ST_REG register on esp32. --- docs/en/api-reference/system/ulp_instruction_set.rst | 2 +- examples/system/ulp_fsm/ulp/main/ulp/wake_up.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/api-reference/system/ulp_instruction_set.rst b/docs/en/api-reference/system/ulp_instruction_set.rst index abe268a9f3..d9b6f2d72b 100644 --- a/docs/en/api-reference/system/ulp_instruction_set.rst +++ b/docs/en/api-reference/system/ulp_instruction_set.rst @@ -1001,7 +1001,7 @@ The detailed description of all instructions is presented below: // and ULP will not run again until started by the main program. 1: check_wakeup: // Read RTC_CNTL_RDY_FOR_WAKEUP and RTC_CNTL_MAIN_STATE_IN_IDLE bit - READ_RTC_REG(RTC_CNTL_LOW_POWER_ST_REG, 27, 0) + READ_RTC_REG(RTC_CNTL_LOW_POWER_ST_REG, 27, 1) MOVE r1, r0 // Copy result in to r1 READ_RTC_FIELD(RTC_CNTL_LOW_POWER_ST_REG, RTC_CNTL_RDY_FOR_WAKEUP) OR r0, r0, r1 diff --git a/examples/system/ulp_fsm/ulp/main/ulp/wake_up.S b/examples/system/ulp_fsm/ulp/main/ulp/wake_up.S index 1ccc94a9f4..f6bf8fa3b7 100644 --- a/examples/system/ulp_fsm/ulp/main/ulp/wake_up.S +++ b/examples/system/ulp_fsm/ulp/main/ulp/wake_up.S @@ -14,7 +14,7 @@ wake_up: /* Check if the system is in sleep mode */ #if CONFIG_IDF_TARGET_ESP32 - READ_RTC_REG(RTC_CNTL_LOW_POWER_ST_REG, 27, 0) + READ_RTC_REG(RTC_CNTL_LOW_POWER_ST_REG, 27, 1) #else READ_RTC_FIELD(RTC_CNTL_LOW_POWER_ST_REG, RTC_CNTL_MAIN_STATE_IN_IDLE) #endif