Open BG2BKK opened 8 years ago
The expiration between two ota is 120s that is defined in ota_config.h
The program will wait at "vTaskDelete(ota_task_handle);"
LOCAL void upgrade_recycle(void)
{
totallength = 0;
sumlength = 0;
flash_erased = false;
system_upgrade_deinit();
vTaskDelete(ota_task_handle);
ota_task_handle = NULL;
if (system_upgrade_flag_check() == UPGRADE_FLAG_FINISH) {
system_upgrade_reboot(); // if need
}
}
It seems that when program execute "vTaskDelete(ota_task_handle)" and the program will hang up itself. When ota_timeout expired, the program execute "vTaskDelete(ota_task_handle)" again, then it causes the program collapse and the hardware reboot.
I review the fota document and find the rule number 5: 硬件模组掉电,切换到运行模式, which means that when I flash the esp8266 at the first time, I need power off it and then power on. I tried and found it work. Why does it need to power off first?
By the way, there still exists long wait when esp8266 execute " vTaskDelete(ota_task_handle);" , I print the adddress of ota_task_handle and find that it's NULL no matter in line " vTaskDelete(ota_task_handle);" or after line "xTaskCreate(fota_begin, "fota_task", 1024, NULL, 1, ota_task_handle);". I know that vTaskDelete(NULL) means to kill itself, and in FOTA_Demo there is only one task , and this means that there is no task after vTaskDelete(ota_task_handle); so that esp8266 begin to loop null, until upgrade_timer expires and reenter function upgrade_recycle and executes vTaskDelete(ota_task_handle) again, then exectes system_upgrade_reboot.
So I placed system_upgrade_flag_check() == UPGRADE_FLAG_FINISH before vTaskDelete and it worked
LOCAL void upgrade_recycle(void)
{
totallength = 0;
sumlength = 0;
flash_erased = false;
printf("upgrade_recycle again\n");
system_upgrade_deinit();
if (system_upgrade_flag_check() == UPGRADE_FLAG_FINISH) {
printf("upgrade reboot\n");
system_upgrade_reboot(); // if need
}
printf("%p %d\n", ota_task_handle, (ota_task_handle == NULL));
vTaskDelete(ota_task_handle);
ota_task_handle = NULL;
}
Hi! Thank you for your FOTA_DEMO, I tried it and get it work by my own simple http server. I have problems on that when I download user2.bin from remote server, and run to print "go to ota recycle", then I have to wait until some timer expires. The log is showed below, long wait between "go to ota recycle" and "reboot ot use2"
So what is the reason about it? Thank you!