v4.1-dev https_OTA is not working

chadpham75
Posts: 48
Joined: Thu Sep 12, 2019 11:39 am

v4.1-dev https_OTA is not working

Postby chadpham75 » Wed Jan 08, 2020 8:20 am

Hi guys,
I think the v4.1-dev has an issue with OTA.
I am using version v4.1-dev-1770-g71b4768df-dirty.
Previously, I tested the version v4.0-beta2, and the simple_ota_example is working correctly when I followed this https://github.com/espressif/esp-idf/tr ... system/ota

Due to the problem of secure boot and flash encryption, I have to use version v4.1-dev, and it broke my OTA code.
I went back the example and ran it it is also broke.
I (4120) simple_ota_example: Starting OTA example
I (5830) esp_https_ota: Starting OTA...
I (5830) esp_https_ota: Writing to partition subtype 16 at offset 0x110000
D (11600) HTTP_CLIENT: esp_transport_read returned:-1 and errno:128
E (11610) esp_https_ota: Connection closed3, errno = 80
I (11610) esp_image: segment 0: paddr=0x00110020 vaddr=0x3f400020 size=0x04bd8 ( 19416) map
I (11620) esp_image: segment 1: paddr=0x00114c00 vaddr=0x3ffb0000 size=0x01940 ( 6464)
I (11620) esp_image: segment 2: paddr=0x00116548 vaddr=0x40080000 size=0x00404 ( 1028)
0x40080000: _WindowOverflow4 at C:/esplatest/esp-idf/components/freertos/xtensa_vectors.S:1778

I (11630) esp_image: segment 3: paddr=0x00116954 vaddr=0x40080404 size=0x08bcc ( 35788)
I (11650) esp_image: segment 4: paddr=0x0011f528 vaddr=0x00000000 size=0x00af0 ( 2800)
I (11650) esp_image: segment 5: paddr=0x00120020 vaddr=0x400d0020 size=0x12800 ( 75776) map
0x400d0020: _stext at ??:?

E (11690) simple_ota_example: Firmware upgrade failed

I tried to trace back where the error was I saw the code

Code: Select all

        case ESP_HTTPS_OTA_IN_PROGRESS:
            data_read = esp_http_client_read(handle->http_client,
                                             handle->ota_upgrade_buf,
                                             handle->ota_upgrade_buf_size);
            if (data_read == 0) {
                /*
                 * As esp_http_client_read never returns negative error code, we rely on
                 * `errno` to check for underlying transport connectivity closure if any
                 */
                if (errno == ENOTCONN || errno == ECONNRESET) {
                    ESP_LOGE(TAG, "Connection closed3, errno = %x", errno);
                    return ESP_FAIL;
                }
From the debug log, I could see the size that the module received is 141,272 which is 120 bytes less than the source hello-world.bin is 141,392 bytes.

I found ENOTCONN = 126 and ECONNRESET=108; neither of these was 128. Is there anything that miss? I don't understand since the errno should not return ESP_FAIL.

I also found #define ENOTSOCK 128 from header file errno.h, which is "Socket operation on non-socket" that is not in the directory of the project.
Please let me know if you encounter the same issue and please suggest where can I go next to fix the problem.

kkentzo
Posts: 1
Joined: Wed Jan 22, 2020 8:56 am

Re: v4.1-dev https_OTA is not working

Postby kkentzo » Wed Jan 22, 2020 9:09 am

I am facing the same issue using esp-idf's master branch tip.

Has this issue been resolved and, if yes, how? Are others facing the same issue?

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

Re: v4.1-dev https_OTA is not working

Postby ESP_Mahavir » Wed Jan 22, 2020 2:22 pm

Is it possible to share more information, especially server configuration, data format (chunked or non-chunked)? Additional information to help us reproduce this at our end would be very useful.

chadpham75
Posts: 48
Joined: Thu Sep 12, 2019 11:39 am

Re: v4.1-dev https_OTA is not working

Postby chadpham75 » Fri Jan 24, 2020 4:03 am

@ESP-MJ, please follow exactly the instruction by Espressif here https://github.com/espressif/esp-idf/tr ... system/ota
There is nothing else need to be done differently with self-sign server setup, the only thing change is the SDK between v4.0-beta1 vs. v4.1-dev

@kkentzo,
I gave up in v4.1-dev since there was no leads/helps at all since I posted the info. Good news is I go back to v4.0-rc, it is working on that version. If you don't need any additional feature in v4.1-dev offers. I tested v4.0-rc and it is working.

ESP_Shubham
Posts: 8
Joined: Mon Oct 07, 2019 6:09 am

Re: v4.1-dev https_OTA is not working

Postby ESP_Shubham » Fri Jan 24, 2020 8:31 am

@chadpham75 @kkentzo Thanks for reporting this issue.
We could reproduce this issue on our side.
I'm attaching a patch which should fix the issue. Can you please apply the patch and retry the example?
Attachments
Fix-OTA-for-chunked-servers.patch.zip
(981 Bytes) Downloaded 1027 times

axellin
Posts: 200
Joined: Mon Sep 17, 2018 9:09 am

Re: v4.1-dev https_OTA is not working

Postby axellin » Tue Jan 28, 2020 3:58 am

Hi @ESP_Shubham

It's difficult to trace and collect the patches from the forum.
Can you please commit and push it since you already can reproduce the issue.
I think it's commit 032a04139518 ("Bugfix for failing OTA example") causes the regression.

murbancic
Posts: 2
Joined: Thu Jan 30, 2020 7:57 am

Re: v4.1-dev https_OTA is not working

Postby murbancic » Thu Jan 30, 2020 8:00 am

I have same problem too.
The patch you provided works for me.
Thanks

PeTroX
Posts: 1
Joined: Wed Feb 26, 2020 11:21 pm

Re: v4.1-dev https_OTA is not working

Postby PeTroX » Wed Feb 26, 2020 11:22 pm

I had the same issue on branch : v4.1-dev-2055-gf5b82c5b1
The patch solved me aswell.
Thanks

Who is online

Users browsing this forum: No registered users and 106 guests