Random resets after deep sleep

bfredo123
Posts: 9
Joined: Sat Oct 05, 2024 11:16 am

Random resets after deep sleep

Postby bfredo123 » Sun Nov 17, 2024 10:35 am

Hi,

With an ESP32S3 board (PowerFeather) the following code sometimes poweron-resets instead of waking up properly:

Code: Select all

extern "C" void app_main()
{
  ets_delay_us(1000*1000);
  ets_printf("wakeup_cause=%d reset_reason=%d\n", esp_sleep_get_wakeup_cause(), esp_reset_reason());
  esp_sleep_enable_timer_wakeup(500*1000);
  esp_deep_sleep_start();
This is a major issue for my code as I need some variables to be kept during deep sleeps, and the poweron-reset clears them out.

Below is the output (out of idf.py monitor, which obviously disconnects/reconnects during deep sleeps): I have added some "**" to highlight some reset reasons to be a poweron-reset rather than deep sleep wakeup.

I have tried to disable the brownout detection in sdkconfig as it was mentioned in other posts, but it does not help for me.
I am using ESP-IDF v5.1.4 due to compatibility constraints.

Would you please have any idea to get rid of these poweron-resets?
Many thanks!

Code: Select all

...
I (322) main_task: Calling app_main()
wakeup_cause=0 reset_reason=0
--- Error: read failed: [Errno 6] Device not configured
--- Waiting for the device to reconnect.
wakeup_cause=4 reset_reason=8
--- Error: read failed: [Errno 6] Device not configured
--- Waiting for the device to reconnect.
wakeup_cause=4 reset_reason=8
--- Error: read failed: [Errno 6] Device not configured
--- Waiting for the device to reconnect.
**wakeup_cause=0 reset_reason=1**
--- Error: read failed: [Errno 6] Device not configured
--- Waiting for the device to reconnect.
wakeup_cause=4 reset_reason=8
--- Error: read failed: [Errno 6] Device not configured
--- Waiting for the device to reconnect.
wakeup_cause=4 reset_reason=8
--- Error: read failed: [Errno 6] Device not configured
--- Waiting for the device to reconnect.
wakeup_cause=4 reset_reason=8
--- Error: read failed: [Errno 6] Device not configured
--- Waiting for the device to reconnect.
wakeup_cause=4 reset_reason=8
--- Error: read failed: [Errno 6] Device not configured
--- Waiting for the device to reconnect.....
...

bfredo123
Posts: 9
Joined: Sat Oct 05, 2024 11:16 am

Re: Random resets after deep sleep

Postby bfredo123 » Mon Nov 18, 2024 8:44 am

I have tested the same code on an Arduino Nano ESP32, and cannot see any issues, so it looks like the issue is coming from the PowerFeather board. However, as it is specialized on very low current in deep sleep, I can't believe it does not work well in the deep sleep mode.
Any clue what I could have done wrong? Or what I could test to locate the cause?

The problem (random poweron resets) occurs not only with the board plugged into my device, but also/even with the PowerFeather board alone, plugged to nothing except USB for the 5V power (coming from a MacOS). So I doubt the cause could be a bad power supply.

Thank you again for any help or suggestion!

bfredo123
Posts: 9
Joined: Sat Oct 05, 2024 11:16 am

Re: Random resets after deep sleep

Postby bfredo123 » Mon Nov 18, 2024 7:20 pm

It seems that the issue was fixed by adding an initialization line:

```
Board.init(0);
```

Many thanks to PowerFeather's great support: https://forum.powerfeather.dev/d/14-ran ... deep-sleep

Who is online

Users browsing this forum: No registered users and 207 guests