Page 2 of 3

Re: OTA upgrade is aborting

Posted: Mon Jun 03, 2019 1:47 pm
by Ritesh
Ritu21 wrote:
Mon Jun 03, 2019 1:14 pm
I haven't put any delay before rebooting the device. Do I need to add delay??

Actual application is server dependent, we get the time from server fro image update, then start rtos timer like this:

imageDownloadTimerHandle = xTimerCreate("imageDownloadTimer",pdMS_TO_TICKS(difference_in_time*1000),pdFALSE,(void*)1, vTimerCallbackApplyTimeExpired);
if(imageDownloadTimerHandle == NULL){
printf("Upload Timer Not Created\n");
}
else{
printf("Upload timer Started\n");
xTimerStart(imageDownloadTimerHandle, 0);
}

This is a callback function in which ota update function is called which I had already send you :
void vTimerCallbackApplyTimeExpired(xTimerHandle pxTimer1)
{
printf("Image Download Timer Expired\n");
ota_ImageUpdate();
printf("Image update finished\n");
}
Hi, Would you please check from where ESP32 restart API is called after completing firmware update? has it been managed with timer or just managed with normal API call?

Because, We are not using any OTA Image related APIs, We are using standard APIs to update image and we resolved this issue by putting some delay before ESP32 Restart or creating timer before ESP32 restart.

Re: OTA upgrade is aborting

Posted: Tue Jun 04, 2019 4:58 am
by Ritu21
Hi,

Calling ESP32 restart api just after the completion of firmware update. No delay has been added. Should I put delay before restart???

What standard API's are you using for the same.

Thanks
Ritu.

Re: OTA upgrade is aborting

Posted: Tue Jun 04, 2019 5:28 am
by Ritesh
Ritu21 wrote:
Tue Jun 04, 2019 4:58 am
Hi,

Calling ESP32 restart api just after the completion of firmware update. No delay has been added. Should I put delay before restart???

What standard API's are you using for the same.

Thanks
Ritu.
Hi,

I suggest to create one 5 seconds of time before calling restart system and call restart system from that time at the end of expiration of timer.

or second suggestion is to put some delay before calling system restart call.

Re: OTA upgrade is aborting

Posted: Tue Jun 04, 2019 5:29 am
by Ritesh
Hi,

We are using below APIs to do firmware update at our end. Please find below basic flow for same.

esp_partition_t partition;
memset(&partition, 0, sizeof(esp_partition_t));

const esp_partition_t *partition1 = esp_ota_get_boot_partition();
if (partition1 == NULL) {
return FIRMWARE_UPDATE_FAIL;
}

if (partition1->subtype == ESP_PARTITION_SUBTYPE_APP_OTA_0) {
partition.type = ESP_PARTITION_TYPE_APP;
partition.subtype = ESP_PARTITION_SUBTYPE_APP_FACTORY;
partition.address = OTA_PARTITION_0_ADDR;
partition.size = OTA_PARTITION_SIZE;
strcpy(partition.label, "FACTORY_APP");
partition.encrypted = FAIL;
dest = OTA_PARTITION_0_ADDR;
} else if (partition1->subtype == ESP_PARTITION_SUBTYPE_APP_FACTORY) {
partition.type = ESP_PARTITION_TYPE_APP;
partition.subtype = ESP_PARTITION_SUBTYPE_APP_OTA_0;
partition.address = OTA_PARTITION_1_ADDR;
partition.size = OTA_PARTITION_SIZE;
strcpy(partition.label, "OTA_0_APP");
partition.encrypted = FAIL;
dest = OTA_PARTITION_1_ADDR;
}

spi_flash_erase_range
spi_flash_write
esp_ota_set_boot_partition
Restart ESP32 with some timer mechanism of 5 seconds or 10 seconds

Re: OTA upgrade is aborting

Posted: Tue Jun 04, 2019 3:39 pm
by fly135
Ritesh wrote:
Tue Jun 04, 2019 5:29 am
...
spi_flash_erase_range
spi_flash_write
esp_ota_set_boot_partition
Restart ESP32 with some timer mechanism of 5 seconds or 10 seconds
What's the point of the delay before reboot? I've been doing OTA without a delay before reboot and not sure if there is a potential problem.


John A

Re: OTA upgrade is aborting

Posted: Wed Jun 05, 2019 3:42 am
by Ritesh
fly135 wrote:
Tue Jun 04, 2019 3:39 pm
Ritesh wrote:
Tue Jun 04, 2019 5:29 am
...
spi_flash_erase_range
spi_flash_write
esp_ota_set_boot_partition
Restart ESP32 with some timer mechanism of 5 seconds or 10 seconds
What's the point of the delay before reboot? I've been doing OTA without a delay before reboot and not sure if there is a potential problem.


John A
This is just for a workaround to make sure that system will be restarted within that much of duration. So, We can put one debug statement before delay timer and restart API call so that we can have idea like what is going on at that time.

Re: OTA upgrade is aborting

Posted: Thu Jun 13, 2019 12:54 pm
by Ritu21
Hi,

I am getting the same error again. Please help me to solve this issue.

Waiting for your response

Thanks
Ritu

Re: OTA upgrade is aborting

Posted: Thu Jun 13, 2019 1:31 pm
by Ritesh
Ritu21 wrote:
Thu Jun 13, 2019 12:54 pm
Hi,

I am getting the same error again. Please help me to solve this issue.

Waiting for your response

Thanks
Ritu
Hi,

I just want to know that are you still facing issue after adding delay or timer before going to restart system from your end?

If still same issue then need to check OTA code into details to get exact reason for same.

Re: OTA upgrade is aborting

Posted: Thu Jun 13, 2019 1:36 pm
by Ritu21
Ritesh wrote:
Thu Jun 13, 2019 1:31 pm
Ritu21 wrote:
Thu Jun 13, 2019 12:54 pm
Hi,

I am getting the same error again. Please help me to solve this issue.

Waiting for your response

Thanks
Ritu
Hi,

I just want to know that are you still facing issue after adding delay or timer before going to restart system from your end?
Yes, even after adding delay I am getting this error.

[/quote]
If still same issue then need to check OTA code into details to get exact reason for same.
[/quote]

I would have surely checked my code if this would have been failing every time. 8/10 times it is failing.

Re: OTA upgrade is aborting

Posted: Thu Jun 13, 2019 3:38 pm
by fly135
Ritu21 wrote:
Thu Jun 13, 2019 1:36 pm
I am getting the same error again. Please help me to solve this issue.
Maybe it's hanging in your NVS calls at the end.

John A