Espota which comes with the platform package response an error, and won't find a connection

Hi all,

I’m new with the PlatformIO environment.
I’m about to create a project, where I can do firmware updates via OTA and I tried the easy example at first.

After prepared my ESP8266 (ESP12F) via USB/UART I should be able to do the next upload via OTA, but I got an error and the espota tool does not find my ESP. The ESP is located in the same WIFI and I can ping it.
When I do the same call with the espota tool which is installed with the ESP-IDF which I got when I added the git repo to the ArduinoIDE it works as expected. (because of that I don’t think I have firewall issues)

What am I doing wrong? (I know this is a very open query :slight_smile: )
Does anybody have some further hints about the possible reason for that?

Many thanx and
all the best
Michael

Hi @michael.meisinger.mm !

What’s the content of the platformio.ini and which exact error do you get?

Hi sivar2311,
many thanx for the quick response

[env:ota_upload]
platform = espressif8266
board = esp12e
framework = arduino
;build_flags = -D PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH

defines = OTA_ENABLED
lib_deps = 
    pubsubclient
    arduinojson
    ntpclient

upload_protocol = espota
;upload_port = 192.168.1.XX   ; IP-Adresse des ESP8266
upload_port = 10.10.1.69
upload_flags =
    --port=3232              ; Standard-OTA-Port
    ;--auth=fifi              ; Optionales Passwort

The output of the upload attempt is:

08:51:22 [DEBUG]: Options: {'esp_ip': '10.10.1.69', 'host_ip': '0.0.0.0', 'esp_port': 3232, 'host_port': 32853, 'auth': 'fifi', 'image': '.pio\\build\\ota_upload\\firmware.bin', 'spiffs': False, 'debug': True, 'progress': True}
08:51:22 [INFO]: Starting on 0.0.0.0:32853
08:51:22 [INFO]: Upload size: 333616
08:51:22 [INFO]: Sending invitation to: 10.10.1.69
08:51:32 [ERROR]: No Answer
*** [upload] Error 1

When I try the parameters within a commandline with the espota which is part of the arduinoIDE Boardpackage it works. But I’d like to switch to VSCode with PlatformIO since the features of the editor are much nicer.

I’m confused about that.

Remove this except you have in your code ArduinoOTA.setPort(3232);!
On ESP8266 and the default port is 8266.
The port 3232 is used on ESP32.

General rule:
Only set flags or settings when you really need it.

Also remove this:

That’s not valid at all.

If you want to define a macro in your platformio.ini you have to do it this way:

build_flags = 
  -D OTA_ENABLED

See build_flags — PlatformIO latest documentation

Many thanx, I did it …

One additional point I stumbled was the selected port. It shall be set to ‘Auto’ and it works.
Phuuuu … jipiiiieee

1 Like