Error when using PPPoS to OTA update

pekarate
Posts: 2
Joined: Wed Feb 19, 2020 11:51 pm

Error when using PPPoS to OTA update

Postby pekarate » Sat Feb 22, 2020 9:55 am

I have a problem with OTA. I use sim module and PPPoS to update the software.If the file is downloaded, the download is successful, but when using the esp_ota_write function to download and write the file, I cannot download the file. tried using wifi, everything worked perfectly.
I have a problem with OTA. I use sim module and PPPoS to update the software.If the file is downloaded, the download is successful, but when using the esp_ota_write function to download and write the file, I cannot download the file. tried using wifi, everything worked perfectly.
err: esp_image: invalid segment length 0xffffffff

function OTA:
ota.c
(6.51 KiB) Downloaded 488 times
PPPos:
Uc_Sim.c
(28.26 KiB) Downloaded 501 times
--------------------------------------------------------------------------------------------------------------------------------------
Output when download and write:
I (23967) [OTA]: Starting OTA example...
I (23977) [OTA]: Running partition type 0 subtype 0 (offset 0x00010000)
I (24547) [OTA]: http ok,content-length:519616
I (24547) [OTA]: Writing to partition subtype 16 at offset 0x110000
I (24647) [OTA]: New firmware version: 1.1
I (24647) [OTA]: Running firmware version: 1.2
I (26977) [OTA]: esp_ota_begin succeeded
I (46307) [OTA]: recv total 8116
I (46307) [OTA]: Connection closed,all data received
I (46307) [OTA]: Total Write binary data length : 8116
I (46307) esp_image: segment 0: paddr=0x00110020 vaddr=0x3f400020 size=0x199ec (104940) map
E (46357) esp_image: invalid segment length 0xffffffff
E (46357) [OTA]: esp_ota_end failed (ESP_ERR_OTA_VALIDATE_FAILED)!
--------------------------------------------------------------------------------------------------------------------------------------
Output when only download (comment esp_ota_write function )

I (20847) [OTA]: Starting OTA example...
I (20857) [OTA]: Running partition type 0 subtype 0 (offset 0x00010000)
I (21437) [OTA]: http ok,content-length:519616
I (21437) [OTA]: Writing to partition subtype 16 at offset 0x110000
I (21537) [OTA]: New firmware version: 1.1
I (21537) [OTA]: Running firmware version: 1.2
I (23857) [OTA]: esp_ota_begin succeeded
I (73017) [OTA]: recv total 519616
I (73017) [OTA]: Connection closed,all data received
I (73017) [OTA]: Total Write binary data length : 519616


function OTA:
Uc_Sim.c
(28.26 KiB) Downloaded 501 times
PPPos:
Uc_Sim.c
(28.26 KiB) Downloaded 501 times
--------------------------------------------------------------------------------------------------------------------------------------
Output when download and write:
I (23967) [OTA]: Starting OTA example...
I (23977) [OTA]: Running partition type 0 subtype 0 (offset 0x00010000)
I (24547) [OTA]: http ok,content-length:519616
I (24547) [OTA]: Writing to partition subtype 16 at offset 0x110000
I (24647) [OTA]: New firmware version: 1.1
I (24647) [OTA]: Running firmware version: 1.2
I (26977) [OTA]: esp_ota_begin succeeded
I (46307) [OTA]: recv total 8116
I (46307) [OTA]: Connection closed,all data received
I (46307) [OTA]: Total Write binary data length : 8116
I (46307) esp_image: segment 0: paddr=0x00110020 vaddr=0x3f400020 size=0x199ec (104940) map
E (46357) esp_image: invalid segment length 0xffffffff
E (46357) [OTA]: esp_ota_end failed (ESP_ERR_OTA_VALIDATE_FAILED)!
--------------------------------------------------------------------------------------------------------------------------------------
Output when only download (comment esp_ota_write function )

I (20847) [OTA]: Starting OTA example...
I (20857) [OTA]: Running partition type 0 subtype 0 (offset 0x00010000)
I (21437) [OTA]: http ok,content-length:519616
I (21437) [OTA]: Writing to partition subtype 16 at offset 0x110000
I (21537) [OTA]: New firmware version: 1.1
I (21537) [OTA]: Running firmware version: 1.2
I (23857) [OTA]: esp_ota_begin succeeded
I (73017) [OTA]: recv total 519616
I (73017) [OTA]: Connection closed,all data received
I (73017) [OTA]: Total Write binary data length : 519616

duncairn
Posts: 8
Joined: Mon May 04, 2020 4:38 pm

Re: Error when using PPPoS to OTA update

Postby duncairn » Thu May 14, 2020 10:32 pm

Got exactly the same problem here with this. Talking to a GE310 via lwip PPPoS and the Telit cmux protocol, file downloads perfectly even with two other serial streams coexiting over the mux. Enable esp_ota_xxx() functions and the serial packets get corrupted.

It seems to me like a flow control issue, although if I fake a hang (five-second pause periodically doing nothing where the esp_ota_write() would be) there's still no problem downloading. Also, PPP should sort out any errors at the serial level. So perhaps it's because the ESP it actually halting when the write to flash occurs but, again, PPP should sort it out when things get going again. Can't see why WiFi works but PPPoS doesn't.

Did you find a solution eventually? I am considering rewriting the flash routines (in a local file) so that I can just pause everything when a flash write is going to occur, but that seems a bit of a brute force solution to fix some unknown cause, and no guarantee it's going to work.

duncairn
Posts: 8
Joined: Mon May 04, 2020 4:38 pm

Re: Error when using PPPoS to OTA update

Postby duncairn » Fri May 15, 2020 3:23 pm

Kind of fixed by setting the SPI flash implementation to 'legacy'.

Not a proper fix since there are still errors on the mux link, but they are recoverable. I think the problem with non-legacy SPI is just that the errors are more numerous and bigger, so not recoverable and hence the data loss.

Still love to know why writing to flash gives bad data on the serial link, though.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 63 guests