Help on OTA failure SDK 1.4.0
Posted: Wed Oct 14, 2015 11:49 am
Hello guys,
This is my first post here so I apologize in advance if this is not the correct board or something like that.
I have spent two days trying to update OTA the firmware on the ESP_TEST board that is mentioned here: (http://tech.scargill.net/esp8266-test-board/) . It has a 2MB spi flash memory.
My code is a modified version of a sample code I got from the web and seems to be ok. The code is the following:
I am using the 1.4.0 IOT SDK with bootloader 1.4(b1) and flashing to the following locations:
boot_v1.4(b1).bin to 0x00000
esp_init_data_default.bin to 0x1fc000
blank.bin to 0x1fe000
user1.2048.new.3.bin 0x01000
user2.2048.new.3.bin 0x81000
(NOTE> I tried flashing the 1MB flash version firmwares too, but same result...)
My log was:
I am using the ESP FLASH DOWNLOAD TOOL V1.2.
I thank you in advance for any help or input you could give on this. It has been really frustrating and don't know what else to do.
This is my first post here so I apologize in advance if this is not the correct board or something like that.
I have spent two days trying to update OTA the firmware on the ESP_TEST board that is mentioned here: (http://tech.scargill.net/esp8266-test-board/) . It has a 2MB spi flash memory.
My code is a modified version of a sample code I got from the web and seems to be ok. The code is the following:
Code: Select all
#include "ets_sys.h"
#include "osapi.h"
#include "user_interface.h"
#include "smartconfig.h"
#include "upgrade.h"
#include "os_type.h"
#include "mem.h"
#include "gpio.h"
#include "espconn.h"
#include "user_interface.h"
static void ICACHE_FLASH_ATTR ota_finished_callback(void *arg)
{
struct upgrade_server_info *update = arg;
if (update->upgrade_flag == true)
{
os_printf("[OTA]success; rebooting!\n");
system_upgrade_reboot();
}
else
{
os_printf("[OTA]failed!\n");
}
os_free(update->pespconn);
os_free(update->url);
os_free(update);
}
#define pheadbuffer "Connection: keep-alive\r\n\
Cache-Control: no-cache\r\n\
\r\n"
static void ICACHE_FLASH_ATTR handleUpgrade(uint8_t serverVersion, const char *server_ip, uint16_t port, const char *path)
{
const char* file;
uint8_t userBin = system_upgrade_userbin_check();
switch (userBin)
{
case UPGRADE_FW_BIN1: file = "user2.2048.new.3.bin"; break;
case UPGRADE_FW_BIN2: file = "user1.2048.new.3.bin"; break;
default:
os_printf("[OTA]Invalid userbin number!\n");
return;
}
uint16_t version=1;
if (serverVersion <= version)
{
os_printf("[OTA]No update. Server version:%d, local version %d\n", serverVersion, version);
return;
}
os_printf("[OTA]Upgrade available version: %d\n", serverVersion);
struct upgrade_server_info* update = (struct upgrade_server_info *)os_zalloc(sizeof(struct upgrade_server_info));
update->pespconn = (struct espconn *)os_zalloc(sizeof(struct espconn));
os_memcpy(update->ip, server_ip, 4);
update->port = port;
os_printf("[OTA]Server "IPSTR":%d. Path: %s%s\n", IP2STR(update->ip), update->port, path, file);
update->check_cb = ota_finished_callback;
update->check_times = 10000;
update->url = (uint8 *)os_zalloc(512);
os_sprintf((char*)update->url,
"GET %s%s HTTP/1.1\r\n"
"Host: "IPSTR":%d\r\n"
pheadbuffer,
path, file, IP2STR(update->ip), update->port);
if (system_upgrade_start(update) == false) {
os_printf("[OTA]Could not start upgrade\n");
os_free(update->pespconn);
os_free(update->url);
os_free(update);
}
else
{
os_printf("[OTA]Upgrading...\n");
}
}
void user_rf_pre_init(void)
{
}
void wifi_handle_event_cb(System_Event_t *evt)
{
os_printf("event %x\n", evt->event);
switch (evt->event) {
case EVENT_STAMODE_CONNECTED:
os_printf("connected to ssid %s, channel %d\n",
evt->event_info.connected.ssid,
evt->event_info.connected.channel);
break;
case EVENT_STAMODE_DISCONNECTED:
os_printf("disconnected from ssid %s, reason %d\n",
evt->event_info.disconnected.ssid,
evt->event_info.disconnected.reason);
break;
case EVENT_STAMODE_AUTHMODE_CHANGE:
os_printf("mode: %d -> %d\n",
evt->event_info.auth_change.old_mode,
evt->event_info.auth_change.new_mode);
break;
case EVENT_STAMODE_GOT_IP:
os_printf("ip:" IPSTR ",mask:" IPSTR ",gw:" IPSTR,
IP2STR(&evt->event_info.got_ip.ip),
IP2STR(&evt->event_info.got_ip.mask),
IP2STR(&evt->event_info.got_ip.gw));
os_printf("\n");
char ip[4] = {192, 168, 100, 15};
os_printf("LLAMANDO!!\n");
handleUpgrade(2, ip, 8000, "/upgrade/");
break;
case EVENT_SOFTAPMODE_STACONNECTED:
os_printf("station: " MACSTR "join, AID = %d\n",
MAC2STR(evt->event_info.sta_connected.mac),
evt->event_info.sta_connected.aid);
break;
case EVENT_SOFTAPMODE_STADISCONNECTED:
os_sprintf("station: " MACSTR "leave, AID = %d\n",
MAC2STR(evt->event_info.sta_disconnected.mac),
evt->event_info.sta_disconnected.aid);
break;
default:
break;
}
}
void ICACHE_FLASH_ATTR
user_set_station_config(void)
{
char ssid[32] = "MYSSID";
char password[64] = "MYPASS";
struct station_config stationConf;
stationConf.bssid_set = 0; //need not check MAC address of AP
os_memcpy(&stationConf.ssid, ssid, 32);
os_memcpy(&stationConf.password, password, 64);
wifi_station_set_config(&stationConf);
}
void user_init(void)
{
os_printf("ASDF\n");
os_printf("HOLASDK version:%s\n\n", system_get_sdk_version());
wifi_set_event_handler_cb(wifi_handle_event_cb);
///smartconfig_set_type(SC_TYPE_ESPTOUCH); //SC_TYPE_ESPTOUCH,SC_TYPE_AIRKISS,SC_TYPE_ESPTOUCH_AIRKISS
wifi_set_opmode(STATION_MODE);
//smartconfig_start(smartconfig_done);
user_set_station_config();
}
I am using the 1.4.0 IOT SDK with bootloader 1.4(b1) and flashing to the following locations:
boot_v1.4(b1).bin to 0x00000
esp_init_data_default.bin to 0x1fc000
blank.bin to 0x1fe000
user1.2048.new.3.bin 0x01000
user2.2048.new.3.bin 0x81000
(NOTE> I tried flashing the 1MB flash version firmwares too, but same result...)
My log was:
Code: Select all
ets Jan 8 2013,rst cause:1, boot mode:(3,2)
load 0x40100000, len 1396, room 16
tail 4
chksum 0x89
load 0x3ffe8000, len 776, room 4
tail 4
chksum 0xe8
load 0x3ffe8308, len 540, room 4
tail 8
chksum 0xc0
csum 0xc0
2nd boot version : 1.4(b1)
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size & Map: 16Mbit(512KB+512KB)
jump to run user1 @ 1000
SDK ver: 1.4.0 compiled @ Sep 18 2015 20:55:49
phy ver: 484, pp ver: 9.5
ASDF
HOLASDK version:1.4.0
mode : sta(18:fe:34:a1:32:8a)
add if0
f r0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 3
cnt
connected with Belkin_Enhanced_Wireless_E53473, channel 1
dhcp client start...
event 0
connected to ssid Belkin_Enhanced_Wireless_E53473, channel 1
ip:192.168.100.39,mask:255.255.255.0,gw:192.168.100.1
event 3
ip:192.168.100.39,mask:255.255.255.0,gw:192.168.100.1
LLAMANDO!!
[OTA]Upgrade available version: 2
[OTA]Server 192.168.100.15:8000. Path: /upgrade/user2.2048.new.3.bin
system_upgrade_start
upgrade_connect
[OTA]Upgrading...
upgrade_connect_cb
GET /upgrade/user2.2048.new.3.bin HTTP/1.1
Host: 192.168.100.15:8000
Connection: keep-alive
Cache-Control: no-cache
HEAD /upgrade/user2.2048.new.3.bin HTTP/1.1
Host: 192.168.100.15:8000
Connection: close
Cache-Control: no-cache
pusrdata = HTTP/1.0 200 OK
server do not support HEAD method now send GET message
GET /upgrade/user2.2048.new.3.bin HTTP/1.1
Host: 192.168.100.15:8000
Connection: keep-alive
Cache-Control: no-cache
pusrdata = Server: SimpleHTTP/0.6 Python/2.7.8
Date: Wed, 14 Oct 2015 16:11:33 GMT
Content-type: application/octet-stream
Content-Length: 218100
Last-Modified: Wed, 14 Oct 2015 16:07:56 GMT
Access-Control-Allow-Origin: *
sumlength = 218100
sec_block 54
......................................................upgrade_get_sum_disconcb
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
ALL=54 sectors erase ok!
upgrade_connect_cb
GET /upgrade/user2.2048.new.3.bin HTTP/1.1
Host: 192.168.100.15:8000
Connection: keep-alive
Cache-Control: no-cache
HEAD /upgrade/user2.2048.new.3.bin HTTP/1.1
Host: 192.168.100.15:8000
Connection: close
Cache-Control: no-cache
totallen = 17
totallen = 1477
totallen = 2937
totallen = 4397
totallen = 5857
totallen = 7317
totallen = 8777
totallen = 10237
totallen = 11697
totallen = 13157
totallen = 14617
totallen = 16077
totallen = 17537
totallen = 18997
totallen = 20457
totallen = 21917
totallen = 23377
totallen = 24837
totallen = 26297
totallen = 27757
totallen = 29217
totallen = 30677
totallen = 32137
totallen = 33597
totallen = 35057
totallen = 36517
totallen = 37977
totallen = 39437
totallen = 40897
totallen = 42357
totallen = 43817
totallen = 45277
totallen = 46737
totallen = 48197
totallen = 49657
totallen = 51117
totallen = 52577
totallen = 54037
totallen = 55497
totallen = 56957
totallen = 58417
totallen = 59877
totallen = 61337
totallen = 62797
totallen = 64257
totallen = 65717
totallen = 67177
totallen = 68637
totallen = 70097
totallen = 71557
totallen = 73017
totallen = 74477
totallen = 75937
totallen = 77397
totallen = 78857
totallen = 80317
totallen = 81777
totallen = 83237
totallen = 84697
totallen = 86157
totallen = 87617
totallen = 89077
totallen = 90537
totallen = 91997
totallen = 93457
totallen = 94917
totallen = 96377
totallen = 97837
totallen = 99297
totallen = 100757
totallen = 102217
totallen = 103677
totallen = 105137
totallen = 106597
totallen = 108057
totallen = 109517
totallen = 110977
totallen = 112437
totallen = 113897
totallen = 115357
totallen = 116817
totallen = 118277
totallen = 119737
totallen = 121197
totallen = 122657
totallen = 124117
totallen = 125577
totallen = 127037
totallen = 128497
totallen = 129957
totallen = 131417
totallen = 132877
totallen = 134337
totallen = 135797
totallen = 137257
totallen = 138717
totallen = 140177
totallen = 141637
totallen = 143097
totallen = 144557
totallen = 146017
totallen = 147477
totallen = 148937
totallen = 150397
totallen = 151857
totallen = 153317
totallen = 154777
totallen = 156237
totallen = 157697
totallen = 159157
totallen = 160617
totallen = 162077
totallen = 163537
totallen = 164997
totallen = 166457
totallen = 167917
totallen = 169377
totallen = 170837
totallen = 172297
totallen = 173757
totallen = 175217
totallen = 176677
totallen = 178137
totallen = 179597
totallen = 181057
totallen = 182517
totallen = 183977
totallen = 185437
totallen = 186897
totallen = 188357
totallen = 189817
totallen = 191277
totallen = 192737
totallen = 194197
totallen = 195657
totallen = 197117
totallen = 198577
totallen = 200037
totallen = 201497
totallen = 202957
totallen = 204417
totallen = 205877
totallen = 207337
totallen = 208797
totallen = 210257
totallen = 211717
totallen = 213177
totallen = 214637
totallen = 216097
totallen = 217557
totallen = 218335
pm open phy_2,type:2 0 0
upgrade_check
[OTA]failed!
I am using the ESP FLASH DOWNLOAD TOOL V1.2.
I thank you in advance for any help or input you could give on this. It has been really frustrating and don't know what else to do.