Skip to content

Arduino_ESP_OTA::download failed with error code -1114268484 #35

Open
@aspymid

Description

@aspymid

My code works fine with version 2.0 but fails with version 3.0.

The error given is as follows:

Arduino_ESP_OTA::download failed with error code -1114268484

This is on an ESP32 wrover system.

I had updated the root.ca.h file.

The code follows:

/******************************************************************************
 * INCLUDE
 ******************************************************************************/
#include "thisApp.h"
#include <esp_task_wdt.h> 
#ifdef OTA_FILE_LOCATION

#include <Arduino_ESP32_OTA.h>
#include "root_ca.h"

/******************************************************************************
 * SETUP/LOOP
 ******************************************************************************/

void do_OTA()
{
  esp_task_wdt_delete(NULL);
  Arduino_ESP32_OTA ota;
  Arduino_ESP32_OTA::Error ota_err = Arduino_ESP32_OTA::Error::None;

  /* Configure custom Root CA */
  ota.setCACert(root_ca);

  Serial.println("Initializing OTA storage");
  if ((ota_err = ota.begin()) != Arduino_ESP32_OTA::Error::None)
  {
    Serial.print  ("Arduino_ESP_OTA::begin() failed with error code ");
    Serial.println((int)ota_err);
    return;
  }

  Serial.println("Starting download to flash ...");
  char loc[100];
  sprintf(loc,"%s?%d",OTA_FILE_LOCATION,millis()); // defeat caches
  Serial.printf("From location: %s\n", loc);
  int const ota_download = ota.download( loc );
  if (ota_download <= 0)
  {
    Serial.print  ("Arduino_ESP_OTA::download failed with error code ");
    Serial.println(ota_download);
    return;
  }
  Serial.print  (ota_download);
  Serial.println(" bytes stored.");

  Serial.println("Verify update integrity and apply ...");
  if ((ota_err = ota.update()) != Arduino_ESP32_OTA::Error::None)
  {
    Serial.print  ("ota.update() failed with error code ");
    Serial.println((int)ota_err);
    return;
  }

  Serial.println("Performing a reset after which the bootloader will start the new firmware.");

  delay(1000); /* Make sure the serial message gets out before the reset. */
  ota.reset();
}
#else
void do_OTA()
{
  Serial.println("OTA_FILE_LOCATION is not defined.");
}
#endif

Metadata

Metadata

Labels

type: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions