ESP8266 Developer Zone The Official ESP8266 Forum 2017-06-05T20:12:43+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=4906 2017-06-05T20:12:43+08:00 2017-06-05T20:12:43+08:00 https://bbs.espressif.com:443/viewtopic.php?t=4906&p=13707#p13707 <![CDATA[Re: ESP8266 OTA upgrade failed]]> Statistics: Posted by tidyjiang8 — Mon Jun 05, 2017 8:12 pm


]]>
2017-06-05T16:30:03+08:00 2017-06-05T16:23:30+08:00 https://bbs.espressif.com:443/viewtopic.php?t=4906&p=13705#p13705 <![CDATA[Re: ESP8266 OTA upgrade failed]]>
Her Majesty wrote:

Code:

flash_crc = 3875536896
img_crc = 395549339

The image crc (image download from internet) and the flash crc (image write into flash) are not equal.
Maybe you can dump flash to check the image in flash whether it is the user1.bin/user2.bin.


Thanks for your response.
I have dumped the flash @0x81000 to PC via esptool.py, and compare it with my original user2.bin via beyond compare, it's the same.
I do not know what's incorrect.

Besides, I just now compared the user1.bin and user2.bin, it's same too, is this what it should be ?

Statistics: Posted by tidyjiang8 — Mon Jun 05, 2017 4:23 pm


]]>
2017-06-05T10:25:08+08:00 2017-06-05T10:25:08+08:00 https://bbs.espressif.com:443/viewtopic.php?t=4906&p=13699#p13699 <![CDATA[Re: ESP8266 OTA upgrade failed]]>

Code:

flash_crc = 3875536896
img_crc = 395549339

The image crc (image download from internet) and the flash crc (image write into flash) are not equal.
Maybe you can dump flash to check the image in flash whether it is the user1.bin/user2.bin.

Statistics: Posted by Her Mary — Mon Jun 05, 2017 10:25 am


]]>
2017-06-04T12:00:26+08:00 2017-06-04T12:00:26+08:00 https://bbs.espressif.com:443/viewtopic.php?t=4906&p=13676#p13676 <![CDATA[ESP8266 OTA upgrade failed]]>
I'm using custom server to upgrade esp8266. I can download image from server, but always upgrade failed.

I download the following .bin files to the flash(Before download, I erase the whole flash):

Code:

------------ 2 MByte flash   ------------
0x0           -----  boot_v1.6.bin
0x1000     -----  user1.bin
0x1fb000  -----  blank.bin
0x1fc000  -----  esp_init_data_default.bin
0x1fe000  -----  blank.bin


Here are my log:

Code:

GET /test/user2.bin HTTP/1.0
Host: 192.168.1.113:8292

sumlength = 236224
upgrade file download start.
totallen = 1460
entry smartconfig >>>
A0 A4
SmartConfig OK
totallen = 2920
totallen = 4380
。。。
totallen = 235060
totallen = 236224
upgrade file download finished.
flash_crc = 3875536896
img_crc = 395549339
upgrade_check
ota_upgrade_rsp failed


It seems that the CRC value is error. But I don't know why. And I have checked the CRC in my ubuntu, it's another value:

Code:

work@ubuntu:~/esp/Scent/bin/test$ ls
user1.bin  user2.bin
work@ubuntu:~/esp/Scent/bin/test$ cksum user2.bin
68439177 236224 user2.bin
work@ubuntu:~/esp/Scent/bin/test$


And it's my upgrade code:

Code:


LOCAL void ICACHE_FLASH_ATTR
ota_upgrade_rsp(void *arg)
{
    struct upgrade_server_info *server = arg;
    if (server->upgrade_flag == true)
   {
       // TODO write new version.
       os_printf("user_esp_platform_upgrade_successful\n");
      os_printf("system_upgrade_reboot\n");
        system_param_save_with_protect(ESP_PARAM_START_SEC, &now, sizeof(firmware_version_t));
      system_upgrade_reboot();
    }
   else
    {
        os_printf("ota_upgrade_rsp failed\n");
    }

    os_free(server->url);
    server->url = NULL;
    os_free(server);
    server = NULL;
}


LOCAL void ICACHE_FLASH_ATTR
ota_upgrade_begin(struct espconn *pespconn)
{
    uint8 user_bin[9] = {0};
    uint8 devkey[41] = "No Device key";
    struct upgrade_server_info *server = NULL;

   os_printf("user_ota_upgrade_begin...\n");

    server = (struct upgrade_server_info *)os_zalloc(sizeof(struct upgrade_server_info));

    server->pespconn = pespconn;
    const char remote_ip[4] = {192, 168, 1, 113};
    os_memcpy(server->ip, remote_ip, 4);
    server->port = 8292;

    server->check_cb = ota_upgrade_rsp;
    server->check_times = 120000;

    if (server->url == NULL) {
        server->url = (uint8 *)os_zalloc(512);
    }

    if (system_upgrade_userbin_check() == UPGRADE_FW_BIN1) {
        os_memcpy(user_bin, "user2.bin", 10);
    } else if (system_upgrade_userbin_check() == UPGRADE_FW_BIN2) {
        os_memcpy(user_bin, "user1.bin", 10);
    }
   
    os_sprintf(server->url, "GET /test/%s HTTP/1.0\r\nHost: "IPSTR":%d\r\n\r\n",
                user_bin, IP2STR(server->ip), server->port);
   
    os_printf("%s\n",server->url);

    if (system_upgrade_start(server) == false) {
        os_printf("upgrade is already started\n");
    }
}



Need you all help.
Thanks.

Statistics: Posted by tidyjiang8 — Sun Jun 04, 2017 12:00 pm


]]>