OTA makes only HEAD request and stops
OTA makes only HEAD request and stops
Postby islavov » Tue May 16, 2017 10:00 pm
Hi,
I am trying to prove concept with OTA with esp8266 WROOM2, using the sample from this link:
viewtopic.php?f=7&t=423#p1619
I am connecting to an internal server not public, so i am assuming i dont need to key file, correct?
When I run it, i can see the log on my IIS server:
2017-05-15 20:14:15 192.168.1.16 HEAD /3.0.1.bin - 8660 - 192.168.1.93 DEMO_DEVICE - 200 0 0 97
2017-05-15 20:19:08 192.168.1.16 HEAD /3.0.1.bin - 8660 - 192.168.1.93 DEMO_DEVICE - 200 0 0 43
2017-05-15 20:27:43 192.168.1.16 HEAD /3.0.1.bin - 8660 - 192.168.1.93 DEMO_DEVICE - 200 0 0 31
I can see the status is 200, but where are the GET requests?... I know HEAD will not return any data.
Please help!
My code is not much different than the sample"
static void ICACHE_FLASH_ATTR user_esp_platform_upgrade_rsp(void *arg)
{
struct upgrade_server_info *server = arg;
if (server->upgrade_flag == true) {
;
#ifdef PLATFORM_DEBUG
ets_uart_printf ("user_esp_platform_upgrade_successful\n");
#endif
} else {
;
#ifdef PLATFORM_DEBUG
ets_uart_printf("user_esp_platform_upgrade_failed\n");
#endif
}
os_free(server->url);
server->url = NULL;
os_free(server);
server = NULL;
}
static void ICACHE_FLASH_ATTR user_esp_platform_upgrade_begin(struct espconn *pespconn, struct upgrade_server_info *server)
{
uint8 user_bin[9] = {0};
#ifdef PLATFORM_DEBUG
ets_uart_printf ("user_esp_platform_upgrade_begin\n");
#endif
server->pespconn = pespconn;
server->port = OTA_PORT;
server->check_cb = user_esp_platform_upgrade_rsp;
server->check_times = 120000;//120000
const char ota_server_ip[4] = {192,168,1,16};
os_memcpy(server->ip, ota_server_ip, 4);
if (server->url == NULL) {
server->url = (uint8 *)os_zalloc(512);
}
char root_relative_folder[50] = {0};
os_memset(root_relative_folder,0,sizeof(root_relative_folder));
//if no folder, comment out below line
//os_sprintf(root_relative_folder,"/test",4);
os_sprintf(server->url, "GET %s/%s.%s HTTP/1.0\r\nHost: "IPSTR":%d\r\n"pheadbuffer"",
root_relative_folder, xpert_ota_new_fw_version,"bin", IP2STR(server->ip),
OTA_PORT);
#ifdef PLATFORM_DEBUG
ets_uart_printf ("system_upgrade_start, URL[%s]\n",server->url);
#endif
if (system_upgrade_start(server) == false)
{
;
#ifdef PLATFORM_DEBUG
ets_uart_printf("upgrade is already started\n");
#endif
}
}
I am trying to prove concept with OTA with esp8266 WROOM2, using the sample from this link:
viewtopic.php?f=7&t=423#p1619
I am connecting to an internal server not public, so i am assuming i dont need to key file, correct?
When I run it, i can see the log on my IIS server:
2017-05-15 20:14:15 192.168.1.16 HEAD /3.0.1.bin - 8660 - 192.168.1.93 DEMO_DEVICE - 200 0 0 97
2017-05-15 20:19:08 192.168.1.16 HEAD /3.0.1.bin - 8660 - 192.168.1.93 DEMO_DEVICE - 200 0 0 43
2017-05-15 20:27:43 192.168.1.16 HEAD /3.0.1.bin - 8660 - 192.168.1.93 DEMO_DEVICE - 200 0 0 31
I can see the status is 200, but where are the GET requests?... I know HEAD will not return any data.
Please help!
My code is not much different than the sample"
static void ICACHE_FLASH_ATTR user_esp_platform_upgrade_rsp(void *arg)
{
struct upgrade_server_info *server = arg;
if (server->upgrade_flag == true) {
;
#ifdef PLATFORM_DEBUG
ets_uart_printf ("user_esp_platform_upgrade_successful\n");
#endif
} else {
;
#ifdef PLATFORM_DEBUG
ets_uart_printf("user_esp_platform_upgrade_failed\n");
#endif
}
os_free(server->url);
server->url = NULL;
os_free(server);
server = NULL;
}
static void ICACHE_FLASH_ATTR user_esp_platform_upgrade_begin(struct espconn *pespconn, struct upgrade_server_info *server)
{
uint8 user_bin[9] = {0};
#ifdef PLATFORM_DEBUG
ets_uart_printf ("user_esp_platform_upgrade_begin\n");
#endif
server->pespconn = pespconn;
server->port = OTA_PORT;
server->check_cb = user_esp_platform_upgrade_rsp;
server->check_times = 120000;//120000
const char ota_server_ip[4] = {192,168,1,16};
os_memcpy(server->ip, ota_server_ip, 4);
if (server->url == NULL) {
server->url = (uint8 *)os_zalloc(512);
}
char root_relative_folder[50] = {0};
os_memset(root_relative_folder,0,sizeof(root_relative_folder));
//if no folder, comment out below line
//os_sprintf(root_relative_folder,"/test",4);
os_sprintf(server->url, "GET %s/%s.%s HTTP/1.0\r\nHost: "IPSTR":%d\r\n"pheadbuffer"",
root_relative_folder, xpert_ota_new_fw_version,"bin", IP2STR(server->ip),
OTA_PORT);
#ifdef PLATFORM_DEBUG
ets_uart_printf ("system_upgrade_start, URL[%s]\n",server->url);
#endif
if (system_upgrade_start(server) == false)
{
;
#ifdef PLATFORM_DEBUG
ets_uart_printf("upgrade is already started\n");
#endif
}
}
Re: OTA makes only HEAD request and stops
Postby pratik » Thu May 18, 2017 12:34 pm
Is your server configured properly? For some reason it seems like the first request is not properly completed and so the ESP does not proceed.
Re: OTA makes only HEAD request and stops
Postby islavov » Thu May 18, 2017 9:54 pm
pratik wrote:Is your server configured properly? For some reason it seems like the first request is not properly completed and so the ESP does not proceed.
It is IIS, I can click on a link and download the bin file via any browser - that is telling me, file is being served okay.
Also the HEAD requests taht come in from module are getting 200/okay response.
I am not sure where to look next.
Ivan
Re: OTA makes only HEAD request and stops
Postby islavov » Thu May 18, 2017 10:00 pm
Seems to me something is getting stuck, looks like the module is supposed to issue GET next, after trying the HEAD to see if file is there. But seems the communication is one way – module sends the HEAD request, but it is not getting the 200/OK http response, and it is jsut timing out.
What can i do to troubleshoot or try something else? there is not serial output on the module, it just times out per the OTA setting timeout.
Thanks for any suggestions and help!!!
Ivan S.
What can i do to troubleshoot or try something else? there is not serial output on the module, it just times out per the OTA setting timeout.
Thanks for any suggestions and help!!!
Ivan S.
Re: OTA makes only HEAD request and stops
Postby pratik » Fri May 19, 2017 5:35 pm
OTA requires some experience to develop, it is a little complex.
But I think the best way to debug this would be to modify the code and insert debug printf commands in the code. Also, you can use XAMPP or something to set up a local server on your PC, and then try to update the ESP from this local server. That way you can check the XAMPP log and find out what is going wrong.
But I think the best way to debug this would be to modify the code and insert debug printf commands in the code. Also, you can use XAMPP or something to set up a local server on your PC, and then try to update the ESP from this local server. That way you can check the XAMPP log and find out what is going wrong.
Re: OTA makes only HEAD request and stops
Postby islavov » Tue May 23, 2017 5:45 am
I have logs from IIS server:
I only see:
#Software: Microsoft Internet Information Services 8.5
#Version: 1.0
#Date: 2017-05-15 20:14:15
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2017-05-15 20:53:56 192.168.1.16 HEAD /3.0.1.bin - 8660 - 192.168.1.93 PrototypeTag - 200 0 0 39
when I hit the URL in browser, i see the GET request, so i am confident that the file is there, and IIS seems to be serving it:
2017-05-15 20:38:48 192.168.1.16 GET /3.0.1.bin - 8660 - 192.168.1.120 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+rv:53.0)+Gecko/20100101+Firefox/53.0 - 200 0 0 48
How can I print debug output when I am using the upgrade OTA functions from upgrade.h, it is library which i dont think I have to source for.
this is UPGRADE.H
#ifndef __UPGRADE_H__
#define __UPGRADE_H__
#define SPI_FLASH_SEC_SIZE 4096
#define LIMIT_ERASE_SIZE 0x10000
#define USER_BIN1 0x00
#define USER_BIN2 0x01
#define UPGRADE_FLAG_IDLE 0x00
#define UPGRADE_FLAG_START 0x01
#define UPGRADE_FLAG_FINISH 0x02
#define UPGRADE_FW_BIN1 0x00
#define UPGRADE_FW_BIN2 0x01
typedef void (*upgrade_states_check_callback)(void * arg);
//#define UPGRADE_SSL_ENABLE
struct upgrade_server_info {
uint8 ip[4];
uint16 port;
uint8 upgrade_flag;
uint8 pre_version[16];
uint8 upgrade_version[16];
uint32 check_times;
uint8 *url;
upgrade_states_check_callback check_cb;
struct espconn *pespconn;
};
#define UPGRADE_FLAG_IDLE 0x00
#define UPGRADE_FLAG_START 0x01
#define UPGRADE_FLAG_FINISH 0x02
void system_upgrade_init();
void system_upgrade_deinit();
bool system_upgrade(uint8 *data, uint16 len);
#ifdef UPGRADE_SSL_ENABLE
bool system_upgrade_start_ssl(struct upgrade_server_info *server); // not supported now
#else
bool system_upgrade_start(struct upgrade_server_info *server);
#endif
#endif
and I just call the entry function as such (per the OTA example)
if (system_upgrade_start(server) == false)
{
;
#ifdef PLATFORM_DEBUG
ets_uart_printf("upgrade is already started\n");
#endif
}
}
I am continuing to try to make this work.
Any help is appreciated!
Ivan S.
I only see:
#Software: Microsoft Internet Information Services 8.5
#Version: 1.0
#Date: 2017-05-15 20:14:15
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2017-05-15 20:53:56 192.168.1.16 HEAD /3.0.1.bin - 8660 - 192.168.1.93 PrototypeTag - 200 0 0 39
when I hit the URL in browser, i see the GET request, so i am confident that the file is there, and IIS seems to be serving it:
2017-05-15 20:38:48 192.168.1.16 GET /3.0.1.bin - 8660 - 192.168.1.120 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+rv:53.0)+Gecko/20100101+Firefox/53.0 - 200 0 0 48
How can I print debug output when I am using the upgrade OTA functions from upgrade.h, it is library which i dont think I have to source for.
this is UPGRADE.H
#ifndef __UPGRADE_H__
#define __UPGRADE_H__
#define SPI_FLASH_SEC_SIZE 4096
#define LIMIT_ERASE_SIZE 0x10000
#define USER_BIN1 0x00
#define USER_BIN2 0x01
#define UPGRADE_FLAG_IDLE 0x00
#define UPGRADE_FLAG_START 0x01
#define UPGRADE_FLAG_FINISH 0x02
#define UPGRADE_FW_BIN1 0x00
#define UPGRADE_FW_BIN2 0x01
typedef void (*upgrade_states_check_callback)(void * arg);
//#define UPGRADE_SSL_ENABLE
struct upgrade_server_info {
uint8 ip[4];
uint16 port;
uint8 upgrade_flag;
uint8 pre_version[16];
uint8 upgrade_version[16];
uint32 check_times;
uint8 *url;
upgrade_states_check_callback check_cb;
struct espconn *pespconn;
};
#define UPGRADE_FLAG_IDLE 0x00
#define UPGRADE_FLAG_START 0x01
#define UPGRADE_FLAG_FINISH 0x02
void system_upgrade_init();
void system_upgrade_deinit();
bool system_upgrade(uint8 *data, uint16 len);
#ifdef UPGRADE_SSL_ENABLE
bool system_upgrade_start_ssl(struct upgrade_server_info *server); // not supported now
#else
bool system_upgrade_start(struct upgrade_server_info *server);
#endif
#endif
and I just call the entry function as such (per the OTA example)
if (system_upgrade_start(server) == false)
{
;
#ifdef PLATFORM_DEBUG
ets_uart_printf("upgrade is already started\n");
#endif
}
}
I am continuing to try to make this work.
Any help is appreciated!
Ivan S.
Who is online
Users browsing this forum: No registered users and 311 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.