Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with esp8266 OTA #417

Closed
igorjan opened this issue Dec 30, 2015 · 60 comments
Closed

Problems with esp8266 OTA #417

igorjan opened this issue Dec 30, 2015 · 60 comments
Assignees
Labels
Milestone

Comments

@igorjan
Copy link

igorjan commented Dec 30, 2015

When I try the OTA example found here:
https://github.com/esp8266/Arduino/blob/master/libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino

I encounterd when uploading the OTA script didn’t seem to recognize my input IP. I was getting:
14:21:38 [CRITICAL]: Not enough arguments.

It seems on windows you must specify upload port in ” ” like this.
upload_port = “192.168.1.40”

When I set the IP in " " I get this output when I do an upload:
esptool v0.4.6 – (c) 2014 Ch. Klippel
setting board to nodemcu
setting baudrate from 115200 to 115200
setting port from COM1 to 192.168.1.40
espcomm_upload_file
stat .pioenvs\nodemcu\firmware.bin success
error: Failed to open 192.168.1.40
error: espcomm_open failed
scons: *** [upload] Error -1
[ ERROR ]

Any Idea? I disabled the firewall and the IP is definitely OK. I tested the UDP port 8266 and it is open.
Also there is no activity on the serial monitor when I try OTA.

I think the problem is still in the IP address somehow it is not recognized properly.

@itsjustvenky
Copy link

@igorjan Can you try testing "ESPWebServer/HelloSever.ino" (inarduino ide examples) and see if you can access the mentioned IP-Address and also try to ping the ip-address and see if you get any response.

if you cannot access the ip-address, then its problem with your machine.

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

@itsjustvenky the HelloServer.ino works without a problem. I get "hello from esp8266!" in the web borwser.

I can ping the IP, also I tested the UDP port 8266 on the ESP which is used for OTA and it seems to be open.

@itsjustvenky
Copy link

@igorjan which version of platformio are you using ? and also can you try to upload the same code using arduino-ide and see if that works.

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

@itsjustvenky platformio version 2.6.3

@ivankravets
Copy link
Member

@igorjan try to specify IP as http://docs.platformio.org/en/latest/projectconf.html#upload-port . Don't pass it to console as argument.

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

Here you can see 3 attempts with different definitions of upload-port.

Attempt 1:
C:\Igor_i\ESP8266\Project1>platformio run --target upload --upload-port 192.168.1.40

[12/30/15 16:19:27] Processing nodemcu (platform: espressif, board: nodemcu, framework: arduino)

BeforeUpload(["upload"], [".pioenvs\nodemcu\firmware.bin"])
"C:\Users\igor.platformio\packages\framework-arduinoespressif\tools\espota.py"
--debug --progress -i 192.168.1.40 -f .pioenvs\nodemcu\firmware.bin
16:19:31 [CRITICAL]: Not enough arguments.
scons: *** [upload] Error 1
========================= [ ERROR ] Took 3.44 seconds =========================

Attempt 2:
C:\Igor_i\ESP8266\Project1>platformio run --target upload --upload-port "192.168.1.40"

[12/30/15 16:19:47] Processing nodemcu (platform: espressif, board: nodemcu, framework: arduino)

BeforeUpload(["upload"], [".pioenvs\nodemcu\firmware.bin"])
"C:\Users\igor.platformio\packages\framework-arduinoespressif\tools\espota.py"
--debug --progress -i 192.168.1.40 -f .pioenvs\nodemcu\firmware.bin
16:19:49 [CRITICAL]: Not enough arguments.
scons: *** [upload] Error 1
========================= [ ERROR ] Took 2.63 seconds =========================

Atempt 3
C:\Igor_i\ESP8266\Project1>platformio run --target upload --upload-port '192.168.1.40'

[12/30/15 16:20:16] Processing nodemcu (platform: espressif, board: nodemcu, framework: arduino)

BeforeUpload(["upload"], [".pioenvs\nodemcu\firmware.bin"])
"C:\Users\igor.platformio\packages\tool-esptool\esptool" -vv -cd nodemcu -cb 11
5200 -cp '192.168.1.40' -cf .pioenvs\nodemcu\firmware.bin
esptool v0.4.6 - (c) 2014 Ch. Klippel ck@atelier-klippel.de
setting board to nodemcu
setting baudrate from 115200 to 115200
setting port from COM1 to '192.168.1.40'
espcomm_upload_files
cons: *** [upload] Error -1stat .pioenvs\nodemcu\firmware.bin success

error: Failed to open '192.168.1.40'
error: espcomm_open failed
========================= [ ERROR ] Took 2.46 seconds =========================

@ivankravets
Copy link
Member

Please read my comment above #417 (comment). Don't pass IP to terminal. See example http://docs.platformio.org/en/latest/platforms/espressif.html#over-the-air-ota-update

Add this line to your platformio.ini

upload_port = 192.168.1.40

@skorokithakis
Copy link

Isn't this a windows/click/esptool problem? If windows tokenizes periods as separate tokens, you need to quote it if you want to pass it in the command line.

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

@ivankravets sorry I misunderstood you. I was doing it with platformio.ini file all along.

@ivankravets
Copy link
Member

@igorjan please wait for the new development version. I'll ask you to test it. 1-2mins

@ivankravets
Copy link
Member

@igorjan could you paste directly yo terminal this

"C:\Users\igor.platformio\packages\tool-esptool\esptool" -vv -cd nodemcu -cb 11
5200 -cp "192.168.1.40" -cf .pioenvs\nodemcu\firmware.bin

Does it work?

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

@ivankravets
c:\Users\igor.platformio\packages\tool-esptool>esptool.exe -vv -cd nodemcu -cb
115200 -cp "192.168.1.40" -cf C:\Igor_i\ESP8266\Project1.pioenvs\nodemcu\firmwa
re.bin
esptool v0.4.6 - (c) 2014 Ch. Klippel ck@atelier-klippel.de
setting board to nodemcu
setting baudrate from 115200 to 115200
setting port from COM1 to 192.168.1.40
espcomm_upload_file
stat C:\Igor_i\ESP8266\Project1.pioenvs\nodemcu\firmware.bin success
error: Failed to open 192.168.1.40
error: espcomm_open failed

@ivankravets
Copy link
Member

@igorjan STOP STOP 🙅

Did you upload OTA sketch before make OTA uploading?

@ivankravets
Copy link
Member

No here problems with IP. Looks like you didn't upload OTA sketch and din't configured it.

@itsjustvenky
Copy link

damn... we totally forgot the basic question...
yeah first we need to upload the OTA sketch and then next time we can do a upload via OTA

@ivankravets
Copy link
Member

@itsjustvenky :) 🍸 New Year...

@namoaton
Copy link

esp_OTA.zip

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

Yes I did have the OTA example uploaded via serial before trying OTA. I even changed some strings in the serial.print so I'm sure that the correct sketch is uploaded.

@ivankravets
Copy link
Member

@igorjan could you make SPIFFS OTA uploading using Arduino IDE? See https://github.com/esp8266/Arduino/blob/master/doc/filesystem.md#uploading-files-to-file-system

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

@namoaton tried your project it is the same

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

@ivankravets Will try arduino but have to install it first

@itsjustvenky
Copy link

@igorjan https://github.com/esp8266/Arduino/blob/master/doc/ota_updates/ota_updates.md

Try this arduino build : Arduino-PR-4107-BUILD-421

else you need to manually set the IP-Address in arduino preference files.

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

OK tried the arduino and it works without a problem. The sketch is the same.

@ivankravets
Copy link
Member

@igorjan print here platformio --version

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

c:\Users\User.platformio\packages\tool-esptool>platformio --version
PlatformIO, version 2.6.3

@itsjustvenky
Copy link

@igorjan

the actual command is

platformio run --target upload --upload-port 192.168.1.40

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

@itsjustvenky for your command I get:
C:\Igor_i\ESP8266\Project1>platformio run --target upload --upload-port 192.168.
1.40
[12/30/15 18:13:43] Processing nodemcu (platform: espressif, upload_port: 192.16

8.1.40, board: nodemcu, framework: arduino)

(["upload"], [".pioenvs\nodemcu\firmware.bin"])
"C:\Users\igor.platformio\packages\framework-arduinoespressif\tools\espota.py"
--debug --progress -i 192.168.1.40 -f .pioenvs\nodemcu\firmware.bin
18:13:45 [CRITICAL]: Not enough arguments.
scons: *** [upload] Error 1

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

@ivankravets if I remove the double qutes. I get the error:

18:13:45 [CRITICAL]: Not enough arguments.
scons: *** [upload] Error 1

The command python espota.py -i 192.168.1.40 -p8266 -f .pioenvs\nodemcu\firmware.bin
works without a problem.

@ivankravets
Copy link
Member

Ok, now please revert upload_port: "192.168.1.40" in platformio.ini.

@itsjustvenky
Copy link

@igorjan I think "ivankravets" just fixed something related this ip-address. Please install latest dev. version.

@ivankravets
Copy link
Member

I don't understand behaviour of your machine. Please revert back quotes. If it helps, I'll added them to code.

@ivankravets
Copy link
Member

@igorjan Could you try without TCP/IP port? espota.py -i 192.168.1.40 -f .pioenvs\nodemcu\firmware.bin. Does it work?

@skorokithakis
Copy link

@ivankravets notice that he's running esptool, not espota. Why would that work?

"C:\Users\igor.platformio\packages\tool-esptool\esptool" -vv -cd nodemcu -cb 115200 -cp "192.168.1.40" -cf .pioenvs\nodemcu\firmware.bin

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

OK this works too:

python espota.py -i 192.168.1.40 -f C:\Igor_i\ESP8266\Project1.pioenvs\nodemcu\firmware.bin

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

Also in version dev13 I get error

18:18:56 [CRITICAL]: Not enough arguments.

With or without qutes for upload port

@ivankravets
Copy link
Member

I've just pushed dev14. Please try it

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

Dev 14 is the same

18:18:56 [CRITICAL]: Not enough arguments.
With or without qutes for upload port

If you guys want I can give you team viewer access to the computer so you can test yourself

@skorokithakis
Copy link

@igorjan Can you paste your platformio.ini here?

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

[env:nodemcu]
platform = espressif
framework = arduino
board = nodemcu
upload_port = "192.168.1.40"

@ivankravets
Copy link
Member

Yes, please mail me@ikravets.com with TeamViewer Id/pass. Thanks

@itsjustvenky
Copy link

@igorjan can you post all the text from your console from the starting of platformio run...

@skorokithakis
Copy link

@igorjan You should surround your code with three tildes:

like this

@skorokithakis
Copy link

This seems to fix it (platformio/builder/scripts/espressif.py:233):

        upload_port = env.get("UPLOAD_PORT", "").strip("\"\' ")
        if (upload_port and (
                upload_port.endswith(".local") or
                socket.inet_aton(upload_port))):
            env.Replace(
                UPLOADCMD="$UPLOADOTACMD"
            )

@ivankravets
Copy link
Member

Guys, the problem was linked with launching espota.py. On this machine PyCharm IDE handles all Python files by default.

I'll fix it and paste directly current Python interpreter

@ivankravets
Copy link
Member

@igorjan please try the latest dev15

@igorjan
Copy link
Author

igorjan commented Dec 30, 2015

:) This one works without problem

Thank you guys for your help, really appreciate it.

@ivankravets
Copy link
Member

Thank you too that report it. I'm going to release 2.7.0 🎄 😊

@ivankravets ivankravets self-assigned this Dec 30, 2015
@ivankravets
Copy link
Member

@itsjustvenky, @skorokithakis and @namoaton - THANKS A LOT FOR THE HELP! 🍻

@skorokithakis
Copy link

Thanks for a great project, @ivankravets!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants