Espressif ESP32-S2 Programming Manual page 839

Table of Contents

Advertisement

Chapter 2. API Reference
• ESP_ERR_OTA_VALIDATE_FAILED: Invalid app image
• ESP_ERR_NO_MEM: Cannot allocate memory for OTA operation.
• ESP_ERR_FLASH_OP_TIMEOUT or ESP_ERR_FLASH_OP_FAIL: Flash write failed.
• For other return codes, refer OTA documentation in esp-idf's app_update component.
Parameters
• [in] config: pointer to
esp_err_t esp_https_ota_begin(esp_https_ota_config_t
Start HTTPS OTA Firmware upgrade.
This function initializes ESP HTTPS OTA context and establishes HTTPS connection. This function must
be invoked first. If this function returns successfully, then esp_https_ota_perform should be called
to continue with the OTA process and there should be a call to esp_https_ota_finish on completion
of OTA operation or on failure in subsequent operations. This API supports URL redirection, but if CA cert
of URLs differ then it should be appended to cert_pem member of http_config, which is a part of
ota_config. In case of error, this API explicitly sets handle to NULL.
Note This API is blocking, so setting is_async member of http_config structure will result in an error.
Return
• ESP_OK: HTTPS OTA Firmware upgrade context initialised and HTTPS connection established
• ESP_FAIL: For generic failure.
• ESP_ERR_INVALID_ARG: Invalid argument (missing/incorrect config, certificate, etc.)
• For other return codes, refer documentation in app_update component and esp_http_client compo-
nent in esp-idf.
Parameters
• [in] ota_config: pointer to
• [out] handle: pointer to an allocated data of type esp_https_ota_handle_t which will
be initialised in this function
esp_err_t esp_https_ota_perform(esp_https_ota_handle_t
Read image data from HTTP stream and write it to OTA partition.
This function reads image data from HTTP stream and writes it to OTA partition. This function must be called
only if esp_https_ota_begin() returns successfully. This function must be called in a loop since it returns after
every HTTP read operation thus giving you the flexibility to stop OTA operation midway.
Return
• ESP_ERR_HTTPS_OTA_IN_PROGRESS: OTA update is in progress, call this API again to con-
tinue.
• ESP_OK: OTA update was successful
• ESP_FAIL: OTA update failed
• ESP_ERR_INVALID_ARG: Invalid argument
• ESP_ERR_OTA_VALIDATE_FAILED: Invalid app image
• ESP_ERR_NO_MEM: Cannot allocate memory for OTA operation.
• ESP_ERR_FLASH_OP_TIMEOUT or ESP_ERR_FLASH_OP_FAIL: Flash write failed.
• For other return codes, refer OTA documentation in esp-idf's app_update component.
Parameters
• [in] https_ota_handle: pointer to esp_https_ota_handle_t structure
bool
esp_https_ota_is_complete_data_received(esp_https_ota_handle_t
Checks if complete data was received or not.
Note This API can be called just before esp_https_ota_finish() to validate if the complete image was indeed
received.
Return
• false
• true
Parameters
• [in] https_ota_handle: pointer to esp_https_ota_handle_t structure
esp_err_t esp_https_ota_finish(esp_https_ota_handle_t
Clean-up HTTPS OTA Firmware upgrade and close HTTPS connection.
Espressif Systems
esp_http_client_config_t
*handle)
esp_https_ota_config_t
https_ota_handle)
828
Submit Document Feedback
structure.
*ota_config,
esp_https_ota_handle_t
structure
https_ota_handle)
https_ota_handle)
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Table of Contents

Save PDF