OTA ESP32 Problems

Hello, I’m trying to do an OTA test with ESP32, but it doesn’t work for me.
My code (is the Edgent_ESP32 Blynk example on Arduino IDE):


/*************************************************************
  Blynk is a platform with iOS and Android apps to control
  ESP32, Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build mobile and web interfaces for any
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: https://www.blynk.io
    Sketch generator:           https://examples.blynk.cc
    Blynk community:            https://community.blynk.cc
    Follow us:                  https://www.fb.com/blynkapp
                                https://twitter.com/blynk_app

  Blynk library is licensed under MIT license
 *************************************************************
  Blynk.Edgent implements:
  - Blynk.Inject - Dynamic WiFi credentials provisioning
  - Blynk.Air    - Over The Air firmware updates
  - Device state indication using a physical LED
  - Credentials reset using a physical Button
 *************************************************************/

/* Fill in information from your Blynk Template here */
/* Read more: https://bit.ly/BlynkInject */
#define BLYNK_TEMPLATE_ID "xxxxxxxxxxxxxxx"     <-I put the right thing here
#define BLYNK_TEMPLATE_NAME "xxxxxxxx"			<-I put the right thing here

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
#define USE_ESP32_DEV_MODULE
//#define USE_ESP32C3_DEV_MODULE
//#define USE_ESP32S2_DEV_KIT
//#define USE_WROVER_BOARD
//#define USE_TTGO_T7
//#define USE_TTGO_T_OI

#include "BlynkEdgent.h"


void setup()
{
  Serial.begin(115200);
  delay(100);

  BlynkEdgent.begin();
}

void loop() {
  BlynkEdgent.run();
}

I follow the steps, but shouldn’t I include my WIFI credentials somewhere?

Thanks and apologies but it’s been two days and I can’t make progress.

My console log:


ets Jul 29 2019 12:21:46

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:1
load:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0
[225] Config read failed
[225] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.3.0 on ESP32

 #StandWithUkraine    https://bit.ly/swua


----------------------------------------------------
 Device:    xxxxxxxxxxxxxxxxxxxxx
 Firmware:  0.1.0 (build Aug 13 2023 12:07:31)
 Platform:  ESP32 @ 240MHz
 Chip rev:  3
 SDK:       v4.4.5
 Flash:     4096K
 Free mem:  208708
----------------------------------------------------

>[267] INIT => WAIT_CONFIG
[2884] AP URL:  blynk.setup

Please edit your post and place triple backticks at the beginning and end of your serial monitor output (the same as you did with your code) so that it displays correctly.

Have you provisioned your device in the app?
Is your device showing as online in the web console and app?

Pete.

1 Like

Edit, sorry and thanks for the advice Pete.

Yes the device is registered in the app, but it is displayed offline. Any Blynk example that is NOT OTA works correctly and in them the device appears online, but un this sample Blynk OTA it shows offline.

But, in order for the device show up online, wouldn’t it be necessary to include the SSID and my Wi-Fi credentials in the Blynk sample code somehow?

What exactly does this mean?

No, that’s not how the Edgent sketch works.
With Edgent you don’t include the Auth token, SSID or WiFi password. These are assigned dynamically and stored in EEPROM when you provision the device in the app via the “+ Add Device” option. This also creates the device in the app and web console.

I suspect that you’ve manually created a device from your template, which you shouldn’t be doing with Edgent.

Delete the device then go to the app and hit the “+ Add Device” then add follow the instructions.

If you just want to add OTA to an existing non-Edgent sketch then there’s an easier way, which is described here…

Pete.

1 Like

Ok Pete, thanks.

I try what you tell me in a while and I’ll comment how it goes.

Hello again. I have erased the device, and I have included it following the steps of the Quickstart (load sketch generate by Quickstart). The device is perfectly added, and appears online.

Then, I load that same Blynk Edgent sample sketch (changing the new BLYNK_TEMPLATE_ID and the BLYNK_TEMPLATE_NAME), and as soon as I load the Blynk sample sketch Edgent in the ESP32 device, it goes offline (well, it takes a while to refresh), and the problem persists :sleepy:

I have erased the ESP32 device twice just in case, but in both cases the same result…

New log serial monitor:


ets Jul 29 2019 12:21:46

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:1
load:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0
[228] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.3.0 on ESP32

 #StandWithUkraine    https://bit.ly/swua


----------------------------------------------------
 Device:    Blynk Quickstart Template-3CDY
 Firmware:  0.1.1 (build Aug 13 2023 20:41:17)
 Platform:  ESP32 @ 240MHz
 Chip rev:  3
 SDK:       v4.4.5
 Flash:     4096K
 Free mem:  208516
----------------------------------------------------

>[270] INIT => WAIT_CONFIG
[2887] AP URL:  blynk.setup

Why are you using the QuickStart example if you wnat to use Edgent?

The two work totally differently. The QuickStart example uses static provisioning and Edgent uses dynamic provisioning.

If you want to do OTA you have two options…

  1. use the quickstart example and manually add-in the appropriate code for your particular board from the minimal OTA link I provided.

  2. delete everything again, open the Edgent example, insert the two lines of Firmware Configuration from your Template (I’d suggest creating a new template for this, not using the QuickStart template you already have) upload the code and hit “+ Add Device” in the app and follow the instructions.

Pete.

1 Like

Thanks again Pete, but nothing, I have deleted the previous device and the template in Blynk. I have created a new template, I have entered the BLYNK_TEMPLATE_ID and the BLYNK_TEMPLATE_NAME in the Blynk Edgent example sketch (and uncomment the #define of my board), and without touching anything else I have I have uploaded to the ESP32. Then I clicked Add first Device (in Blynk templates), but it still appears offline.

What does your serial monitor show?

What board is this exactly?
Which board type did you choose?
Have you checked that the entry in Settings.h for that board type does actually correspond with the GPIOs of the LED and switch on your board?
Was the LED on your board flashing as described in the provisioning instructions in the app when you provisioned the WiFi credentials?

Pete.

1 Like

It finally works!!!

I got the idea from your last two messages Pete, which you say:

or

After creating the Template, I added the device from the Blynk web, not from the app (smartphone), and when I did it with the app, appears the place to include the Wi-Fi credentials, and the rest of the things are working perfectly!!

I have already done two sample firmware updates and they have worked fine for me.

Thanks a lot Pete for your help. :wave: :+1: :wave:

I can’t make any sense of what this means, but I’m glad you have it working now!

Pete.

I mean I was adding the device in Blynk from PC and web browser and it didn’t work. I tried to add the device through the app with my android smartphone and then a window appeared in which to search for nearby devices (it asked me to activate the smartphone’s bluetooth and wifi), and when it found the device it asked me to enter my network data wifi etc.

Okay, makes more sense now - thanks for clarifying.

If you look back through the post you’ll see lots of references to adding the device through the app, via “+ Add Device” because that’s the only way to do it (at the moment) when you’re using Edgent.

Pete.