ESP32 Pico D4 freeze after some time

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
jetsen
Posts: 6
Joined: Thu May 14, 2020 6:41 am

ESP32 Pico D4 freeze after some time

Post by jetsen » Tue Sep 14, 2021 10:06 am

Hi All,
I have a problem with an ESP32 Pico D4. It’s an application that should be run 24/7/365... The problem: after a few days the esp freeze.

Hardware:
ESP32 Pico D4 on custom PCB

Software:
Micropython (commit 7c51cb2307eaca1a1ccc071e0bb5eb4a5f734610 (HEAD -> master, tag: v1.16)) with custom build firmware with some frozen modules

Problem:
The ESP32 freeze sometimes (after a few days – between 20 to 40 days) without any error message. If I made a softreset over UART, the esp32 boots and everything works fine. The internal timer (RTC) runs all the time, so I think it’s not a problem with the hardware.

Things I have already done:
- Check power supply - > looks very clean
- Implement WDT -> does not triggered if frozen
- Activate GC with dynamic threshold

Code: Select all

gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
- Permanent print some information over REPL -> if the esp freeze, the prints stop without any debug or other information

Things in progress:
- I have connected four esps with different operating modes and observing whether the problem occurs with all of them
- After the test above I will run a clean firmware from the micropython website, only with a small blinky app and then see what happens…

Since it takes a long time for the error to occur, I wanted to ask you what else I can do.

I would be grateful for a tip :)

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: ESP32 Pico D4 freeze after some time

Post by davef » Tue Sep 14, 2021 10:22 am

Are you using the WiFi? Are you going to deepsleep()?

jetsen
Posts: 6
Joined: Thu May 14, 2020 6:41 am

Re: ESP32 Pico D4 freeze after some time

Post by jetsen » Tue Sep 14, 2021 10:26 am

davef wrote:
Tue Sep 14, 2021 10:22 am
Are you using the WiFi? Are you going to deepsleep()?
No WiFi
No deepsleep()

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: ESP32 Pico D4 freeze after some time

Post by davef » Tue Sep 14, 2021 10:38 am

Have you checked that AP mode is not running after you boot the device?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: ESP32 Pico D4 freeze after some time

Post by davef » Tue Sep 14, 2021 10:40 am

Code: Select all

ap_if = network.WLAN(network.AP_IF) #  create access-point interface

#  disconnects AP if it is up
ap_if.active(False) #  de-activate the AP interface

jetsen
Posts: 6
Joined: Thu May 14, 2020 6:41 am

Re: ESP32 Pico D4 freeze after some time

Post by jetsen » Tue Sep 14, 2021 11:46 am

Thanks for your reply!

The following function returns "False":

Code: Select all

network.WLAN().active()
Is that enough or should I add your code for safety?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: ESP32 Pico D4 freeze after some time

Post by davef » Tue Sep 14, 2021 7:31 pm

Good morning,

I think it is enough. Someone somewhere said the ESP32 boots up in AP mode. However, it looks like I misunderstood or that someone wasn't referring to v1.17

As for power supplies I usually use a SMPS buck unit rated at 5Amps and then put 1000uF low-ESR electro on the output.

Are you running a software WDT?

jetsen
Posts: 6
Joined: Thu May 14, 2020 6:41 am

Re: ESP32 Pico D4 freeze after some time

Post by jetsen » Wed Sep 15, 2021 2:16 pm

Wow 5 ampere is a lot :mrgreen: ... my power supply is not that big, but the voltage looks fine (measured with oscilloscope).

Are you running a software WDT?
What do you mean with "software WDT". I used this:

Code: Select all

wdt = machine.WDT(timeout=15000)
and

Code: Select all

wdt.feed()

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: ESP32 Pico D4 freeze after some time

Post by davef » Wed Sep 15, 2021 7:33 pm

5A for short periods, it would need a heatsink for continuous operation.

I use a software WDT as found here:
viewtopic.php?t=5517&start=10

There is another one by Peter Hinch on Github.

As I don't have any experience using machine.WDT I can't say if one is better or worse than the other. Using the above software the device will re-boot and start running again. Is that behaviour suitable for you?

I was getting the odd WDT when trying to send data logs to Gmail's SMTP server. After the device re-boots it tries to send the log again. For me that gives me the reliability that I need.

jetsen
Posts: 6
Joined: Thu May 14, 2020 6:41 am

Re: ESP32 Pico D4 freeze after some time

Post by jetsen » Thu Sep 16, 2021 10:27 am

The behaviour would be OK in principle, but I assume that "machine.WDT" and "software WDT" will not work, because in my application other functions are also no longer executed when the esp is frozen. So why should machine.reset() be executed but everything else not...?

But I will try it out the next time the esps freeze.

Thanks for your help so far! :)

...

I would like to get to the root of the Problem. But I have no idea where to start... I will now test the previous ideas and hope that I will gain new insights.

Post Reply