Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aspymid opened this issue May 27, 2024 · 9 comments
Open

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

aspymid opened this issue May 27, 2024 · 9 comments
Assignees
Labels
type: imperfection Perceived defect in any part of project

Comments

@aspymid
Copy link

aspymid commented May 27, 2024

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
@per1234 per1234 added the type: imperfection Perceived defect in any part of project label May 27, 2024
@andreagilardoni
Copy link
Contributor

andreagilardoni commented May 28, 2024

Hi @aspymid, can you provide me with more logs? add the following lines to your sketch:

void setup() {
   Debug.setDebugLevel(DBG_VERBOSE);
   ...
}

@aspymid
Copy link
Author

aspymid commented May 28, 2024

As requested ... debug output

rst:0x1 (POWERON_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0
[    28][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
[   483][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled
[   528][V][esp32-hal-uart.c:330] uartBegin(): UART0 baud(115200) Mode(800001c) rxPin(3) txPin(1)
[   537][V][esp32-hal-uart.c:416] uartBegin(): UART0 not installed. Starting installation
[   547][V][esp32-hal-uart.c:463] uartBegin(): UART0 initialization done.
Total heap:311156
Free heap: 283268
PSRAM INIT : 1
PSRAM Found : 1
Total PSRAM:4192123
Free PSRAM: 4192123
Total possible entrie in the datalogger: 21845
SD Card Type: SDHC
Connecting to WiFi network: home2
[  1607][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 0 - WIFI_READY
[  1678][V][WiFiGeneric.cpp:341] _arduino_event_cb(): STA Started
[  1679][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
[  1696][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 2 - STA_START
Waiting for WIFI connection...
[  1926][V][WiFiGeneric.cpp:356] _arduino_event_cb(): STA Connected: SSID: home2, BSSID: 00:e1:b0:53:40:12, Channel: 7, Auth: WPA2_PSK
[  1938][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 4 - STA_CONNECTED
[  5466][V][WiFiGeneric.cpp:370] _arduino_event_cb(): STA Got New IP:10.0.2.105
[  5474][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 7 - STA_GOT_IP
[  5481][D][WiFiGeneric.cpp:1103] _eventCallback(): STA IP: 10.0.2.105, MASK: 255.255.255.0, GW: 10.0.2.2
WiFi connected! IP address: 10.0.2.105
[  5510][V][esp32-hal-uart.c:330] uartBegin(): UART1 baud(115200) Mode(800001c) rxPin(27) txPin(26)
[  5519][V][esp32-hal-uart.c:416] uartBegin(): UART1 not installed. Starting installation
[  5528][V][esp32-hal-uart.c:463] uartBegin(): UART1 initialization done.
Start modem...

<< deleted application traces that are not relevant >>

[ 12437][V][esp32-hal-uart.c:330] uartBegin(): UART2 baud(9600) Mode(800001c) rxPin(22) txPin(21)
[ 12446][V][esp32-hal-uart.c:416] uartBegin(): UART2 not installed. Starting installation
[ 12454][V][esp32-hal-uart.c:463] uartBegin(): UART2 initialization done.
httpd_setup - Starting web server on port: '80'
UTC time: 2024-05-28 14:21:36
Local time: 2024-05-28 10:21:36
Sending: /wait.gif
Starting copy
filename="wait.gif"
Content-Length: 1866
Done!
Updating ddns
Hostname=GPS-SMS, Domain=ddns.chez-midan.com, FQN=GPS-SMS.ddns.chez-midan.com -> Waiting!
DDNS update success
<<AT+CPMUTEMP>>(11)
<<OK>>(2)
Initializing OTA storage
[ 62972][D][Updater.cpp:139] begin(): OTA Partition: app1
Starting download to flash ...
From location: http://10.0.2.115/OTA_Files/GPS_SMS.ino.ota?62980
Arduino_ESP_OTA::download failed with error code -1114271108
<<AT+CPMUTEMP>>(11)
<<OK>>(2)

Thanks!

@aspymid
Copy link
Author

aspymid commented May 28, 2024

The sketch compilation stats:

Sketch uses 1142985 bytes (58%) of program storage space. Maximum is 1966080 bytes.
Global variables use 52760 bytes (16%) of dynamic memory, leaving 274920 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.5.1
Serial port /dev/ttyACM1
Connecting..........
Chip is ESP32-D0WD-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 08:d1:f9:c1:45:70
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00128fff...
Compressed 18992 bytes to 13110...
Writing at 0x00001000... (100 %)
Wrote 18992 bytes (13110 compressed) at 0x00001000 in 0.5 seconds (effective 299.6 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.1 seconds (effective 338.8 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 466.5 kbit/s)...
Hash of data verified.
Compressed 1149568 bytes to 734209...
Writing at 0x00010000... (2 %)
 ... 
Writing at 0x00113d4a... (93 %)
Writing at 0x00119109... (95 %)
Writing at 0x0011eab9... (97 %)
Writing at 0x00123f64... (100 %)
Wrote 1149568 bytes (734209 compressed) at 0x00010000 in 11.8 seconds (effective 776.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

@arduino-libraries arduino-libraries deleted a comment from aspymid May 29, 2024
@andreagilardoni
Copy link
Contributor

I see that in your path you have added a query string in your url. Can you try it with an url without it? I think the issue may be there.

@aspymid
Copy link
Author

aspymid commented May 30, 2024

I did remove the parameter string. It did not change anything. I will be doing more testing.

@andreagilardoni
Copy link
Contributor

In this branch I added the possibility to include the query string, can you try with this also? https://github.com/arduino-libraries/Arduino_ESP32_OTA/tree/download-improvements

@aspymid
Copy link
Author

aspymid commented May 31, 2024

I got the original release 3.0 version of the code to work by adding code to stop and flush the Serial devices that are used by the application. as follows :

  sprintf(loc, "%s?%d", OTA_FILE_LOCATION, millis());  // defeat caches
  Serial.printf("From location: %s\n", loc);

  Serial.flush();
  Serial1.flush();
  Serial2.flush();
  Serial1.end();
  Serial2.end();
  Serial.end();
  int ota_download = ota.download(loc);
  Serial.begin(115200);
  if (ota_download <= 0) {
    Serial.print("Arduino_ESP_OTA::download failed with error code ");
    Serial.println(ota_download);
    esp_restart();
  }

  Serial.print(ota_download);
  Serial.println(" bytes stored.");

PS I had to shutdown the wifi softap also.

@pennam
Copy link
Collaborator

pennam commented Nov 28, 2024

@aspymid do you mind checking if your issue is solved with the 3.0.1 release?

@per1234 per1234 added the status: waiting for information More information must be provided before work can proceed label Nov 28, 2024
@aspymid
Copy link
Author

aspymid commented Nov 28, 2024

  • I updated the library in Arduino.
  • I compiled and loaded via USB.
  • I compiled and exported a binary for use by OTA.
  • I loaded via OTA

... and it worked first time and everytime without any code changes.
... Looks good. I will advise if things change.
PS Remeber that I had taken a few steps to ensure that the older version worked most of the time.
Thanks!

@per1234 per1234 removed the status: waiting for information More information must be provided before work can proceed label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

4 participants