Page 1 of 2

machine.WDT does not appear to work [Sorted]

Posted: Thu May 19, 2022 9:49 pm
by davef
I have been chasing random lock-ups for more than a year on the ESP32-WROOM-32 units. Although I was aware that rev 1 chips had been replaced with rev 3 chips I had to move to the SPIRAM variant as I could not get boards with rev 3 chips off Aliexpress. Random lock-ups seemed to disappear and I was only using a S/W WDT.

Recently, I started getting rev 3 chips in the ESP32-WROOM-32 parts so have had another go at using them. Unfortunately, I made another change and that was using machine.WDT instead of a S/W WDT.

Hardly 12 hours of running the new system and total lock-up. I will go back to a S/W WDT, but if there are any hints out there on how to get machine.WDT to reliably re-boot my board I would really appreciate to hear about it.

Re: machine.WDT does not appear to work

Posted: Fri May 20, 2022 9:23 am
by karfas
Might be a hardware or ESP-IDF issue.
see e.g. https://esp32.com/viewtopic.php?t=18359 or search for "esp_task_wdt_add".

Re: machine.WDT does not appear to work

Posted: Fri May 20, 2022 10:28 am
by davef
Thanks for the comments. There was no suggestions to the poster in the first link. I haven't got the skills to try an "esp_task_wdt_add".

I hoped that just using machine.WDT in the ESP32 port would cover my basic requirement. I run these units off a LM317 5V reg (1.5A capability) usually with 1000uF to handle any surges when the WiFi fires-up. Often I put an extra 1000uF on the 3V3 as well ... but not on this unit.

I have gone back to a S/W WDT on this unit.

Re: machine.WDT does not appear to work

Posted: Fri May 20, 2022 2:49 pm
by karfas
esp_task_wdt_init and esp_task_wdt_add are the IDF functions called by the WDT module.
You already used them.

For an application with high availability needs I would use both the SW and the WDT watchdog. In the rare cases when the SW Watchdog doesn't catch a lockup, the WDT thing might be able to fix things.

Re: machine.WDT does not appear to work

Posted: Fri May 20, 2022 7:39 pm
by davef
When I read through the docs for esp_task_wdt_add it sounded like I would have the opportunity to add in other watchdog tasks and that's when I was overwhelmed!

If and when the S/W WDT fails and will try both ... that never occurred to me. Thanks.

Re: machine.WDT does not appear to work

Posted: Wed Jul 27, 2022 12:07 am
by Jibun no kage
Odd thing is, I just discovered that machine.WDT is not working right on my Pico W as well. I can set up WDT, but apparently feeding WDT never occurs correctly even when I set WDT timeout 60 seconds, and WDT is in a loop to execute once per second. The WDT still fires. If I disable the WDT from ever starting its count down, my Pico W is fine, otherwise it disconnects/resets.

Re: machine.WDT does not appear to work

Posted: Wed Jul 27, 2022 2:12 am
by davef
Something I discovered recently is ... I can only init the system wdt in one file (the file containing your main loop) and only call wdt.feed in that file. So, if I call other files I can not placed any wdt.feed in them.

wdt.feed must be working for me as I am in one second loops 24/7. ESP32-Generic

Re: machine.WDT does not appear to work

Posted: Wed Jul 27, 2022 6:27 am
by Roberthh
That sounds strange. You should be able to use the wdt object created with the call to WDT() at any place in your code. Obviously you have to take care to make it visible at these places, like making it global.

Re: machine.WDT does not appear to work

Posted: Wed Jul 27, 2022 6:56 am
by davef
like making it global
oops! I think you exposed a knowledge-gap. I have used global twice and didn't realise that it was needed in this context.
Thanks

Re: machine.WDT does not appear to work

Posted: Thu Jul 28, 2022 12:01 am
by bulletmark
@davef, It's likely not needed. I doubt Roberth mean't "global" as a keyword here. I suspect he mean't you need to ensure the wdt() instance is a singleton. I.e. in the function where you have wdt.feed() then the wdt instance does not need to be `global wdt`.