otallen = 358876
totallen = 360336
totallen = 361396
upgrade file download finished.
flash_crc = 3525425237
[08:40:28.378]收←◆img_crc = 645727078
upgrade_check
[OTA]failed!
esp8266 nonos sdk 2.2.0 ota flash_crc!=img_crc
-
- Posts: 4
- Joined: Fri Aug 18, 2017 8:24 am
-
- Posts: 4
- Joined: Fri Aug 18, 2017 8:24 am
Re: esp8266 nonos sdk 2.2.0 ota flash_crc!=img_crc
Postby limuzi2012 » Sat Mar 17, 2018 11:59 am
like this website :https://stackoverflow.com/questions/47147491/esp8266-nonos-sdk-fota-error-check-the-bin-file
#define pheadbuffer "Connection: keep-alive\r\n\
Cache-Control: no-cache\r\n\
\r\n"
void ICACHE_FLASH_ATTR ota_start_Upgrade(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.4096.new.4.bin"; break; // user2.bin
case UPGRADE_FW_BIN2: file = "user1.4096.new.4.bin"; break; // user1.bin
default:
os_printf("[OTA]Invalid userbin number!\n");
return;
}
os_printf("[OTA]system user version: %d\n", userBin);
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],file: [%s]\n", IP2STR(update->ip), update->port, path, file);
update->check_cb = ota_finished_callback;
update->check_times = 120000;
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");
}
}
Code: Select all
#define pheadbuffer "Connection: keep-alive\r\n\
Cache-Control: no-cache\r\n\
\r\n"
void ICACHE_FLASH_ATTR ota_start_Upgrade(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.4096.new.4.bin"; break; // user2.bin
case UPGRADE_FW_BIN2: file = "user1.4096.new.4.bin"; break; // user1.bin
default:
os_printf("[OTA]Invalid userbin number!\n");
return;
}
os_printf("[OTA]system user version: %d\n", userBin);
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],file: [%s]\n", IP2STR(update->ip), update->port, path, file);
update->check_cb = ota_finished_callback;
update->check_times = 120000;
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");
}
}
#define pheadbuffer "Connection: keep-alive\r\n\
Cache-Control: no-cache\r\n\
\r\n"
void ICACHE_FLASH_ATTR ota_start_Upgrade(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.4096.new.4.bin"; break; // user2.bin
case UPGRADE_FW_BIN2: file = "user1.4096.new.4.bin"; break; // user1.bin
default:
os_printf("[OTA]Invalid userbin number!\n");
return;
}
os_printf("[OTA]system user version: %d\n", userBin);
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],file: [%s]\n", IP2STR(update->ip), update->port, path, file);
update->check_cb = ota_finished_callback;
update->check_times = 120000;
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");
}
}
Re: esp8266 nonos sdk 2.2.0 ota flash_crc!=img_crc
Postby Her Mary » Tue Mar 27, 2018 5:45 pm
There is a simple demo may help. https://bbs.espressif.com/viewtopic.php?f=7&t=423#p1619
For the log you provided, it is the CRC error, maybe you should check the data you downloaded from the server, maybe it has not only the bin but also some HTTP header which cause the CRC fail.
For the log you provided, it is the CRC error, maybe you should check the data you downloaded from the server, maybe it has not only the bin but also some HTTP header which cause the CRC fail.
Who is online
Users browsing this forum: No registered users and 316 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.