Problems with ROLLBACK

dhananjay.sutariya
Posts: 22
Joined: Thu Feb 28, 2019 12:21 pm

Problems with ROLLBACK

Postby dhananjay.sutariya » Thu Apr 11, 2019 1:48 pm

Hi all,
Even After configuring the ROLLBACK macro in the sdk config. My App is not going into self diagnosis code . This one:

Code: Select all

    if (esp_ota_get_state_partition(running, &ota_state) == ESP_OK) {
    	ESP_LOGI(TAG, "Get State Partition was Successfull");
    		if (ota_state == ESP_OTA_IMG_PENDING_VERIFY) {
            // run diagnostic function ...
            bool diagnostic_is_ok = true;
            if (diagnostic_is_ok) {
                ESP_LOGI(TAG, "Diagnostics completed successfully! Continuing execution ...");
                esp_ota_mark_app_valid_cancel_rollback();
            } else {
                ESP_LOGE(TAG, "Diagnostics failed! Start rollback to the previous version ...");
                esp_ota_mark_app_invalid_rollback_and_reboot();
            }
        }
    }
Please Help.

Konstantin
Posts: 1
Joined: Tue Feb 05, 2019 7:31 am

Re: Problems with ROLLBACK

Postby Konstantin » Tue Apr 16, 2019 2:10 am

Hi, dhananjay.sutariya.

When you download your firmware first time, OTADATA will be erased. In bootloader, it set to the right ota_seq and ESP_OTA_IMG_VALID state. It means that in an application your code will be not checked by the diagnostic code, because you have only one bootable app and rollback is not possible.

After OTA your app has `ESP_OTA_IMG_PENDING_VERIFY` state and only while first booting this part of code should be executed. This state will be changed `esp_ota_mark_app_valid_cancel_rollback()` function to ESP_OTA_IMG_VALID.

Return to “ESP32 IDF”

Who is online

Users browsing this forum: No registered users and 18 guests