Page 1 of 1

ESP32 OTA

Posted: Thu Jun 13, 2024 4:00 pm
by gl819aq
I implemented the ability to do Firmware OTA using esp_https_ota using the code below.

The problem is that once it starts writing to flash, I'm getting a TG0WDT_SYS_RST. Sometimes the write to the flash just seems to hang after some writes.

I don't know what's wrong and how to debug it.

Do I pet this watchdog during the download? I have a callback with ESP_HTTPS_OTA_WRITE_FLASH that I could use, but haven't found out how to pet the watchdog properly.


Code: Select all

esp_err_t ret = esp_https_ota(&ota_config);

Code: Select all

[0:00:26.000] [OTA] OTA started

I (28108) esp-x509-crt-bundle: Certificate validated
[0:00:27.000] [LED] Off Timer Timeout
[0:00:27.000] [SYS] Setting LED 0 0 0 0
I (28898) HTTP_CLIENT: Body received in fetch header state, 0x3fcf2d0f, 261
I (28898) esp_https_ota: Starting OTA...
[0:00:27.000] [OTA] Connected to server
I (28898) esp_https_ota: Writing to partition subtype 17 at offset 0x220000
[0:00:27.000] [OTA] Verifying chip id of new image: 9
[0:00:27.000] [OTA]  Writing to flash: 2048 written
[0:00:27.000] [OTA]  Writing to flash: 3072 written
[0:00:27.000] [OTA]  Writing to flash: 4096 written
[0:00:27.000] [OTA]  Writing to flash: 5120 written
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)