Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32 ULP example does not WAKE the SoC when it is not in deep sleep (IDFGH-6712) #8341

Closed
sgalabov opened this issue Feb 3, 2022 · 1 comment
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@sgalabov
Copy link

sgalabov commented Feb 3, 2022

Problem Description

  • The example suggests that READ_RTC_FIELD(RTC_CNTL_LOW_POWER_ST_REG, RTC_CNTL_RDY_FOR_WAKEUP) should be used to check that RTC_CNTL_RDY_FOR_WAKEUP is set before attempting to WAKE the chip.
  • The documentation for the WAKE instruction says the following:

Note that before using WAKE instruction, ULP program may needs to wait until RTC controller is ready to wake up the main CPU. This is indicated using RTC_CNTL_RDY_FOR_WAKEUP bit of RTC_CNTL_LOW_POWER_ST_REG register. If WAKE instruction is executed while RTC_CNTL_RDY_FOR_WAKEUP is zero, it has no effect (wake up does not occur).

However, when the SoC is not in deep sleep mode it appears that the RTC_CNTL_RDY_FOR_WAKEUP bit of RTC_CNTL_LOW_POWER_ST_REG is actually never set, so if an ULP program relies on it to signal the SoC to wake up it will never be able to.

Clearer guidelines are needed in the documentation at least on how to achieve reliable WAKE functions both when the SoC is in deep sleep and when it is not.

Using the WAKE instruction without checking for the RTC_CNTL_RDY_FOR_WAKEUP bit of RTC_CNTL_LOW_POWER_ST_REG seems to work fine most of the time, but the documentation and example suggest that this may not be reliable and we may fail to wake the SoC up by just calling WAKE when the SoC is in deep sleep and RTC_CNTL_RDY_FOR_WAKEUP is not set.

Expected Behavior

To be able to have the ULP signal the SoC reliably both when the SoC is in deep sleep and when it is not.

Actual Behavior

If we follow the example wake up works when the SoC is in deep sleep, but does not work otherwise.

How to Reproduce

I use this simple gist in place of ulp_example_main.c from the example to confirm the failure to signal the SoC from the ULP when waiting for the RTC_CNTL_RDY_FOR_WAKEUP to be set while the SoC is not in deep sleep. Then, if I just call WAKE without waiting for RTC_CNTL_RDY_FOR_WAKEUP to be set everything seems to work as expected.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Feb 3, 2022
@github-actions github-actions bot changed the title ESP32 ULP example does not WAKE the SoC when it is not in deep sleep ESP32 ULP example does not WAKE the SoC when it is not in deep sleep (IDFGH-6712) Feb 3, 2022
@sgalabov
Copy link
Author

sgalabov commented Feb 7, 2022

Having continued to look for the answer I found #5254, which, if valid, would answer my question too.
It would be nice to get it properly documented for posterity... :-)
If someone can confirm that the solution suggested in #5254 is valid I am ok with closing this issue, of course.

@espressif-bot espressif-bot added Status: In Progress Work is in progress Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new Status: In Progress Work is in progress Resolution: NA Issue resolution is unavailable labels Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

3 participants