OTA firmware update error

Baldhead
Posts: 434
Joined: Sun Mar 31, 2019 5:16 am

OTA firmware update error

Postby Baldhead » Tue Jul 18, 2023 12:21 am

Hi,

I am implementing the example "advanced_https_ota_example" https://github.com/espressif/esp-idf/bl ... _example.c with some particular changes.

After ota app update at new partition( 0x1010000 ), appear this error message, and ESP32-S3 boot from old partition ( 0x20000 ).

Code: Select all

I (83) boot: Partition Table:
I (87) boot: ## Label            Usage          Type ST Offset   Length
I (94) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (102) boot:  1 otadata          OTA data         01 00 0000f000 00002000
I (109) boot:  2 ota_0            OTA app          00 10 00020000 00fe7000
I (117) boot:  3 ota_1            OTA app          00 11 01010000 00fe7000
I (124) boot: End of partition table
E (129) esp_image: image at 0x1010000 has invalid magic byte (nothing flashed here?)
E (137) boot: OTA app partition slot 1 is not bootable
I (143) esp_image: segment 0: paddr=00020020 vaddr=3c0c0020 size=8711ch (553244) map
I (239) esp_image: segment 1: paddr=000a7144 vaddr=3fc9ca00 size=053bch ( 21436) load
I (243) esp_image: segment 2: paddr=000ac508 vaddr=40378000 size=03b10h ( 15120) load
I (248) esp_image: segment 3: paddr=000b0020 vaddr=42000020 size=b73f8h (750584) map
I (372) esp_image: segment 4: paddr=00167420 vaddr=4037bb10 size=10e74h ( 69236) load
I (393) boot: Loaded app from partition at offset 0x20000
What can be the poblem ?

partitions_ota.csv file in annex.

Notes:
esp-idf v5.1
Chip: ESP32-S3R8V
Chip revision: v0.1
ESP-ROM:esp32s3-20210327 Build:Mar 27 2021
Dev board: ESP32-S3-DevKitC-1-N32R8V
Module: ESP32-S3-WROOM-2-N32R8V
Attachments
partitions_ota.csv
(319 Bytes) Downloaded 296 times

a2800276
Posts: 74
Joined: Sat Jan 23, 2016 1:59 pm

Re: OTA firmware update error

Postby a2800276 » Tue Jul 18, 2023 2:08 pm

It looks as though something went wrong during the upload. Can you provide the logs from the point in time you are uploading the replacement firmware?


How are you flashing the firmware bin file? Probably the web interface provided by the example? Which file are you flashing?

Baldhead
Posts: 434
Joined: Sun Mar 31, 2019 5:16 am

Re: OTA firmware update error

Postby Baldhead » Tue Jul 18, 2023 2:41 pm

a2800276 wrote:
Tue Jul 18, 2023 2:08 pm
It looks as though something went wrong during the upload. Can you provide the logs from the point in time you are uploading the replacement firmware?


How are you flashing the firmware bin file? Probably the web interface provided by the example? Which file are you flashing?
As soon as i can i will send the logs, however, the message says "ota finish", which looks like the process went correctly.

I configured the apache server (i use xampp). The binary file i take in the project's build folder.

Baldhead
Posts: 434
Joined: Sun Mar 31, 2019 5:16 am

Re: OTA firmware update error

Postby Baldhead » Tue Jul 18, 2023 6:47 pm

I downloaded the binary file through the chrome browser(through local apache server) and compared it with the file in the project's build folder and the files are identical.

I would like to compare with the file that esp32 write in the flash memory( firmware downloaded through ota ).

How do i download this partition (0x1010000) from the ESP32 flash memory ( using serial wire ) ?

Something like this:

Code: Select all

esptool.py -p PORT -b 115200 read_flash 0 0x400000 firmware.bin
EDIT:

I downloaded the file this way:

Code: Select all

PS C:\esp32-Proj\WSS_SERVER_AND_UI_INTEGRATION_S3_12-12-2022> C:\.espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe c:\esp-idf\components\esptool_py\esptool\esptool.py -p COM11 -b 115200 read_flash 0x1010000 0x1582A0 firmware.bin                        
esptool.py v4.6.2                               
Serial port COM11
Connecting....
Detecting chip type... ESP32-S3
Chip is ESP32-S3 (revision v0.1)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 7c:df:a1:e1:1d:84
Uploading stub...
Running stub...
Stub running...
WARNING: Flasher stub doesn't fully support flash size larger than 16MB, in case of failure use --no-stub.
1409696 (100 %)
1409696 (100 %)
Read 1409696 bytes at 0x01010000 in 132.0 seconds (85.4 kbit/s)...
Hard resetting via RTS pin...
PS C:\esp32-Proj\WSS_SERVER_AND_UI_INTEGRATION_S3_12-12-2022>

I compared the file downloaded from ESP32-S3(by serial wire) with the file downloaded from the apache server through the chrome browser and the two files are the same.

Maybe the size of flash memory with 32MB is not supported ?!

Note:
I erased the entire flash memory with: idf.py erase-flash

Baldhead
Posts: 434
Joined: Sun Mar 31, 2019 5:16 am

Re: OTA firmware update error

Postby Baldhead » Thu Jul 20, 2023 1:44 am

Some suggestion espressif team ???
Last edited by Baldhead on Thu Jul 20, 2023 6:23 pm, edited 1 time in total.

Baldhead
Posts: 434
Joined: Sun Mar 31, 2019 5:16 am

Re: OTA firmware update error

Postby Baldhead » Thu Jul 20, 2023 6:23 pm

@ESP_Sprite,

Some suggestion ???

Baldhead
Posts: 434
Joined: Sun Mar 31, 2019 5:16 am

Re: OTA firmware update error

Postby Baldhead » Fri Jul 21, 2023 12:37 am

The problem, i think, is flash memory size ( 32MB ).

I changed the partition table to address below 16MB and it worked( csv file in annex ).

How to make it work for addresses above 16MB too ???

Code: Select all

I (83) boot: Partition Table:
I (87) boot: ## Label            Usage          Type ST Offset   Length
I (94) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (102) boot:  1 otadata          OTA data         01 00 0000f000 00002000
I (109) boot:  2 ota_0            OTA app          00 10 00020000 00200000
I (117) boot:  3 ota_1            OTA app          00 11 00220000 00200000
I (124) boot: End of partition table
I (129) esp_image: segment 0: paddr=00220020 vaddr=3c0c0020 size=8711ch (553244) map
I (225) esp_image: segment 1: paddr=002a7144 vaddr=3fc9cb00 size=05444h ( 21572) load
I (229) esp_image: segment 2: paddr=002ac590 vaddr=40378000 size=03a88h ( 14984) load
I (233) esp_image: segment 3: paddr=002b0020 vaddr=42000020 size=b73f8h (750584) map
I (358) esp_image: segment 4: paddr=00367420 vaddr=4037ba88 size=10fach ( 69548) load
I (379) boot: Loaded app from partition at offset 0x220000
Another doubt:

How do i configure ota to flash 4096 bytes (1 sector) at a time ?
Is it possible ?

Currently the ota is writing 1024 bytes at a time.

Code: Select all

FUNCTION: ota_event_handler
I (89246) MY_OTA: Writing to flash: 1024 written
I (89268) MY_OTA: FUNCTION: ota_event_handler
I (89271) MY_OTA: Writing to flash: 2048 written
I (89293) MY_OTA: FUNCTION: ota_event_handler
I (89293) MY_OTA: Writing to flash: 3072 written
I (89299) MY_OTA: FUNCTION: ota_event_handler
I (89305) MY_OTA: Writing to flash: 4096 written
I (89311) MY_OTA: FUNCTION: ota_event_handler
I (89317) MY_OTA: Writing to flash: 5120 written
I (89323) MY_OTA: FUNCTION: ota_event_handler
I (89346) MY_OTA: Writing to flash: 6144 written
I (89346) MY_OTA: FUNCTION: ota_event_handler
I (89370) MY_OTA: Writing to flash: 7168 written
I (89370) MY_OTA: FUNCTION: ota_event_handler
I (89376) MY_OTA: Writing to flash: 8192 written
.
.
.
Attachments
partitions_ota_updated.csv
(311 Bytes) Downloaded 390 times

ESP_Mahavir
Posts: 188
Joined: Wed Jan 24, 2018 6:51 am

Re: OTA firmware update error

Postby ESP_Mahavir » Fri Jul 21, 2023 8:42 am

How do i configure ota to flash 4096 bytes (1 sector) at a time ?

Please try setting `buffer_size` field to 4096 value from `esp_http_client_config_t` structure during OTA updates initialization.

Ref: https://github.com/espressif/esp-idf/bl ... ple.c#L127

HTH!

Baldhead
Posts: 434
Joined: Sun Mar 31, 2019 5:16 am

Re: OTA firmware update error

Postby Baldhead » Fri Jul 21, 2023 8:17 pm

ESP_Mahavir wrote:
Fri Jul 21, 2023 8:42 am
How do i configure ota to flash 4096 bytes (1 sector) at a time ?

Please try setting `buffer_size` field to 4096 value from `esp_http_client_config_t` structure during OTA updates initialization.

Ref: https://github.com/espressif/esp-idf/bl ... ple.c#L127

HTH!
Hi @ESP_Mahavir,

Worked, thank's.

I found it strange that the first write was with 1024 bytes.
All other writes were 4096 bytes, except of course the last write (if the image size is not divisible by 4096).

Code: Select all

I (97026) MY_OTA: FUNCTION: ota_event_handler
I (97026) MY_OTA: FUNCTION: validate_image_header
I (97032) MY_OTA: Reading Image Description
I (97038) MY_OTA: Running firmware version: 1
I (97048) MY_OTA: FUNCTION: ota_event_handler
I (97071) MY_OTA: Verifying chip id of new image: 9
I (97073) MY_OTA: FUNCTION: ota_event_handler
I (97096) MY_OTA: Writing to flash: 1024 written
I (97103) MY_OTA: FUNCTION: ota_event_handler
I (97103) MY_OTA: Writing to flash: 5120 written
I (97162) MY_OTA: FUNCTION: ota_event_handler
I (97185) MY_OTA: Writing to flash: 9216 written
I (97192) MY_OTA: FUNCTION: ota_event_handler
I (97215) MY_OTA: Writing to flash: 13312 written
I (97222) MY_OTA: FUNCTION: ota_event_handler
I (97243) MY_OTA: Writing to flash: 17408 written
I (97250) MY_OTA: FUNCTION: ota_event_handler
I (97250) MY_OTA: Writing to flash: 21504 written
I (97308) MY_OTA: FUNCTION: ota_event_handler
I (97331) MY_OTA: Writing to flash: 25600 written
I (97338) MY_OTA: FUNCTION: ota_event_handler
I (97361) KEEP_ALIVE: Client 57 = 4 seg
I (97361) MY_OTA: Writing to flash: 29696 written
I (97368) MY_OTA: FUNCTION: ota_event_handler
I (97390) MY_OTA: Writing to flash: 33792 written
I (97397) MY_OTA: FUNCTION: ota_event_handler
I (97397) MY_OTA: Writing to flash: 37888 written
I (97457) MY_OTA: FUNCTION: ota_event_handler
I (97481) MY_OTA: Writing to flash: 41984 written

Baldhead
Posts: 434
Joined: Sun Mar 31, 2019 5:16 am

Re: OTA firmware update error

Postby Baldhead » Fri Jul 21, 2023 8:23 pm

Hi @ESP_Mahavir,

Do you have any solution for the main problem ???
The problem, i think, is flash memory size ( 32MB ).

I changed the partition table to address below 16MB and it worked( csv file in annex ).

How to make it work for addresses above 16MB too ???

Who is online

Users browsing this forum: No registered users and 228 guests