write_flash for big app takes too long and external watchdog IC resets chip

taherrera
Posts: 4
Joined: Fri Feb 09, 2024 12:52 am

write_flash for big app takes too long and external watchdog IC resets chip

Postby taherrera » Tue Nov 12, 2024 9:55 pm

Hello,

I have attached to the reset gpio of the ESP32 to the mcu monitor TPS3828-33. And have XOR'ed GPIO12 and the RX pin of the ESP32 to the WDI pin of this IC. The RX pin is connected so that I can hopefully upload the firmware to the ESP32. This IC resets the ESP32 if there is no movement on the WDI pin for more than 1.6 seconds.

The thing is that for small binaries (< 1MB) I can upload the firmware with no issues, however if I upload a firmware that is big (> 1MB) I suspect it fails during the md5 hash calculation after writing the binary because it takes longer than the 1.6 seconds. If I disconnect the monitor IC from the reset gpio (by unsoldering a resistor that connects #RST of the IC to the reset of the ESP32), it uploads just fine.

When uploading a small app (with IC connected) it executes successfully:

Code: Select all

esptool.py -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x20000 ../v5/build/main.bin
esptool.py v3.1-dev
Serial port /dev/ttyUSB0
Connecting.....
Detecting chip type... ESP32
Chip is ESP32-D0WD (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 30:c9:22:f8:c0:e8
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00020000 to 0x000f9fff...
Compressed 892480 bytes to 560501...
Wrote 892480 bytes (560501 compressed) at 0x00020000 in 13.1 seconds (effective 545.2 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
But uploading a Big app (with IC connected) results in error:

Code: Select all

esptool.py -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x20000 build/main.bin
esptool.py v3.1-dev
Serial port /dev/ttyUSB0
Connecting.....
Detecting chip type... ESP32
Chip is ESP32-D0WD (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 30:c9:22:f8:c0:e8
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00020000 to 0x0011dfff...
Compressed 1038928 bytes to 631037...
Wrote 1038928 bytes (631037 compressed) at 0x00020000 in 14.9 seconds (effective 557.8 kbit/s)...

A fatal error occurred: Timed out waiting for packet content
The firmware uploads just fine even though it fails with a timeout, I know this because the application starts although it could not verify the hash.

So my question is, what can I do to avoid the "fatal error" while uploading big binaries ? It seems I cannot disable the hash verification with esptool which I suspect is the process that takes long and holds the chip with no incoming RXD communication. I tried using higher upload speeds. I also tried using 80MHz flash_freq and QIO instead of DIO but nothing seems to make the process faster.

Who is online

Users browsing this forum: No registered users and 200 guests