Visual Micro
https://www.visualmicro.com/forums/YaBB.pl
Visual Micro >> Visual Studio 2017, 2019 >> ESP8266 OTA upload
https://www.visualmicro.com/forums/YaBB.pl?num=1602813640

Message started by perigalacticon on Oct 16th, 2020 at 3:00am

Title: ESP8266 OTA upload
Post by perigalacticon on Oct 16th, 2020 at 3:00am
I would like to use the new ESP8266 OTA Debugging feature, but first I have to get the regular OTA to work.  I copied the example from "Full working ESP8266 OTA Code Example:-" from [url]https://www.visualmicro.com/page/esp8266.aspx[url].

The sketch uploads over FTDI Serial, I use Debug set to Off, and then I remove the programming mode pin (using ESP01) and reset the board.

The sketch runs and I get this output on the serial monitor:

Code (c++):
Opening port
Port open
Booting
Mode set
Begin complete
SSID: NETGEAR11
DHCP: Waiting for IP Address ...
IP Address: 192.168.1.5
Connected to wifi

and I see the port listed in the VM menu under "Port or IP".  I get output to the FTDI serial monitor periodically that I put in the code with a non-blocking simple timer.  Now I try to do the OTA upload.  I select the network port and then Build and Upload.  The error I get is:

Code (c++):
Uploading 'VM_ESP8266_OTA_Example' to 'Generic ESP8266 Module' using '192.168.1.5'
Authenticating...FAIL
The uploader process failed
21:42:37 [ERROR]: Authentication Failed

The only output on the Serial Monitor is:

Code (c++):
Error[0]: Auth Failed

I notice in the sketch the following 2 lines:

Code (c++):
// No authentication by default
ArduinoOTA.setPassword((const char *)"123");

I comment out the 2nd line, repeat the above process, and get this error with the line commented out:

Code (c++):
Uploading 'VM_ESP8266_OTA_Example' to 'Generic ESP8266 Module' using '192.168.1.5'
21:48:06 [ERROR]: No response from device
The uploader process failed

And the accompanying Serial monitor output:

Code (c++):
OTA Start
Progress: 0%
Error[2]: Connect Failed
Error[4]: End Failed


Could you please help me get this working? OTA debugging has a lot of potential.



Title: Re: ESP8266 OTA upload
Post by perigalacticon on Oct 16th, 2020 at 5:23am
Some further information:

I have Bonjour running in services Task Manager shows Running (Win10).

I checked my router gateway, it shows the Esp is connected and allowed, with no blocking.

I checked Windows Defender, I don't have another Antivirus.  Firewall shows rules for Inbound for Arduino IDE and Visual Studio, everything is allowed for TCP and UDP.  There are no outbound rules for either program however.  There are inbound rules for mDNS UPD-IN and outbound rules for mDNS UDP-OUT.

Bonjour Browser doesn't show the Esp but it shows RPis I have on the network.

Restarting the router, the Esp, IDEs or the PC have no effect.

When I try the same sketch in the Arduino IDE, the network port never shows up on the port list. 

Title: Re: ESP8266 OTA upload
Post by perigalacticon on Oct 16th, 2020 at 6:46am
Tried adding board.txt in the project folder with overrides per https://www.visualmicro.com/page/esp8266.aspx

Also tried entering the IP address into the port selection box as suggested on the above webpage.  I see that the Esp IP is no longer found on the port list since I rebooted the router and other devices.  The error I get is now:


Code (c++):
Uploading 'VM_ESP8266_OTA_Example' to 'Generic ESP8266 Module' using '192.168.1.5'
01:39:18 [ERROR]: No Answer
The uploader process failed


or

Code (c++):
The uploader process failed
02:12:54 [ERROR]: No response from device

and on Serial Monitor:

Code (c++):
OTA Start
Progress: 0%
Error[2]: Connect Failed
Error[4]: End Failed



Also if I ping the IP there is no response.


Title: Re: ESP8266 OTA upload
Post by Visual Micro on Oct 16th, 2020 at 5:47pm
Hi

The Auth example applies only if your OTA code on the ESP specifies Auth is required and specifies the password. I expect you have not set the Auth and that is why you should not specify it (or enable auth) in board.txt.

If we ignore apple bonjour life can be simpler...

If you can't ping the ip address that would suggest that the esp has not booted and started the wifi correctly.

I suggest following the guide in the yellow box above so that we can see your settings and also providing your OTA code.

Without an IP address resolved via bonjour, you need to enter an IP manually and also in the board.txt would need to set the network.port=8266. Apple bonjour provides us an IP, port and if Auth is required. Therefore, without bonjour we simply need to specify those properties to allow OTA to work.

The network.port= is actually specified in your OTA code on the ESP. However the ESP core defaults to "8266", therefore we use that in our examples and it is normally correct.

Thanks


Title: Re: ESP8266 OTA upload
Post by perigalacticon on Oct 17th, 2020 at 2:53pm
When OTA upload is initiated the Esp is contacted via WIFI because it is responding on the Serial Monitor.  It's whatever results in the "Connect Failed" response that is the problem.  I attached the verbose compile and upload for the Serial Upload, and for the OTA upload.
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=verbose_output_compile_and_upload_VM_ESP8266_OTA.txt (89 KB | 3 )
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=verbose_output_OTA_upload_VM_ESP8266_OTA.txt (0 KB | 1 )

Title: Re: ESP8266 OTA upload
Post by Visual Micro on Oct 18th, 2020 at 2:12pm
Often this is flash size set too small but you don't seem to be near near the limit.

What hapens in the arduino ide? If it works every time then please give verbose output using "file>preferences> upload verbose and compile verbose" in the arduino ide

Visual Micro » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2020. All Rights Reserved.