Handling Light Sleep on One Core While Running Code on Another Core with ESP32
Posted: Fri Sep 06, 2024 8:44 am
Hi everyone,
I’m working on a project where I use the ESP32 in light sleep mode to wake up when an interrupt occurs, such as when a user presses a button or after a timeout period elapses. The function I’m using is designed to put the ESP32 into light sleep mode and wake up based on these conditions.
I am also using a SIM7600 module to make HTTP requests to the internet. Ideally, I would like to make a request while the or handling user input is in light sleep mode or in a similar low-power mode so I don't need to change the code too much and I am not using something like an infinite loop. My goal is to have one core (Core 0, for instance) in light sleep mode or similar, waiting for an interrupt, while the other core (Core 1) remains active and is able to execute tasks, such as making a network request.
However, I noticed that putting one core in light sleep mode causes the other core to also go into light sleep, stopping the execution of the ongoing task.
So, my question is:
Is there a way to put one core to sleep (e.g., waiting for a GPIO interrupt or timer) while keeping the other core active and able to execute code (such as making a network request)? Additionally, once the network request is completed by the active core, both cores should enter light sleep mode again and continue waiting until either a timeout has elapsed or a GPIO pin goes high, as per the original code running on the first core.
Any suggestions or insights on achieving this would be greatly appreciated!
Thank you!
I’m working on a project where I use the ESP32 in light sleep mode to wake up when an interrupt occurs, such as when a user presses a button or after a timeout period elapses. The function I’m using is designed to put the ESP32 into light sleep mode and wake up based on these conditions.
I am also using a SIM7600 module to make HTTP requests to the internet. Ideally, I would like to make a request while the or handling user input is in light sleep mode or in a similar low-power mode so I don't need to change the code too much and I am not using something like an infinite loop. My goal is to have one core (Core 0, for instance) in light sleep mode or similar, waiting for an interrupt, while the other core (Core 1) remains active and is able to execute tasks, such as making a network request.
However, I noticed that putting one core in light sleep mode causes the other core to also go into light sleep, stopping the execution of the ongoing task.
So, my question is:
Is there a way to put one core to sleep (e.g., waiting for a GPIO interrupt or timer) while keeping the other core active and able to execute code (such as making a network request)? Additionally, once the network request is completed by the active core, both cores should enter light sleep mode again and continue waiting until either a timeout has elapsed or a GPIO pin goes high, as per the original code running on the first core.
Any suggestions or insights on achieving this would be greatly appreciated!
Thank you!