Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

long wait after "go to ota recycle" when I perform FOTA_DEMO #2

Open
BG2BKK opened this issue Sep 20, 2016 · 4 comments
Open

long wait after "go to ota recycle" when I perform FOTA_DEMO #2

BG2BKK opened this issue Sep 20, 2016 · 4 comments

Comments

@BG2BKK
Copy link

BG2BKK commented Sep 20, 2016

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"

upgrade file download finished.
fw_bin_sec 129 sumlength 289668
img_crc = 54761754
flash_crc = 54761754
go to ota recycle
reboot to use2

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

load 0x40100000, len 1856, room 16 
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8 
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8 
tail 0
chksum 0x79

So what is the reason about it?
Thank you!

@BG2BKK
Copy link
Author

BG2BKK commented Sep 20, 2016

The expiration between two ota is 120s that is defined in ota_config.h

@BG2BKK
Copy link
Author

BG2BKK commented Sep 20, 2016

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
    }
}

@BG2BKK
Copy link
Author

BG2BKK commented Sep 20, 2016

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.

@BG2BKK
Copy link
Author

BG2BKK commented Sep 21, 2016

selection_022
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;
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant