最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

esp32 - Platformio+VsCode OTA Upload defaults to "COMx" instead of IP - Stack Overflow

programmeradmin1浏览0评论

I'm trying to make an OTA on my ESP32. The cpp is OK and manually triggering the update works fine but when I click on VS Code on the "Upload" button, it defaults to "COMx" instead of the given IP.

Manual call:

python C:\Users\<user>\.platformio\packages\framework-arduinoespressif32\tools\espota.py --ip 192.168.178.51 --port 3232 --timeout 60 --file "firmware.bin" --debug

this works perfectly, I get the given firmware on my ESP.

Call via VS Code:

What I want now is to trigger the upload using PlatformIOs IDE buttons on VS code.

My plaftormio.ini file:

[env:az-delivery-devkit-v4]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
upload_port = 192.168.178.51
monitor_speed = 115200
; OTA
upload_protocol = espota
upload_flags =
    --port=3232
board_build.partitions = min_spiffs.csv
build_unflags = -Os
lib_compat_mode = strict
lib_deps =
    ArduinoOTA
    knolleary/PubSubClient@^2.8
    bblanchon/ArduinoJson@^7.2.0
    paulstoffregen/OneWire@^2.3.8
    milesburton/DallasTemperature@^3.11.0
    thomasfredericks/Bounce2@^2.72

I build the project -> all OK

When I click on UPLOAD, on the terminal I see:

Executing task: C:\Users\<user>\.platformio\penv\Scripts\platformio.exe run --target upload --upload-port COM5

Then it fails with the following information:

Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   8.2% (used 43848 bytes from 532480 bytes)
Flash: [====      ]  42.8% (used 841746 bytes from 1966080 bytes)
Configuring upload protocol...
AVAILABLE: 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 = espota
Uploading .pio\build\az-delivery-devkit-v4\firmware.bin
08:53:22 [DEBUG]: Options: {'esp_ip': 'COM5', 'host_ip': '0.0.0.0', 'esp_port': 3232, 'host_port': 30698, 'auth': '', 'image': '.pio\\build\\az-delivery-devkit-v4\\firmware.bin', 'spiffs': False, 'debug': True, 'progress': True, 'timeout': 10}
08:53:22 [INFO]: Starting on 0.0.0.0:30698
08:53:22 [INFO]: Upload size: 841856
Sending invitation to COM5 failed
08:53:24 [ERROR]: Host COM5 Not Found
*** [upload] Error 1

Why is the Upload-button not reading the target IP as set on the platformio.ini file and kept fixed to my COM5 (The serial port where my ESP32 was connected to when doing the initial download)? I already disconnected the ESP32 from my COM5 but PlatformIO is still defaulting to it.

I've removed and reinstalled the platformio IDE on VS Code, but the problem persists.

Any ideas how to fix this?

I'm trying to make an OTA on my ESP32. The cpp is OK and manually triggering the update works fine but when I click on VS Code on the "Upload" button, it defaults to "COMx" instead of the given IP.

Manual call:

python C:\Users\<user>\.platformio\packages\framework-arduinoespressif32\tools\espota.py --ip 192.168.178.51 --port 3232 --timeout 60 --file "firmware.bin" --debug

this works perfectly, I get the given firmware on my ESP.

Call via VS Code:

What I want now is to trigger the upload using PlatformIOs IDE buttons on VS code.

My plaftormio.ini file:

[env:az-delivery-devkit-v4]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
upload_port = 192.168.178.51
monitor_speed = 115200
; OTA
upload_protocol = espota
upload_flags =
    --port=3232
board_build.partitions = min_spiffs.csv
build_unflags = -Os
lib_compat_mode = strict
lib_deps =
    ArduinoOTA
    knolleary/PubSubClient@^2.8
    bblanchon/ArduinoJson@^7.2.0
    paulstoffregen/OneWire@^2.3.8
    milesburton/DallasTemperature@^3.11.0
    thomasfredericks/Bounce2@^2.72

I build the project -> all OK

When I click on UPLOAD, on the terminal I see:

Executing task: C:\Users\<user>\.platformio\penv\Scripts\platformio.exe run --target upload --upload-port COM5

Then it fails with the following information:

Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   8.2% (used 43848 bytes from 532480 bytes)
Flash: [====      ]  42.8% (used 841746 bytes from 1966080 bytes)
Configuring upload protocol...
AVAILABLE: 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 = espota
Uploading .pio\build\az-delivery-devkit-v4\firmware.bin
08:53:22 [DEBUG]: Options: {'esp_ip': 'COM5', 'host_ip': '0.0.0.0', 'esp_port': 3232, 'host_port': 30698, 'auth': '', 'image': '.pio\\build\\az-delivery-devkit-v4\\firmware.bin', 'spiffs': False, 'debug': True, 'progress': True, 'timeout': 10}
08:53:22 [INFO]: Starting on 0.0.0.0:30698
08:53:22 [INFO]: Upload size: 841856
Sending invitation to COM5 failed
08:53:24 [ERROR]: Host COM5 Not Found
*** [upload] Error 1

Why is the Upload-button not reading the target IP as set on the platformio.ini file and kept fixed to my COM5 (The serial port where my ESP32 was connected to when doing the initial download)? I already disconnected the ESP32 from my COM5 but PlatformIO is still defaulting to it.

I've removed and reinstalled the platformio IDE on VS Code, but the problem persists.

Any ideas how to fix this?

Share Improve this question asked Nov 19, 2024 at 11:09 ÑhoskoÑhosko 8052 gold badges10 silver badges29 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The problem was the "Set upload/monitor/test port" on VS Code was not set to AUTO, but to COM5.

Setting it to AUTO fixed the issue.

发布评论

评论列表(0)

  1. 暂无评论