Error on FOTA (ESP8266_NONOS_SDK_V2.0.0_16_08_10)

paulobionica
Posts: 1
Joined: Tue Dec 20, 2016 11:35 pm

Error on FOTA (ESP8266_NONOS_SDK_V2.0.0_16_08_10)

Postby paulobionica » Tue Dec 20, 2016 11:49 pm

I can update the firmware only once from user1 to user2 when I try to update the second time the code hangs.

command to write code on flash:

Code: Select all

esptool.py \
   --port /dev/ttyUSB0 \
   --baud 115200  \
   write_flash --flash_freq 40m --flash_mode qio --flash_size 32m --verify \
   0x7E000 master_device_key.bin \
   0x3FE000 blank.bin \
   0x3FC000 esp_init_data_default.bin \
   0x00000 boot_v1.6.bin \
   0x01000 upgrade/user1.1024.new.2.bin


command to compile code user1:

Code: Select all

make COMPILE=gcc BOOT=new APP=1 SPI_SPEED=40 SPI_MODE=QIO SPI_SIZE_MAP=2


command to compile code user2:

Code: Select all

make COMPILE=gcc BOOT=new APP=2 SPI_SPEED=40 SPI_MODE=QIO SPI_SIZE_MAP=2


my code is:

Code: Select all

void user_bionica_upgrade_rsp(void *arg)
{
    struct upgrade_server_info *server = arg;
   
    if( server->url != NULL){
         os_free(server->url);
    }
    if (server->upgrade_flag == true) {
        os_printf("update sucess!\r\n");
        system_upgrade_reboot();
    }
    else{
        os_printf("update failed! :(\r\n");
    }
   
}

void user_bionica_upgrate_begin(struct espconn *pespconn,
   struct upgrade_server_info *server)
{
   uint8 error = 0;
   uint8 user_bin[10] = {0};
    uint8 devkey[41] = {0};

    server->pespconn = pespconn;

    os_memcpy(server->ip, pespconn->proto.tcp->remote_ip, 4);
    server->port = BIONICA_PORT;

    server->check_cb = user_bionica_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);
        os_printf("user1.bin na memoria\r\n");
    } else if (system_upgrade_userbin_check() == UPGRADE_FW_BIN2) {
        os_memcpy(user_bin, "user1.bin", 10);
        os_printf("user2.bin na memoria\r\n");
    }

    os_sprintf(server->url, "GET /%s HTTP/1.1\r\n"
    "Host: "IPSTR":%d\r\n"
    "Connection: keep-alive\r\n"
    "Cache-Control: no-cache\r\n"
    "User-Agent: esp8266\r\n"
    "Accept: */*\r\n\r\n",
    user_bin, IP2STR(server->ip), server->port);

    os_printf("url: %s", server->url);

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

void upgrade_test(uint8 status)
{
   uint8 error;
   LOCAL struct espconn esp_conn;
   LOCAL esp_tcp esptcp;
   LOCAL struct upgrade_server_info server;
    const char ipaddr[] = {172,26,70,40};

    if(status == STATION_GOT_IP){
       esp_conn.type = ESPCONN_TCP;
       esp_conn.state = ESPCONN_NONE;
       esp_conn.proto.tcp = &esptcp;
       esp_conn.proto.tcp->remote_port = BIONICA_PORT;
        esp_conn.proto.tcp->local_port = espconn_port();
       os_memcpy(esp_conn.proto.tcp->remote_ip, ipaddr,4);
        user_bionica_upgrate_begin(&esp_conn , &server);
    }
    else {
        os_printf("NOT_CONNECTED");
    }
}


the output of serial:

Code: Select all

 
ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 2408, room 16
tail 8
chksum 0xe5
load 0x3ffe8000, len 776, room 0
tail 8
chksum 0x84
load 0x3ffe8310, len 632, room 0
tail 8
chksum 0xd8
csum 0xd8

2nd boot version : 1.6
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 32Mbit(512KB+512KB)
jump to run user1 @ 1000

rf cal sector: 1019
rf[112WIFI_INIT
mode : sta(5c:cf:7f:0b:09:ba)
add if0
::: hardware reset
Wi-Fi station default configuration in flash.
ssid: [SuporteTemp]
os_strlen(ssid): [11]
pass: [columbus]
Success on wifi_station_set_config
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 3
cnt

connected with SuporteTemp, channel 11
dhcp client start...
STATION_IDLE
NOT_CONNECTEDSTATION_IDLE
ip:172.26.69.57,mask:255.255.248.0,gw:172.26.64.1
user1.bin na memoria
url: GET /user2.bin HTTP/1.1
Host: 172.26.70.40:80
Connection: keep-alive
Cache-Control: no-cache
User-Agent: esp8266
Accept: */*

system_upgrade_start
upgrade_connect 49632
upgrade_connect_cb
pusrdata = HTTP/1.1 200 OK
Date: Tue, 20 Dec 2016 15:06:15 GMT
Server: Apache/2.4.10 (Debian)
Last-Modified: Tue, 20 Dec 2016 14:07:56 GMT
ETag: "39884-54417901d2ed8"
Accept-Ranges: bytes
Content-Length: 235652
Connection: close
Content-Type: application/octet-stream


sumlength = 235652
sec_block 58
..........................................................upgrade_get_sum_disconcb 47200
erase sector=129 ok
erase sector=130 ok
erase sector=131 ok
erase sector=132 ok
erase sector=133 ok
erase sector=134 ok
erase sector=135 ok
erase sector=136 ok
erase sector=137 ok
erase sector=138 ok
erase sector=139 ok
erase sector=140 ok
erase sector=141 ok
erase sector=142 ok
erase sector=143 ok
erase sector=144 ok
erase sector=145 ok
erase sector=146 ok
erase sector=147 ok
erase sector=148 ok
erase sector=149 ok
erase sector=150 ok
erase sector=151 ok
erase sector=152 ok
erase sector=153 ok
erase sector=154 ok
erase sector=155 ok
erase sector=156 ok
erase sector=157 ok
erase sector=158 ok
erase sector=159 ok
erase sector=160 ok
erase sector=161 ok
erase sector=162 ok
erase sector=163 ok
erase sector=164 ok
erase sector=165 ok
erase sector=166 ok
erase sector=167 ok
erase sector=168 ok
erase sector=169 ok
erase sector=170 ok
erase sector=171 ok
erase sector=172 ok
erase sector=173 ok
erase sector=174 ok
erase sector=175 ok
erase sector=176 ok
erase sector=177 ok
erase sector=178 ok
erase sector=179 ok
erase sector=180 ok
erase sector=181 ok
erase sector=182 ok
erase sector=183 ok
erase sector=184 ok
erase sector=185 ok
erase sector=186 ok

ALL=58 sectors erase ok!
upgrade_connect_cb
sumlength = 235652
upgrade file download start.
totallen = 2615
totallen = 4075
totallen = 5535
totallen = 6995
totallen = 8455
totallen = 9915
totallen = 11375
totallen = 12835
totallen = 14295
totallen = 15755
totallen = 17215
totallen = 18675
totallen = 20135
totallen = 21595
totallen = 23055
totallen = 24515
totallen = 25975
totallen = 27435
totallen = 28895
totallen = 30355
totallen = 31815
totallen = 33275
totallen = 34735
totallen = 36195
totallen = 37655
totallen = 39115
totallen = 40575
totallen = 42035
totallen = 43495
totallen = 44955
totallen = 46415
totallen = 47875
totallen = 49335
totallen = 50795
totallen = 52255
totallen = 53715
totallen = 55175
totallen = 56635
totallen = 58095
totallen = 59555
totallen = 61015
totallen = 62475
totallen = 63935
totallen = 65395
totallen = 66855
totallen = 68315
totallen = 69775
totallen = 71235
totallen = 72695
totallen = 74155
totallen = 75615
totallen = 77075
totallen = 78535
totallen = 79995
totallen = 81455
totallen = 82915
totallen = 84375
totallen = 85835
totallen = 87295
totallen = 88755
totallen = 90215
totallen = 91675
totallen = 93135
totallen = 94595
totallen = 96055
totallen = 97515
totallen = 98975
totallen = 100435
totallen = 101895
totallen = 103355
totallen = 104815
totallen = 106275
totallen = 107735
totallen = 109195
totallen = 110655
totallen = 112115
totallen = 113575
totallen = 115035
totallen = 116495
totallen = 117955
totallen = 119415
totallen = 120875
totallen = 122335
totallen = 123795
totallen = 125255
totallen = 126715
totallen = 128175
totallen = 129635
totallen = 131095
totallen = 132555
totallen = 134015
totallen = 135475
totallen = 136935
totallen = 138395
totallen = 139855
totallen = 141315
totallen = 142775
totallen = 144235
totallen = 145695
totallen = 147155
totallen = 148615
totallen = 150075
totallen = 151535
totallen = 152995
totallen = 154455
totallen = 155915
totallen = 157375
totallen = 158835
totallen = 160295
totallen = 161755
totallen = 163215
totallen = 164675
totallen = 166135
totallen = 167595
totallen = 169055
totallen = 170515
totallen = 171975
totallen = 173435
totallen = 174895
totallen = 176355
totallen = 177815
totallen = 179275
totallen = 180735
totallen = 182195
totallen = 183655
totallen = 185115
totallen = 186575
totallen = 188035
totallen = 189495
totallen = 190955
totallen = 192415
totallen = 193875
totallen = 195335
totallen = 196795
totallen = 198255
totallen = 199715
totallen = 201175
totallen = 202635
totallen = 204095
totallen = 205555
totallen = 207015
totallen = 208475
totallen = 209935
totallen = 211395
totallen = 212855
totallen = 214315
totallen = 215775
totallen = 217235
totallen = 218695
totallen = 220155
totallen = 221615
totallen = 223075
totallen = 224535
totallen = 225995
totallen = 227455
totallen = 228915
totallen = 230375
totallen = 231835
totallen = 233295
totallen = 234755
totallen = 235652
upgrade file download finished.
flash_crc = 935910361
img_crc = 935910361
upgrade_check
update sucess!
reboot to use2
state: 5 -> 0 (0)
rm 0
del if0
usl
\A2@*r\85\C4P\B1\B5\B1K\EDt\A5dr\D7-@\E9\F9.\A9Ѫ\A1Ko8a \EA\C9*\B1T\B1\B1\B1\A9\A9\C4P\8B,\A9\B5\F9*\B1\85\A2\FCnzAl )\E9m~\B1v%!\F9(P\B1+t\C7,\B1@j|\BD\F5*\B5\F9*\B1\89\F8nzAl )\E9m~\B1X%!\F9(P\B1+t\C7m\B1@j|\BD\AB*\B5\F9*\B1\89\F8nzAl )\E9m~\B1t\898r\A7(\B1Ǣ8\A1\AD\87\E9\F9.\BDr\F9+\B5\B1P\A2@\E8b\95v\A7(\A1\A1\B5\B9\89\E1\A2@\E8b\89\D1*\A1\A1\A1\B5\91\E5N\E8b\8D\C9-Ae\E1*\AD\89X\B5[p\D1h\B1{`\9A\AC\85X\A2\E0n\C1(~\B5\C6PתP\81\B1\B1\89X\E1rf cal sector: 1019
rf[112WIFI_INIT
mode : sta(5c:cf:7f:0b:09:ba)
add if0
::: software reset
STATION_IDLE
NOT_CONNECTEDSTATION_IDLE
STATION_IDLE
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 3
cnt

connected with SuporteTemp, channel 11
dhcp client start...
STATION_IDLE
STATION_IDLE
ip:172.26.69.57,mask:255.255.248.0,gw:172.26.64.1
user2.bin na memoria
url: GET /user1.bin HTTP/1.1
Host: 172.26.70.40:80
Connection: keep-alive
Cache-Control: no-cache
User-Agent: esp8266
Accept: */*

system_upgrade_start
upgrade_connect 49520
upgrade_connect_cb
pusrdata = HTTP/1.1 200 OK
Date: Tue, 20 Dec 2016 15:06:23 GMT
Server: Apache/2.4.10 (Debian)
Last-Modified: Tue, 20 Dec 2016 14:08:06 GMT
ETag: "39884-5441790b81717"
Accept-Ranges: bytes
Content-Length: 235652
Connection: close
Content-Type: application/octet-stream


sumlength = 235652
sec_block 58
..........................................................upgrade_get_sum_disconcb 47080

 ets Jan  8 2013,rst cause:2, boot mode:(1,7)

ESP_Xutao
Posts: 134
Joined: Tue Sep 27, 2016 5:42 pm

Re: Error on FOTA (ESP8266_NONOS_SDK_V2.0.0_16_08_10)

Postby ESP_Xutao » Tue Jan 24, 2017 2:55 pm

hi
Your code is no problem,according your log information,maybe erase error place in your flash,i want you affrod whole code and test environment.

Who is online

Users browsing this forum: MSN [Bot] and 6 guests