Skip to content

Failure after update from 0.2.3 to 0.2.4 #115

@DaliborGuga

Description

@DaliborGuga
  • Arduino board: ESP32-Wroom-32 (esp32dev)

  • Arduino IDE version (found in Arduino -> About Arduino menu): Platformio arduinoespressif32 @ 3.20004.0 (2.0.4)

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):

I had a fully functional OTA on local web server (https secure, with certificate, with JSON and firmware and spiffs files served)
With versión 0.2.3 works like a charm, with 0.2.4 (or 0.2.5) the execution enters in a loop while attemping to connect


CODE:

#include <Arduino.h>
#include <WiFi.h>
#include <FS.h>
#include <SPIFFS.h>

#include <esp32fota.h>
#include <../include/esp32fota.hpp>
#include <esp_task_wdt.h>

// #include <../include/connect.hpp>
// #include <../include/Ota_Guga.cpp>

esp32FOTA FOTA;
CryptoFileAsset *MyRootCA = new CryptoFileAsset( "/root_ca.pem", &SPIFFS );

uint16_t retry_update = 0;
bool ota_returned;
bool updatedNeeded;

// Change to your WiFi credentials
const char *ssidSTA = "ESP";
const char *passwordSTA = "87654321";


void setup_wifi()
{
  delay(10);
  Serial.print("Connecting to ");
  Serial.println(ssidSTA);
  WiFi.begin(ssidSTA, passwordSTA);

  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
    esp_task_wdt_reset(); //Ver si es necesario ponerlo aquí
  }
  Serial.println("");
  Serial.println(WiFi.localIP());
}

void setup()
{
  SPIFFS.begin(true);
  Serial.begin(115200);
  setup_wifi();
 
  {
    auto cfg = FOTA.getConfig();    
    cfg.name          = "esp32-fota-http";
    cfg.manifest_url  = "https://192.168.0.30:443/fota.json";
    cfg.sem           = SemverClass( 1, 0, 0 ); // major, minor, patch
    cfg.check_sig     = false; // verify signed firmware with rsa public key
    cfg.unsafe        = false; // disable certificate check when using TLS
    cfg.root_ca       = MyRootCA; //En mem o spiffs funciona ok
    //cfg.pub_key       = MyRSAKey;
    //cfg.use_device_id = false;
    FOTA.setConfig( cfg );
  }  
  retry_update = 0;      
}

void loop()
{
  while(retry_update < 3)
  {
    updatedNeeded = FOTA.execHTTPcheck();
    if (updatedNeeded)
    {
        ota_returned = FOTA.execOTA();  //aca queda atrapado, si entró a OTA y se cae la conexión
    }
    if(ota_returned == true)
    {
        #ifdef VERBOSE_OTA
        Serial.print("Ota succesfully!");
        #endif
        break;
    }
    delay(2000);
    retry_update++;
  }
}

Working code compiling and linking data
{
Processing esp32dev (board: esp32dev; platform: https://github.com/platformio/platform-espressif32.git; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (5.1.0+sha.bb2d073) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:

  • framework-arduinoespressif32 @ 3.20004.0 (2.0.4)
  • tool-esptoolpy @ 1.30300.0 (3.3.0)
  • toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 34 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- ArduinoJson @ 6.19.4
    |-- esp32FOTA @ 0.2.3
    | |-- WiFiClientSecure @ 2.0.0
    | | |-- WiFi @ 2.0.0
    | |-- WiFi @ 2.0.0
    | |-- HTTPClient @ 2.0.0
    | | |-- WiFi @ 2.0.0
    | | |-- WiFiClientSecure @ 2.0.0
    | | | |-- WiFi @ 2.0.0
    | |-- ArduinoJson @ 6.19.4
    | |-- FS @ 2.0.0
    | |-- Update @ 2.0.0
    |-- FS @ 2.0.0
    |-- SPIFFS @ 2.0.0
    | |-- FS @ 2.0.0
    |-- WiFi @ 2.0.0
    |-- HTTPClient @ 2.0.0
    | |-- WiFi @ 2.0.0
    | |-- WiFiClientSecure @ 2.0.0
    | | |-- WiFi @ 2.0.0
    |-- LittleFS @ 2.0.0
    | |-- FS @ 2.0.0
    |-- SD @ 2.0.0
    | |-- FS @ 2.0.0
    | |-- SPI @ 2.0.0
    |-- SD_MMC @ 2.0.0
    | |-- FS @ 2.0.0
    |-- Update @ 2.0.0
    |-- WiFiClientSecure @ 2.0.0
    | |-- WiFi @ 2.0.0
    Building in debug mode
    Retrieving maximum program size .pio\build\esp32dev\firmware.elf
    Checking size .pio\build\esp32dev\firmware.elf
    Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
    RAM: [= ] 12.5% (used 40840 bytes from 327680 bytes)
    Flash: [======= ] 75.0% (used 982429 bytes from 1310720 bytes)
    }

With 0.2.4 the execution loops endlessly
{Monitor output with debug-level 5}

rst:0x1 (POWERON_RESET),boot:0x13 (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:2
load:0x3fff0030,len:1184
load:0x40078000,len:13132
load:0x40080400,len:3036
entry 0x400805e4
[␀␘␂␂␂��m␑um����2-hal-cpu.c:214] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
Connecting to ESP
[ 186][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 0 - WIFI_READY
[ 281][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
[ 279][V][WiFiGeneric.cpp:338] _arduino_event_cb(): STA Started
[ 287][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 2 - STA_START
..[ 1330][V][WiFiGeneric.cpp:360] _arduino_event_cb(): STA Disconnected: SSID: ESP, BSSID: 6c:5a:b0:d0:35:f6, Reason: 2
[ 1330][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED[ 1337][W][WiFiGeneric.cpp:950] _eventCallback(): Reason: 2 - AUTH_EXPIRE
[ 1344][D][WiFiGeneric.cpp:966] _eventCallback(): WiFi Reconnect Running
[ 1352][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
..[ 2455][V][WiFiGeneric.cpp:360] _arduino_event_cb(): STA Disconnected: SSID: ESP, BSSID: 6c:5a:b0:d0:35:f6, Reason: 2
[ 2456][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED[ 2462][W][WiFiGeneric.cpp:950] _eventCallback(): Reason: 2 - AUTH_EXPIRE
[ 2469][D][WiFiGeneric.cpp:975] _eventCallback(): WiFi AutoReconnect Running
[ 2478][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
..[ 3581][V][WiFiGeneric.cpp:360] _arduino_event_cb(): STA Disconnected: SSID: ESP, BSSID: 6c:5a:b0:d0:35:f6, Reason: 2
[ 3582][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED[ 3589][W][WiFiGeneric.cpp:950] _eventCallback(): Reason: 2 - AUTH_EXPIRE
[ 3595][D][WiFiGeneric.cpp:975] _eventCallback(): WiFi AutoReconnect Running
[ 3604][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
..[ 4708][V][WiFiGeneric.cpp:360] _arduino_event_cb(): STA Disconnected: SSID: ESP, BSSID: 6c:5a:b0:d0:35:f6, Reason: 2
[ 4709][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED[ 4716][W][WiFiGeneric.cpp:950] _eventCallback(): Reason: 2 - AUTH_EXPIRE
[ 4722][D][WiFiGeneric.cpp:975] _eventCallback(): WiFi AutoReconnect Running
[ 4731][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
...[ 5834][V][WiFiGeneric.cpp:360] _arduino_event_cb(): STA Disconnected: SSID: ESP,
BSSID: 6c:5a:b0:d0:35:f6, Reason: 2
[ 5835][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED[ 5842][W][WiFiGeneric.cpp:950] _eventCallback(): Reason: 2 - AUTH_EXPIRE
[ 5848][D][WiFiGeneric.cpp:975] _eventCallback(): WiFi AutoReconnect Running
[ 5857][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
..[ 6960][V][WiFiGeneric.cpp:360] _arduino_event_cb(): STA Disconnected: SSID: ESP, BSSID: 6c:5a:b0:d0:35:f6, Reason: 2
[ 6961][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED[ 6968][W][WiFiGeneric.cpp:950] _eventCallback(): Reason: 2 - AUTH_EXPIRE
[ 6975][D][WiFiGeneric.cpp:975] _eventCallback(): WiFi AutoReconnect Running
[ 6983][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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions