BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

ESP32 - Edgent - OTA Not Working

Hi,

I’m having an issue trying ot update firmware for a device from Blynk Console since a few days.

I’m testing on my lab now, and I don’t know why, the OTA is not working.

The device is an ESP32

I’m using Arduino IDE 2.0.1

I can compile and upload the sketch using USB cable and it works fine. That make me think the sketch is OK.

I noticed two bin files created by the Export Compiled Binary, But It look this is usual with ESP32

image

The Serial console shows the following messages:

18:46:51.156 -> [2296346] Disconnected

18:46:51.156 -> [2296346] RUNNING => OTA_UPGRADE

18:46:51.204 -> [2296347] Firmware update URL: http://ny3.blynk.cloud/static/fw_3148441001967791257_-838595071.bin?token=4uUfCoSfmqnv6GDlRMAOe-2yK651jG

18:46:56.676 ->

18:46:56.676 -> ELF file SHA256: 0000000000000000

18:46:56.676 ->

18:46:56.676 -> Backtrace: 0x4008889c:0x3ffbfac0 0x40088b19:0x3ffbfae0 0x4015ef74:0x3ffbfb00 0x400870b9:0x3ffbfb20 0x4000bfed:0x3ffcedb0 0x4008ac9d:0x3ffcedc0 0x4008990f:0x3ffcede0 0x4014839e:0x3ffcee20 0x4014008d:0x3ffcee40 0x400d8219:0x3ffcee60 0x400d827e:0x3ffcee90 0x400d82e9:0x3ffceeb0 0x400d86de:0x3ffceed0 0x4017283a:0x3ffcef00 0x400e0eb9:0x3ffcef30 0x400e0ee5:0x3ffcef50 0x401726ed:0x3ffcef70 0x400de8ef:0x3ffcef90 0x400d31cf:0x3ffcefb0 0x400d6ef3:0x3ffcf0a0 0x40089b2a:0x3ffcf0c0

18:46:56.739 ->

18:46:56.739 -> Rebooting...

18:46:56.739 -> ets Jun 8 2016 00:22:57

18:46:56.739 ->

18:46:56.739 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)

 18:46:56.739 -> configsip: 0, SPIWP:0xee
18:46:56.739 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
18:46:56.739 -> mode:DIO, clock div:1
18:46:56.739 -> load:0x3fff0018,len:4
18:46:56.739 -> load:0x3fff001c,len:1044
18:46:56.739 -> load:0x40078000,len:10124
18:46:56.739 -> load:0x40080400,len:5856
18:46:56.739 -> entry 0x400806a8
18:46:57.106 -> Iniciando App
18:46:57.229 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 0 - WIFI_READY
18:46:57.229 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 2 - STA_START
18:46:57.229 -> [142] 
18:46:57.229 ->     ___  __          __
18:46:57.229 ->    / _ )/ /_ _____  / /__
18:46:57.229 ->   / _  / / // / _ \/  '_/
18:46:57.229 ->  /____/_/\_, /_//_/_/\_\
18:46:57.229 ->         /___/ v1.1.0 on ESP32
18:46:57.229 -> 
18:46:57.229 ->  #StandWithUkraine    https://bit.ly/swua
18:46:57.229 -> 
18:46:57.229 -> 
18:46:57.229 -> [157] --------------------------
18:46:57.275 -> [160] Product:  ESP32 Lamp SunnyReef
18:46:57.275 -> [163] Firmware: 0.3.60 (build Nov  5 2022 15:27:39)
18:46:57.275 -> [163] Firmware: 0.3.60 (build Nov  5 2022 15:27:39)
18:46:57.276 -> [168] Token:    dzvN - •���•• - ���••• - ••��•
18:46:57.276 -> [173] Device:   ESP32 @ 240MHz
18:46:57.276 -> [176] MAC:      C8:C9:A3:CF:84:60
18:46:57.276 -> [179] Flash:    4096K
18:46:57.276 -> [181] ESP sdk:  v3.Inicia actualizaLuzTemp
18:46:57.901 -> Lee hora :0:0
18:46:57.902 -> Lee posmem
18:46:57.902 -> Lee posmem
18:46:57.902 -> Lee posmem
18:46:57.902 -> Lee posmem
18:46:57.902 -> Potencia = 0
18:46:57.902 -> Potencia = 0
18:46:57.902 -> Potencia = 0
18:46:57.902 -> Potencia = 0
18:47:00.180 -> [3081] Using Dynamic IP: 192.168.100.42
18:47:00.180 -> [3081] CONNECTING_NET => CONNECTING_CLOUD
18:47:00.180 -> [3092] Connecting to blynk.cloud:443
18:47:01.773 -> [4670] Certificate OK
18:47:01.962 -> [4883] Ready (ping: 211ms).
18:47:02.291 -> [5178] Time sync: OK
18:47:02.524 -> [5446] Time sync: OK
18:47:02.603 -> [5508] CONNECTING_CLOUD => RUNNING

One important thing is that I’m using the dual core of the ESP32, running the Edgent in the Core0

void setup()
{
  int i;
  for (i = 0; i < 4; i = i + 1)
  {
    ledcSetup(i, LEDC_BASE_FREQ, LEDC_TIMER_12_BIT);
    ledcAttachPin(PWM_Digital_Canal[i], i);
  //  pinMode(PWM_Digital_Canal[i], OUTPUT);
  //  analogWrite(PWM_Digital_Canal[i], potCanal[i]*proteccion_temp / 100, 1023);
  }
  Serial.begin(115200); // See the connection status in Serial Monitor
  setSyncInterval(1);
  //rtc.begin();
  Serial.println("Iniciando App");
  pinMode(Relay, OUTPUT);
  BlynkEdgent.begin();
//  xTaskCreatePinnedToCore(loop2, "loop2", 4096, NULL, 1, NULL, 1);
  xTaskCreatePinnedToCore(loop1, "loop1", 4608, NULL, 0, NULL, 0);
  actualizaLuzTemp();
  timer.setInterval(60000, actualizaLuzTemp);
  timer.setInterval(5000, leeTemperatura);
  timer_Core0.setInterval(5000, envia_datos);
  setSyncInterval(60 * 60 * 24); // Sync interval in seconds (10 minutes)
}


    void loop1(void *pvParameters) //loop para procesos de BLYNK en Core0
    {
      while (1)
      {
        BlynkEdgent.run();
        timer_Core0.run();
        delay(1);
      }
    }

void loop() // loop para procesos de la Lámpara
{
  timer.run();
}

I has similar issues. I renamed the file with only .bin extension.

By default when we compile the sketch we get a file as

SketchName.ino.bin

It appears that having two dot + extension makes the system think its a wrong file type.

Try renaming.

That’s a good point.
Personally, I never use dots or spaces in my sketch file names, I prefer something like this…

my_test_sketch_v_1_2_3.ino

Pete.

Thanks for the hint, but it fails too.

I renamed the file to:
ESP32_Lampara_SunnyReef.bin

And the same result.

06:28:46.336 -> [236767] Disconnected
06:28:46.336 -> [236767] RUNNING => OTA_UPGRADE
06:28:46.336 -> [236767] Firmware update URL: http://ny3.blynk.cloud/static/fw_7356632057562922165_-838595071.bin?token=F9fQU630JZtdtV0uVScPfuMPMiVinU
06:28:50.470 -> Inicia actualizaLuzTemp
06:28:50.470 -> Lee hora :6:28
06:28:50.518 -> Lee posmem
06:28:50.518 -> Lee posmem
06:28:50.518 -> Lee posmem
06:28:50.518 -> Lee posmem
06:28:50.518 -> Potencia = 0
06:28:50.518 -> Potencia = 0
06:28:50.518 -> Potencia = 0
06:28:50.592 -> Potencia = 0
06:28:55.576 ->
06:28:55.576 -> ELF file SHA256: 0000000000000000
06:28:55.608 ->
06:28:55.608 -> Backtrace: 0x4008889c:0x3ffbfac0 0x40088b19:0x3ffbfae0 0x4015ef74:0x3ffbfb00 0x400870b9:0x3ffbfb20 0x4000bfed:0x3ffcee20 0x4008ac9d:0x3ffcee30 0x40089595:0x3ffcee50 0x401483b6:0x3ffcee90 0x401400dc:0x3ffceeb0 0x400d8219:0x3ffceed0 0x400d827e:0x3ffcef00 0x400d82e9:0x3ffcef20 0x400d86de:0x3ffcef40 0x4017283a:0x3ffcef70 0x400e0eb9:0x3ffcefa0 0x400e0ee5:0x3ffcefc0 0x401726ed:0x3ffcefe0 0x400de8ef:0x3ffcf000 0x400d31cf:0x3ffcf020 0x400d6ef3:0x3ffcf110 0x40089b2a:0x3ffcf130
06:28:55.608 ->
06:28:55.608 -> Rebooting...

Try to do a ota a with the edgent example with no extra codes. See if this works. If yes, then probably you have messed up few things.

I had to change my cores order to allow the OTA upgrade trough Blynk Console.

In my original sketch, I was using Core0 for the Edgent and Blynk comms processes. And Core1 (main) for my device own processes. For some reason, with this configuration, OTA fails.

I inverted the use of ESP32 cores , leaving Edgent and Blynk processes on Core1 and my device processes in Core0.

Changing only that, I was able to do the OTA.

Anybody know why this happens?