Closed pscott-ams closed 2 years ago
Can you ping the 192.168.167.101 IP? What is the output on the serial monitor?
Thank you for responding
I'm unable to ping the IP:
Here is the serial monitor output before the OTA upload:
Initializing Ethernet...
Local IP: 192.168.167.101
[V2] Link status: ON
[V2] Link status: ON
[V2] Link status: ON
[V2] Link status: ON
When I start the OTA upload, the serial monitor closes and all I can see is the output I included in the OP:
Building in release mode
Retrieving maximum program size .pio\build\wemos_d1_mini32_ota\firmware.elf
Checking size .pio\build\wemos_d1_mini32_ota\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 4.4% (used 14412 bytes from 327680 bytes)
Flash: [== ] 22.8% (used 299086 bytes from 1310720 bytes)
Configuring upload protocol...
AVAILABLE: custom, 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 = custom
Uploading .pio\build\wemos_d1_mini32_ota\firmware.bin
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:04 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:05 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:06 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:07 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:08 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:09 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:10 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:11 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:12 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:13 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:14 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:15 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:16 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:17 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:18 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:19 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:20 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:21 --:--:-- 0
curl: (28) Failed to connect to 192.168.167.101 port 65280 after 21051 ms: Timed out
*** [upload] Error 28
================================================================================================== [FAILED] Took 24.05 seconds ==================================================================================================
Environment Status Duration
------------------- -------- ------------
wemos_d1_mini32_ota FAILED 00:00:24.047
============================================================================================= 1 failed, 0 succeeded in 00:00:24.047 =============================================================================================
Could it be the network settings? Here are the properties of the usb-ethernet adapter I'm using:
Well how can your adapter have the same IP as the ESP32? That's a collision.
Also you're directly connecting your computer with the ESP via a ethernet cable? You may need a crossover cable because here it says the W5500 can't do automatic polarity inversion.
Does it not work if you re-activate DHCP in the sketch and connect it to your home router?
Thanks again for the quick response
I changed the IP of the adapter to 192.168.167.99
When I re-activated DHCP and connect the W5500 directly to the router this is what the serial monitor shows:
Initializing Ethernet...
Local IP: 192.168.1.73
[V2] Link status: ON
[V2] Link status: ON
[V2] Link status: ON
[V2] Link status: ON
And then when I try to upload OTA, I get the same curl timeout error. Unfortunately, I do not have a crossover cable with me at the moment. I'll be able to get one on Monday.
Is the device pingable in this network configuration?
Sorry, I forgot to change the IP address in the platformio.ini With DHCP re-activated, and the W5500 connected directly to the router, I was able to successfully use OTA upload:
Uploading .pio\build\wemos_d1_mini32_ota\firmware.bin
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
86 295k 0 0 86 256k 0 264k 0:00:01 --:--:-- 0:00:01 264k
100 295k 0 0 100 295k 0 118k 0:00:02 0:00:02 --:--:-- 118k
100 295k 0 2 100 295k 0 114k 0:00:02 0:00:02 --:--:-- 114k
================================================================================================= [SUCCESS] Took 14.50 seconds =================================================================================================
I am able to ping the device as well:
C:\Users\PatsCot>ping 192.168.1.73
Pinging 192.168.1.73 with 32 bytes of data:
Reply from 192.168.1.73: bytes=32 time=2ms TTL=128
Reply from 192.168.1.73: bytes=32 time=2ms TTL=128
Reply from 192.168.1.73: bytes=32 time=1ms TTL=128
Reply from 192.168.1.73: bytes=32 time=2ms TTL=128
Ping statistics for 192.168.1.73:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 2ms, Average = 1ms
I would still like to be able to set a static IP address, as it is required for the project I am working on. Perhaps the crossover cable will fix this?
Does it work when connected to the router but with a static IP?
No, the connection times out during OTA upload.
I'm also unable to ping the IP address.
Here is my computer's network settings when I type ipconfig in command prompt:
Wireless LAN adapter Wi-Fi 3:
Connection-specific DNS Suffix . : attlocal.net
IPv6 Address. . . . . . . . . . . : 2600:1700:a110:7a90::49
IPv6 Address. . . . . . . . . . . : 2600:1700:a110:7a90:7090:7c62:dbfb:5471
Temporary IPv6 Address. . . . . . : 2600:1700:a110:7a90:a473:7aea:bfdc:b0bc
Link-local IPv6 Address . . . . . : fe80::7090:7c62:dbfb:5471%11
IPv4 Address. . . . . . . . . . . : 192.168.1.70
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : fe80::eec3:2ff:fe2f:7cf1%11
192.168.1.254
When I assign a static IP to the ESP32 that has a value of 192.168.1.xxx, then I'm able to ping the device and upload using OTA successfully.
Is there a way for this to work when I assign an IP address of 192.168.167.xxx?
Do you set your ethernet adapter on the PC to have the 192.168.167.1 IP address? (And the ESP32 to have a 192.168.167.xxx address but xxx != 1 or 0 or 255)
I'm not really sure why, but it is working now!
These are the network settings of my USB-ethernet adapter:
I'm also able to ping the device:
C:\Users\PatsCot>ping 192.168.167.101
Pinging 192.168.167.101 with 32 bytes of data:
Reply from 192.168.167.101: bytes=32 time<1ms TTL=128
Reply from 192.168.167.101: bytes=32 time<1ms TTL=128
Reply from 192.168.167.101: bytes=32 time<1ms TTL=128
Reply from 192.168.167.101: bytes=32 time<1ms TTL=128
Ping statistics for 192.168.167.101:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
And here is the serial monitor displaying the different network addresses:
Initializing Ethernet...
Local IP: 192.168.167.101
DNS: 192.168.167.1
Gateway: 192.168.167.1
Subnet Mask: 255.255.255.0
[V2] Link status: ON
Thank you so much max, I've been struggling with this project for weeks now!
must be in the same network segment, otherwise the subnet mask may be set like 255.255.252.0, if you want to connect to more devices than 255.
Thank you for making this example, I've been struggling getting ESP32 + W5500 + OTA + PlatformIO to work.
I've done the Prerequisites:
Here is the
curl
in my PATH:Here is my platformio.ini:
I have extra_scripts.py in the same folder as platformio.ini:
I uploaded your example to my ESP32. When I try to upload via OTA, I get the following message:
I modified the code to set a static IP address instead of DHCP. Here is my code:
Any idea why the connection is timing out?