[error] An issue on ZDM FOTA


Is there any good news?
I’m waiting for your update.

hi @Anatoli_Juny
I test the watchdog and ZDM communication examples with and without kicking the watchdog.
It seems there is a bug if we set the watchdog for 5 or 10 hours, however if you set it for a short period, 20 seconds or a minute, It works as expected without resets.
For your application can you set the watchdog to short period of time ( depending on your application) and kick it periodically? because realistically very long watchdogs are useless, the watchdog is used to ensure proper software execution so if the MCU stuck it resets.

In the meantime we will investigate the watchdog issue more and work on it.

Hi @karimhamdy1
Thanks for your help.
I’ll test WDT and ZDM with a short period of time(5 minutes or 10 minutes) and periodical kicking.
Due to the nature of our application, it is not reasonable to set a short period for WDT. (20 seconds or a minute). We need to set it at least 5 minutes.
In our application, MQTT, HTTP, and UART communication are also used. What I’m concerned about is whether regular or irregular reboots and slow computations will occur when all these features are enabled. Those cases are very negative for our application. Actually this is the basic reason for posting this thread to Community. Realistically it appeared in the test process on both Fota enabled secure VM and non-secure VM.
Of course, I set the long period of WDT.
For now, I’ll test the watchdog with a short period (10 minutes) and ZDM only. If it works properly for a long time without reboot, I’ll add the features one by one. So I’ll see how it works.
I’ll keep you updating.


Hi @karimhamdy1 @Matteo_Cipriani

I did two tests for WDT and ZDM. In the first test, I set the watchdog for 10 minutes.(kick ran every 10 seconds). In the second test, I set the watchdog for 5 minutes.(kick ran every 5 seconds)
But my custom board and esp32 devkitC rebooted in about three hours and 45 minutes.
I’ll test it again with a shorter period time.(3 minutes)

I tested ZDM and WDT with 3 minutes period of time. Kick function ran every 5 seconds.
ESP32 devkitC rebooted in three hours and 50 minutes.
I’m wondering why reboots didn’t happen on your side.
I’ll set WDT’s timeout to 1 minutes and test it again.

Even though WDT’s timeout was set to 1 minute, ESP32 rebooted in four hours.
I remember that esp32 rebooted in 4 hours and 30 minutes when timeout was set to 5 hours.
The test results above tell us that the short period did not prevent the reboot.
It reboots more quickly than when wdt is set to a long period.
Very strange! Can you send me your test code?

Hi @karimhamdy1 @Matteo_Cipriani
Did you check my test results?
Could you please send me the test code for zdm and wdt that you have confirmed that the reboot does not occur?


Is there any update for this thread?
I’m very looking forward to your help for this problem. :pleading_face:

Hi @Anatoli_Juny
We tested thoroughly the ZDM simple example with the watchdog being kicked every 5 seconds, and there is not resets or reboots or any un-expected behavior on standard ESP32-based boards like the doit esp32 devkit.
The only thing that is different is that in our tests we had a short watchdog window (30 seconds - 2 min) minutes.

If you want to replicate our test, clone the zdm simple and enable watchdog for 30 seconds and kick it every 5 seconds in the infinite loop.

you need to be sure that the problem is from the watchdog timer, not from any other software component, like the rtc or the ntp request or the mqtt or any other component used.
Also because we have products that are sold and deployed that are running on ZDM and using watchdog and doesn’t have this reset behavior.

Let me know if you are sure that the reset happens only when using the watchdog, then we can figure out how to handle this for your development.

Hi @karimhamdy1 @Matteo_Cipriani
Thanks for your help.
Have you seen the detailed test results I previously reported? I already tested the ZDM example with the watchdog being kicked every 5 seconds.(watchdog window: 1min - 5min)

Here is the test code I used. Except for ZDM and watchdog, it did not contain any sw components.

from wireless import wifi
from espressif.esp32net import esp32wifi as wifi_driver
import streams
from zdm import zdm
import sfw


# check for reset reason
    print("Watchdog triggered: ", sfw.watchdog_triggered())
except Exception as e:
    print("Watchdog not supported by this virtual Machine!")
    while True:

# Configure watchdog in normal mode with 1 minute timeout
sfw.watchdog(0, 60000)
print("Configuring watchdog to 1 minutes timeout")

def fota_callback(fw_version):      
    print("Fota callback called with firmware version: ", fw_version)
    return True

def sta_mode():        
    # use the wifi interface to link to the Access Point
    # change network name, security and password as needed
    print("Establishing WiFi Link...")
    for retry in range(5):
            wifi.link("XXXXXXXXXX", wifi.WIFI_WPA2, "XXXXXXXX")
        except Exception as e:
        print("Can't connect to wifi.")
        # raise IOError

    device = zdm.Device(fota_callback=fota_callback)
    print("Connecting to ZDM....")

    while True:         
except Exception as e:
    print("main", e)

Can you check it? If there is no difference with your test code, it doesn’t really make sense.
I used esp32 DevkitC. We use the same code. Why does the reboot only happen on my side? Could it be? I am very confused. :sweat:

Hi @karimhamdy1 @Matteo_Cipriani

Did you have a chance to look at my test code?
Could you please send me your watchdog test code with ZDM feature only?
I want to test your code that doesn’t happen any reboot on my side.


Hi @karimhamdy1 @karimhamdy1
How is it going? Did you check my test code?
I haven’t found any issue on it, but ESP32 DevkitC reboots periodically (about 4 hours and 30 minutes).
I hope you test my code on your side. Or can you send me your test code that happened any reboot?
I’m looking forward to your next reply.
Thanks in advance.

hi @Anatoli_Juny
Please send us an email on our help desk.
We will follow this over emails with the dev team.

Hi @karimhamdy1
Thanks for your help.
I sent an email to helpdesk.

Request details
Date submitted: 07/05/21
Reference number: 404743770
Issue: ZDM FOTA issue on Fota enabled and Firmware Secured VM
Issue description: Hi, I’m Anatoli Juny. I’m developing an IoT device with ESP32 WROOM module. I’m using ESP32 DevkitC for the development. Here is a detailed explanation of the issue I am struggling with. I added ZDM Fota feature to my firmware and it works. However, the board slows down over time and reboots about every 20 minutes. The board sends periodically the data to the server via http request and receives commands from the server via MQTT protocol. If I disable ZDM Fota, then everything works reliably. However, if ZDM fota is enables, the board works properly for the first time and then reboots after 15 minutes, and reboots occur even when data is transmitted through http request while it is running. I installed Fota enable and FW secure enabled on esp32. The WDT window is set to 2 minutes and kick function runs periodically. I’ve been struggling with this for months and have been specifically updating my tests to solve it in the zerynth community. Karimhamdy and Matteo advised me to start with a simple sample with only WDT and ZDM functions and add the functions one by one to find the exact cause. According to their advisement, I tested a sample with only WDT and ZDM. However, the reboot problem still appeared. Here are all the tests related to that. Please check it. https://community.zerynth.com/t/error-an-issue-on-zdm-fota/3473 The operating speed is important factor in my application and the board should work stably for a long period of time without rebooting. Also, Fota is one of the important requirements. I haven’t been able to solve this for months, so I haven’t been able to decide whether to actually use the zdm fota feature on my application or not I really hope you can suggest a good solution to solve this. As I again, please check this thread. https://community.zerynth.com/t/error-an-issue-on-zdm-fota/3473 Thanks in advance. Anatoli.