ESP32Custom Platformio OTA update error

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
PandCall
Normal user
Posts: 44
Joined: 22 Sep 2022, 20:04

ESP32Custom Platformio OTA update error

#1 Post by PandCall » 15 Jul 2023, 13:49

Environement
ESP32
PlatformIO
Project Task custom_ESP32_4M316K

-----------------------------------------------------------------------
The first ESP flash on the COM18 pot is no problem,Everything works fine
Now I'd like to update with the OTA function to add sensors, for example.

I've changed this part in my platformio.ini file.

[espota]
upload_protocol = espota
; each flag in a new line
; Do not use port 8266 for OTA, since that's used for ESPeasy p2p
upload_flags_esp8266 =
--port=18266
upload_flags_esp32 =
--port=3232
build_flags = -DFEATURE_ARDUINO_OTA=1
upload_port = 192.168.69.75

and Custom.h file
#define FEATURE_ARDUINO_OTA 1 //enables the Arduino OTA capabilities

After my first connection
Info Board
Info Board
OTA-Board.png (111.18 KiB) Viewed 1188 times
During the upload procedure I get this message

OTA update message
Warning! We have just detected `upload_port` as IP address or host name of ESP device. `upload_protocol` is switched to `espota`.
Please specify `upload_protocol = espota` in `platformio.ini` project configuration file.

I think it's just information.

But then I get a message telling me that the ESP on the IP hasn't responded and the upload isn't done.

Uploading .pio\build\custom_ESP32_4M316k\ESP_Easy_mega_20230715_custom_ESP32_4M316k.bin
13:22:11 [DEBUG]: Options: {'esp_ip': '192.168.69.75', 'host_ip': '0.0.0.0', 'esp_port': 3232, 'host_port': 36700, 'auth': '', 'image': '.pio\\build\\custom_ESP32_4M316k\\ESP_Easy_mega_20230715_custom_ESP32_4M316k.bin', 'spiffs': False, 'debug': True, 'progress': True, 'timeout': 10}
13:22:11 [INFO]: Starting on 0.0.0.0:36700
13:22:11 [INFO]: Upload size: 1098640
Sending invitation to 192.168.69.75 ..........
13:22:11 [ERROR]: No response from the ESP
*** [upload] Error 1
The terminal process "C:\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload', '--environment', 'custom_ESP32_4M316k', '--upload-port', '192.168.69.75'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.

In platformio I've set the ports to Auto or forced the IP, but that doesn't change anything.

If I reconnect the ESP to the COM18 port, I have no problem updating the ESP and my new sensors.

Two questions
Is OTA updating possible from platformio?
If yes
Did I forget anything in my configuration to be able to remotely update ESPs?

Last test:
If I use the web interface to update the BIN file
.pio\build\custom_ESP32_4M316k\ESP_Easy_mega_20230715_custom_ESP32_4M316k.bin
It works fine, the ESP is updated with my new sensors.

Update Success! Rebooting...

Best regards

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32Custom Platformio OTA update error

#2 Post by TD-er » 15 Jul 2023, 22:29

I have never used OTA update from PlatformIO myself.
So it is very well possible I may have forgotten something in the PIO config.

PandCall
Normal user
Posts: 44
Joined: 22 Sep 2022, 20:04

Re: ESP32Custom Platformio OTA update error

#3 Post by PandCall » 15 Jul 2023, 22:33

Don't hesitate if you'd like me to try them out for you. ;)

There's nothing urgent at the moment, uploading the binary works with the Web interface, it's just one more step, nothing serious.

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESP32Custom Platformio OTA update error

#4 Post by Ath » 15 Jul 2023, 23:09

[-]For ESP8266 you seem to have set the port number to 18266, but the max possible portnr is 65535, so your setting is not valid[-]

Edit: I was probably wearing my glasses upside down when I wrote that, missing a number on my side, sorry
/Ton (PayPal.me)

PandCall
Normal user
Posts: 44
Joined: 22 Sep 2022, 20:04

Re: ESP32Custom Platformio OTA update error

#5 Post by PandCall » 16 Jul 2023, 09:41

Hello Ath,
I don't understand the meaning of what you're telling me.
It probably makes sense, but... :)

You're telling me that the port is greater than what is allowed 65534
That my ESP8266 port is 18266
For me, 18266 is well below 65534 ;)

And I haven't changed these ports, that's what's in the Custom.h example file, but as you say, you haven't specially tested this function, so you probably have a good reason for telling me that.

And since I'm using an ESP32, port 3232 should be used instead?

Dans le doute, j'ai testé le port
upload_flags_esp8266 =
--port=3231
upload_flags_esp32 =
--port=3232
build_flags = -DFEATURE_ARDUINO_OTA=1
upload_port = 192.168.69.75

Mais cela ne change rien.

Uploading .pio\build\custom_ESP32_4M316k\ESP_Easy_mega_20230716_custom_ESP32_4M316k.bin
09:35:23 [DEBUG]: Options: {'esp_ip': '192.168.69.75', 'host_ip': '0.0.0.0', 'esp_port': 3232, 'host_port': 19897, 'auth': '', 'image': '.pio\\build\\custom_ESP32_4M316k\\ESP_Easy_mega_20230716_custom_ESP32_4M316k.bin', 'spiffs': False, 'debug': True, 'progress': True, 'timeout': 10}
09:35:23 [INFO]: Starting on 0.0.0.0:19897
09:35:23 [INFO]: Upload size: 1110560
Sending invitation to 192.168.69.75 ..........
09:35:23 [ERROR]: No response from the ESP
*** [upload] Error 1

I'm going to look at the ESPTOOL parameters because this line seems strange to me
Starting on 0.0.0.0:19897

Regards

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32Custom Platformio OTA update error

#6 Post by TD-er » 16 Jul 2023, 11:16

I think Ton was tired due to the weather as 18266 is indeed < 65535 :)


It looks like you need to specify the

Code: Select all

upload_flags = ${espota.upload_flags_esp32}
For ESP32 builds
And for ESP8266 builds:

Code: Select all

upload_flags = ${espota.upload_flags_esp8266}
This in your platformio.ini files for your custom builds.

PandCall
Normal user
Posts: 44
Joined: 22 Sep 2022, 20:04

Re: ESP32Custom Platformio OTA update error

#7 Post by PandCall » 17 Jul 2023, 09:53

Hello,
Merci poir ces infos,
Not sure exactly where to place this line.
But I tested this

[platformio]
default_envs = custom_ESP32_4M316k

[espota]
upload_protocol = espota
; each flag in a new line
; Do not use port 8266 for OTA, since that's used for ESPeasy p2p
upload_flags_esp8266 =
--port=18266
upload_flags_esp32 =
upload_flags = ${espota.upload_flags_esp32}
--port=3232
build_flags = -DFEATURE_ARDUINO_OTA=1
upload_port = 192.168.69.75

I'm having trouble understanding the line

upload_flags_esp32 =
and
upload_flags = ${espota.upload_flags_esp32}

Which seem very similar.


But always the upload error.

Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-bridge, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Uploading .pio\build\custom_ESP32_4M316k\ESP_Easy_mega_20230717_custom_ESP32_4M316k.bin
09:22:18 [DEBUG]: Options: {'esp_ip': '192.168.69.75', 'host_ip': '0.0.0.0', 'esp_port': 3232, 'host_port': 19904, 'auth': '', 'image': '.pio\\build\\custom_ESP32_4M316k\\ESP_Easy_mega_20230717_custom_ESP32_4M316k.bin', 'spiffs': False, 'debug': True, 'progress': True, 'timeout': 10}
09:22:18 [INFO]: Starting on 0.0.0.0:19904
09:22:18 [INFO]: Upload size: 1102480
Sending invitation to 192.168.69.75
09:22:18 [INFO]: Waiting for device...
09:22:28 [ERROR]: No response from device
*** [upload] Error 1

Regards

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32Custom Platformio OTA update error

#8 Post by TD-er » 17 Jul 2023, 12:07

You can't refer to items in the same block where it is being referred to.

So this must be placed in the block for custom_ESP32_4M316k (assuming that's the one you're building)

Code: Select all

[platformio]
default_envs = custom_ESP32_4M316k

[espota]
upload_protocol = espota
; each flag in a new line
; Do not use port 8266 for OTA, since that's used for ESPeasy p2p
upload_flags_esp8266 =
--port=18266
upload_flags_esp32 =
--port=3232
build_flags = -DFEATURE_ARDUINO_OTA=1
upload_port = 192.168.69.75
And somewhere in the block you're building:

Code: Select all

[env:custom_ESP32_4M316k]
....
upload_flags = ${espota.upload_flags_esp32}
N.B. the ... are just to indicate that there's other stuff in that block you should leave as it is.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 37 guests