Skip to content

0.16.0 - Ethernet not initialising properly #5247

Closed

Description

@brettbear

What happened?

After compiling WLED 0.16.0-alpha 2506160 a number of different ways and getting the same behaviour, I discovered that when WLED boots with ethernet configured it doesn't connect using the defined static IP Address. This presents in two different ways.

If DHCP is enabled on the ethernet network, 0.16.0 seems to pickup a DHCP address and not use the static one definied in WLED. If the ethernet is unplugged and reconnected, then it uses the static IP Address definied in WLED.

If DHCP is disabled on the network, WLED seems to pick up the static IP Address, however, it doesn't "connect" to it. If the ethernet is unplugged and reconnected, then it uses AND connects via the static IP Address definied in WLED.

Platform: Quinled dig-octa

WLED 0.16.0-alpha 2506160 debug log - DHCP enabled on router.txt

WLED 0.16.0-alpha 2506160 debug log - no DHCP on router.txt

Online compiler output.txt

cfg.json

To Reproduce Bug

Compile and install 0.16.0 Nightly (esp32dev) with ethernet.
Via WIFI, configure the ethernet to use a static IP Address.
Connect Ethernet, reboot the module and try to connect to the defined static IP address. Connection will fail.
Unplug ethernet for 5 seconds, reconnect. You'll be able to connect to WLED over ethernet.

Expected Behavior

If ethernet is connected when WLED boots, it should connect immediately via ethernet using the defined static IP Address.

Install Method

Self-Compiled

What version of WLED?

WLED 0.16.0-alpha 2506160

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

*** WLED 0.16.0-alpha 2506160 debug log - DHCP enabled on router ***
Using 'COM7' as serial port.
Unexpected error: could not open port 'COM7': PermissionError(13, 'Access is denied.', None, 5)
[13:53:01]ets Jul 29 2019 12:21:46
[13:53:01]
[13:53:01]rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[13:53:01]configsip: 0, SPIWP:0xee
[13:53:01]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[13:53:01]mode:DIO, clock div:2
[13:53:01]load:0x3fff0030,len:1184
[13:53:01]load:0x40078000,len:13132
[13:53:01]load:0x40080400,len:3036
[13:53:01]entry 0x400805e4
[13:53:02]
[13:53:02]---WLED 0.16.0-alpha 2506160 INIT---
[13:53:02]
[13:53:02]esp32 4.4.4.20230310
[13:53:02]arduino-esp32 v2.0.9
[13:53:02]CPU:   ESP32-D0WD-V3 rev.3, 2 core(s), 240 MHz.
[13:53:02]FLASH: 16 MB, Mode 2 (DIO), speed 40 MHz.
[13:53:02]heap 179452
[13:53:02]TX power: 78/78
[13:53:02]PIN ALLOC: Pin 1 successfully allocated by 0x89.
[13:53:02]PIN ALLOC: 0x0000000000000lX.
[13:53:02]heap 179452
[13:53:02]checking for bootloop: time -2041838823, counter -466638810, action -857983522
[13:53:02]Valid JSON file /cfg.json
[13:53:02]Reading config
[13:53:02]Reading settings from /wsec.json...
[13:53:02]JSON buffer locked. (3)
[13:53:02]JSON buffer released. (3)
[13:53:02]JSON buffer locked. (1)
[13:53:02]Reading settings from /cfg.json...
[13:53:02]initE: Attempting ETH config: 8
[13:53:02]PIN ALLOC: Pin 21 allocated by 0x81.
[13:53:02]PIN ALLOC: Pin 19 allocated by 0x81.
[13:53:02]PIN ALLOC: Pin 22 allocated by 0x81.
[13:53:02]PIN ALLOC: Pin 25 allocated by 0x81.
[13:53:02]PIN ALLOC: Pin 26 allocated by 0x81.
[13:53:02]PIN ALLOC: Pin 27 allocated by 0x81.
[13:53:02]PIN ALLOC: Pin 23 allocated by 0x81.
[13:53:02]PIN ALLOC: Pin 18 allocated by 0x81.
[13:53:02]PIN ALLOC: Pin 17 allocated by 0x81.
[13:53:02]PIN ALLOC: 0x0000000000000lX.
[13:53:04]initC: *** Ethernet successfully configured! ***
[13:53:04]Heap before buses: 149424
[13:53:04]PIN ALLOC: Pin 34 successfully allocated by 0x85.
[13:53:04]PIN ALLOC: 0x0000000000000lX.
[13:53:04]PIN ALLOC: Pin 33 successfully allocated by 0x87.
[13:53:04]PIN ALLOC: 0x0000000000000lX.
[13:53:04]Starting usermod config.
[13:53:04]JSON buffer released. (1)
[13:53:04]heap 149012
[13:53:04]Initializing strip
[13:53:04]Maximum LEDs on a bus: 30
[13:53:04]Digital buses: 8
[13:53:04]Heap before buses: 149012
[13:53:04]PIN ALLOC: Pin 0 successfully allocated by 0x82.
[13:53:04]PIN ALLOC: 0x0000000000000lX.
[13:53:04]Bus memory: 130B
[13:53:04]PIN ALLOC: Pin 14 successfully allocated by 0x82.
[13:53:04]PIN ALLOC: 0x0000000000000lX.
[13:53:04]Bus memory: 220B
[13:53:04]PIN ALLOC: Pin 2 successfully allocated by 0x82.
[13:53:04]PIN ALLOC: 0x0000000000000lX.
[13:53:04]Bus memory: 220B
[13:53:04]PIN ALLOC: Pin 3 successfully allocated by 0x82.
[13:53:04]PIN ALLOC: 0x0000000000000lX.
[13:53:04]Bus memory: 220B
[13:53:04]PIN ALLOC: Pin 4 successfully allocated by 0x82.
[13:53:04]PIN ALLOC: 0x0000000000000lX.
[13:53:04]Bus memory: 220B
[13:53:04]PIN ALLOC: Pin 5 successfully allocated by 0x82.
[13:53:04]PIN ALLOC: 0x0000000000000lX.
[13:53:04]Bus memory: 220B
[13:53:04]PIN ALLOC: Pin 12 successfully allocated by 0x82.
[13:53:04]PIN ALLOC: 0x0000000000000lX.
[13:53:04]Bus memory: 220B
[13:53:04]PIN ALLOC: Pin 13 successfully allocated by 0x82.
[13:53:04]PIN ALLOC: 0x0000000000000lX.
[13:53:04]Bus memory: 220B
[13:53:04]LED buffer size: 1940B/2210B
[13:53:04]Heap after buses: 197140
[13:53:04]Loading custom palettes
[13:53:04]Loading custom ledmaps
[13:53:04]strip buffer size: 120B
[13:53:04]Heap after strip init: 145760B
[13:53:04]-- Creating segment: 0x3ffdb948 [0,30:0,1]
[13:53:04]heap 145668
[13:53:04]Usermods setup
[13:53:04]PIN ALLOC: Pin 15 successfully allocated by 0x20.
[13:53:04]PIN ALLOC: 0x0000000000000lX.
[13:53:04]PIN ALLOC: Pin 32 successfully allocated by 0x20.
[13:53:04]PIN ALLOC: 0x0000000000000lX.
[13:53:04]PIN ALLOC: FAIL Pin 14 already allocated by 0x82.
[13:53:05]AR: Failed to initialize sound input driver. Please check input PIN settings.
[13:53:05]heap 145436
[13:53:05]WiFi-E: Event 0
[13:53:05]WiFi: Defaulf SSID (Your_Network) used.
[13:53:05]WiFi-E: Event 2
[13:53:05]DMX input disabled due to rxPin, enPin or txPin not set
[13:53:05]initServer
[13:53:05]heap 111312
[13:53:05]initIR
[13:53:05]heap 111312
[13:53:05]Initial connect or forced reconnect (@ 3s).
[13:53:05]WiFi: Defaulf SSID (Your_Network) used.
[13:53:05]initConnection() called @ 3s.
[13:53:05]WiFi-E: Event 3
[13:53:05]WiFi-E: Event 0
[13:53:05]WiFi-E: Event 2
[13:53:05]No connection configured.
[13:53:05]Opening access point WLED-AP1
[13:53:05]WiFi-E: AP Started
[13:53:05]Init AP interfaces
[13:53:05]WiFi-E: AP Stopped
[13:53:05]WiFi-E: AP Started
[13:53:05]Loop took 514ms.
[13:53:05]Usermods took 0ms.
[13:53:05]Strip took 2ms.
[13:53:05]
[13:53:05]Connected! IP address: 192.168.137.173	<<< Boot with Eth connected ignores the set static IP Address
[13:53:05]Init STA interfaces
[13:53:05]WiFi-E: Event 22
[13:53:05]mDNS started
[13:53:05]WiFi-E: AP Stopped
[13:53:05]Access point disabled (connected).
[13:53:05]WiFi-E: AP Started
[13:53:05]WiFi-E: AP Stopped
[13:53:05]Loop took 38ms.
[13:53:05]Usermods took 0ms.
[13:53:05]Strip took 0ms.
[13:53:32]---DEBUG INFO---
[13:53:32]Runtime: 30000
[13:53:32]Unix time: 30,000
[13:53:32]=== Memory Info ===
[13:53:32]DRAM 8-bit:   Free:   82632 bytes | Largest block:   73716 bytes
[13:53:32]DRAM 32-bit:  Free:   51108 bytes | Largest block: N/A
[13:53:32]TX power: 65/78
[13:53:32]Wifi state: 6
[13:53:32]ESP-NOW state: 0
[13:53:32]State time: 30011
[13:53:32]NTP last sync: 999000000
[13:53:32]Client IP: 192.168.137.173
[13:53:32]Loops/sec: 1907
[13:53:32]Loop time[ms]: 0/514
[13:53:32]UM time[ms]: 0/1
[13:53:32]Strip time[ms]:0/2
[13:53:32]Segments: 1 -> 196/0B
[13:53:32]  Seg: 30,1 [A=1, 2D=0, RGB=1, W=0, CCT=0]
[13:53:32]Modes: 4*218=872B
[13:53:32]Data: 4*218=872B
[13:53:32]Map: 2*0=0B
[13:53:32]Web server status:  Idle
[13:54:02]Local time: 00:01
[13:54:02]---DEBUG INFO---
[13:54:02]Runtime: 60042
[13:54:02]Unix time: 60,042
[13:54:02]=== Memory Info ===
[13:54:02]DRAM 8-bit:   Free:   82460 bytes | Largest block:   73716 bytes
[13:54:02]DRAM 32-bit:  Free:   51108 bytes | Largest block: N/A
[13:54:02]TX power: 65/78
[13:54:02]Wifi state: 6
[13:54:02]ESP-NOW state: 0
[13:54:02]State time: 30011
[13:54:02]NTP last sync: 999000000
[13:54:02]Client IP: 192.168.137.173
[13:54:02]Loops/sec: 2160
[13:54:02]Loop time[ms]: 0/16
[13:54:02]UM time[ms]: 0/1
[13:54:02]Strip time[ms]:0/1
[13:54:02]Segments: 1 -> 196/0B
[13:54:02]  Seg: 30,1 [A=1, 2D=0, RGB=1, W=0, CCT=0]
[13:54:02]Modes: 4*218=872B
[13:54:02]Data: 4*218=872B
[13:54:02]Map: 2*0=0B
[13:54:02]Web server status:  Idle
[13:54:32]---DEBUG INFO---
[13:54:32]Runtime: 90084
[13:54:32]Unix time: 90,084
[13:54:32]=== Memory Info ===
[13:54:32]DRAM 8-bit:   Free:   82460 bytes | Largest block:   73716 bytes
[13:54:32]DRAM 32-bit:  Free:   51108 bytes | Largest block: N/A
[13:54:32]TX power: 65/78
[13:54:32]Wifi state: 6
[13:54:32]ESP-NOW state: 0
[13:54:32]State time: 30011
[13:54:32]NTP last sync: 999000000
[13:54:32]Client IP: 192.168.137.173
[13:54:32]Loops/sec: 2155
[13:54:32]Loop time[ms]: 0/2
[13:54:32]UM time[ms]: 0/1
[13:54:32]Strip time[ms]:0/1
[13:54:32]Segments: 1 -> 196/0B
[13:54:32]  Seg: 30,1 [A=1, 2D=0, RGB=1, W=0, CCT=0]
[13:54:32]Modes: 4*218=872B
[13:54:32]Data: 4*218=872B
[13:54:32]Map: 2*0=0B
[13:54:32]Web server status:  Idle
[13:55:02]Local time: 00:02
[13:55:02]---DEBUG INFO---
[13:55:02]Runtime: 120126
[13:55:02]Unix time: 120,126
[13:55:02]=== Memory Info ===
[13:55:02]DRAM 8-bit:   Free:   82460 bytes | Largest block:   73716 bytes
[13:55:02]DRAM 32-bit:  Free:   51108 bytes | Largest block: N/A
[13:55:02]TX power: 65/78
[13:55:02]Wifi state: 6
[13:55:02]ESP-NOW state: 0
[13:55:02]State time: 30011
[13:55:02]NTP last sync: 999000000
[13:55:02]Client IP: 192.168.137.173
[13:55:02]Loops/sec: 2156
[13:55:02]Loop time[ms]: 0/2
[13:55:02]UM time[ms]: 0/1
[13:55:02]Strip time[ms]:0/1
[13:55:02]Segments: 1 -> 196/0B
[13:55:02]  Seg: 30,1 [A=1, 2D=0, RGB=1, W=0, CCT=0]
[13:55:02]Modes: 4*218=872B
[13:55:02]Data: 4*218=872B
[13:55:02]Map: 2*0=0B
[13:55:02]Web server status:  Idle
[13:55:10]ETH-E: Disconnected								<<< Manually disconnected Ethernet
[13:55:10]Initial connect or forced reconnect (@ 128s).
[13:55:10]WiFi: Defaulf SSID (Your_Network) used.
[13:55:10]initConnection() called @ 128s.
[13:55:10]WiFi-E: Event 3
[13:55:10]WiFi-E: Event 0
[13:55:10]WiFi-E: Event 2
[13:55:10]No connection configured.
[13:55:10]Opening access point WLED-AP1
[13:55:10]WiFi-E: AP Started
[13:55:10]Init AP interfaces
[13:55:10]WiFi-E: AP Stopped
[13:55:10]WiFi-E: AP Started
[13:55:10]Loop took 516ms.
[13:55:11]Usermods took 0ms.
[13:55:11]Strip took 1ms.
[13:55:14]ETH-E: Connected 									<<< Manually reconnected Ethernet
[13:55:14]
[13:55:14]Connected! IP address: 192.168.137.11				<<< Eth detection after boot picks up the static IP Address
[13:55:14]Init STA interfaces
[13:55:14]WiFi-E: Event 22
[13:55:14]mDNS started
[13:55:14]WiFi-E: AP Stopped
[13:55:14]Access point disabled (connected).
[13:55:14]WiFi-E: AP Started
[13:55:14]WiFi-E: AP Stopped
[13:55:14]Loop took 48ms.
[13:55:14]Usermods took 0ms.
[13:55:14]Strip took 2ms.

*** WLED 0.16.0-alpha 2506160 debug log - no DHCP on router ***
Using 'COM7' as serial port.
Unexpected error: could not open port 'COM7': PermissionError(13, 'Access is denied.', None, 5)
[16:45:15]ets Jul 29 2019 12:21:46
[16:45:15]
[16:45:15]rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[16:45:15]configsip: 0, SPIWP:0xee
[16:45:15]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[16:45:15]mode:DIO, clock div:2
[16:45:15]load:0x3fff0030,len:1184
[16:45:15]load:0x40078000,len:13132
[16:45:15]load:0x40080400,len:3036
[16:45:15]entry 0x400805e4
[16:45:16]
[16:45:16]---WLED 0.16.0-alpha 2506160 INIT---
[16:45:16]
[16:45:16]esp32 4.4.4.20230310
[16:45:16]arduino-esp32 v2.0.9
[16:45:16]CPU:   ESP32-D0WD-V3 rev.3, 2 core(s), 240 MHz.
[16:45:16]FLASH: 16 MB, Mode 2 (DIO), speed 40 MHz.
[16:45:16]heap 179452
[16:45:16]TX power: 78/78
[16:45:16]PIN ALLOC: Pin 1 successfully allocated by 0x89.
[16:45:16]PIN ALLOC: 0x0000000000000lX.
[16:45:16]heap 179452
[16:45:16]checking for bootloop: time -2042101479, counter -467163098, action -857987618
[16:45:16]Valid JSON file /cfg.json
[16:45:16]Reading config
[16:45:16]Reading settings from /wsec.json...
[16:45:16]JSON buffer locked. (3)
[16:45:16]JSON buffer released. (3)
[16:45:16]JSON buffer locked. (1)
[16:45:16]Reading settings from /cfg.json...
[16:45:16]initE: Attempting ETH config: 8
[16:45:16]PIN ALLOC: Pin 21 allocated by 0x81.
[16:45:16]PIN ALLOC: Pin 19 allocated by 0x81.
[16:45:16]PIN ALLOC: Pin 22 allocated by 0x81.
[16:45:16]PIN ALLOC: Pin 25 allocated by 0x81.
[16:45:16]PIN ALLOC: Pin 26 allocated by 0x81.
[16:45:16]PIN ALLOC: Pin 27 allocated by 0x81.
[16:45:16]PIN ALLOC: Pin 23 allocated by 0x81.
[16:45:16]PIN ALLOC: Pin 18 allocated by 0x81.
[16:45:16]PIN ALLOC: Pin 17 allocated by 0x81.
[16:45:16]PIN ALLOC: 0x0000000000000lX.
[16:45:17]initC: *** Ethernet successfully configured! ***
[16:45:17]Heap before buses: 149424
[16:45:17]PIN ALLOC: Pin 34 successfully allocated by 0x85.
[16:45:17]PIN ALLOC: 0x0000000000000lX.
[16:45:17]PIN ALLOC: Pin 33 successfully allocated by 0x87.
[16:45:17]PIN ALLOC: 0x0000000000000lX.
[16:45:17]Starting usermod config.
[16:45:17]JSON buffer released. (1)
[16:45:17]heap 149012
[16:45:17]Initializing strip
[16:45:17]Maximum LEDs on a bus: 30
[16:45:17]Digital buses: 8
[16:45:17]Heap before buses: 149012
[16:45:17]PIN ALLOC: Pin 0 successfully allocated by 0x82.
[16:45:17]PIN ALLOC: 0x0000000000000lX.
[16:45:17]Bus memory: 130B
[16:45:17]PIN ALLOC: Pin 14 successfully allocated by 0x82.
[16:45:17]PIN ALLOC: 0x0000000000000lX.
[16:45:17]Bus memory: 220B
[16:45:17]PIN ALLOC: Pin 2 successfully allocated by 0x82.
[16:45:17]PIN ALLOC: 0x0000000000000lX.
[16:45:17]Bus memory: 220B
[16:45:17]PIN ALLOC: Pin 3 successfully allocated by 0x82.
[16:45:17]PIN ALLOC: 0x0000000000000lX.
[16:45:17]Bus memory: 220B
[16:45:17]PIN ALLOC: Pin 4 successfully allocated by 0x82.
[16:45:17]PIN ALLOC: 0x0000000000000lX.
[16:45:17]Bus memory: 220B
[16:45:17]PIN ALLOC: Pin 5 successfully allocated by 0x82.
[16:45:17]PIN ALLOC: 0x0000000000000lX.
[16:45:17]Bus memory: 220B
[16:45:17]PIN ALLOC: Pin 12 successfully allocated by 0x82.
[16:45:17]PIN ALLOC: 0x0000000000000lX.
[16:45:17]Bus memory: 220B
[16:45:17]PIN ALLOC: Pin 13 successfully allocated by 0x82.
[16:45:17]PIN ALLOC: 0x0000000000000lX.
[16:45:17]Bus memory: 220B
[16:45:17]LED buffer size: 1940B/2210B
[16:45:17]Heap after buses: 197140
[16:45:17]Loading custom palettes
[16:45:17]Loading custom ledmaps
[16:45:17]strip buffer size: 120B
[16:45:17]Heap after strip init: 145760B
[16:45:17]-- Creating segment: 0x3ffdb948 [0,30:0,1]
[16:45:17]heap 145668
[16:45:17]Usermods setup
[16:45:18]PIN ALLOC: Pin 15 successfully allocated by 0x20.
[16:45:18]PIN ALLOC: 0x0000000000000lX.
[16:45:18]PIN ALLOC: Pin 32 successfully allocated by 0x20.
[16:45:18]PIN ALLOC: 0x0000000000000lX.
[16:45:18]PIN ALLOC: FAIL Pin 14 already allocated by 0x82.
[16:45:18]AR: Failed to initialize sound input driver. Please check input PIN settings.
[16:45:18]heap 145436
[16:45:18]WiFi-E: Event 0
[16:45:18]WiFi: Defaulf SSID (Your_Network) used.
[16:45:18]WiFi-E: Event 2
[16:45:18]DMX input disabled due to rxPin, enPin or txPin not set
[16:45:18]initServer
[16:45:18]heap 111312
[16:45:18]initIR
[16:45:18]heap 111312
[16:45:18]Initial connect or forced reconnect (@ 3s).
[16:45:18]WiFi: Defaulf SSID (Your_Network) used.
[16:45:18]initConnection() called @ 3s.
[16:45:18]WiFi-E: Event 3
[16:45:18]WiFi-E: Event 0
[16:45:18]WiFi-E: Event 2
[16:45:18]No connection configured.
[16:45:18]Opening access point WLED-AP1
[16:45:18]WiFi-E: AP Started
[16:45:19]Init AP interfaces
[16:45:19]WiFi-E: AP Stopped
[16:45:19]WiFi-E: AP Started
[16:45:19]Loop took 513ms.
[16:45:19]Usermods took 0ms.
[16:45:19]Strip took 1ms.
[16:45:45]---DEBUG INFO---
[16:45:45]Runtime: 30000
[16:45:45]Unix time: 30,000
[16:45:45]=== Memory Info ===
[16:45:45]DRAM 8-bit:   Free:   83956 bytes | Largest block:   81908 bytes
[16:45:45]DRAM 32-bit:  Free:   51108 bytes | Largest block: N/A
[16:45:45]TX power: 63/78
[16:45:45]Wifi state: 6
[16:45:45]ESP-NOW state: 0
[16:45:45]State time: 30011
[16:45:45]NTP last sync: 999000000
[16:45:45]Client IP: 192.168.137.11 				<<< Static IP used (DHCP not enabled on router), but doesn't connect.
[16:45:45]Loops/sec: 1387
[16:45:45]Loop time[ms]: 0/513
[16:45:45]UM time[ms]: 0/1
[16:45:45]Strip time[ms]:0/2
[16:45:45]Segments: 1 -> 196/0B
[16:45:45]  Seg: 30,1 [A=1, 2D=0, RGB=1, W=0, CCT=0]
[16:45:45]Modes: 4*218=872B
[16:45:45]Data: 4*218=872B
[16:45:45]Map: 2*0=0B
[16:45:45]Web server status:  Idle
[16:46:15]Local time: 00:01
[16:46:15]---DEBUG INFO---
[16:46:15]Runtime: 60042
[16:46:15]Unix time: 60,042
[16:46:15]=== Memory Info ===
[16:46:15]DRAM 8-bit:   Free:   83956 bytes | Largest block:   81908 bytes
[16:46:15]DRAM 32-bit:  Free:   51108 bytes | Largest block: N/A
[16:46:15]TX power: 63/78
[16:46:15]Wifi state: 6
[16:46:15]ESP-NOW state: 0
[16:46:15]State time: 30011
[16:46:15]NTP last sync: 999000000
[16:46:15]Client IP: 192.168.137.11
[16:46:15]Loops/sec: 1583
[16:46:15]Loop time[ms]: 0/2
[16:46:15]UM time[ms]: 0/1
[16:46:15]Strip time[ms]:0/1
[16:46:15]Segments: 1 -> 196/0B
[16:46:15]  Seg: 30,1 [A=1, 2D=0, RGB=1, W=0, CCT=0]
[16:46:15]Modes: 4*218=872B
[16:46:15]Data: 4*218=872B
[16:46:15]Map: 2*0=0B
[16:46:15]Web server status:  Idle
[16:46:21]ETH-E: Disconnected 							<<< Ethernet unplugged
[16:46:21]Initial connect or forced reconnect (@ 66s).
[16:46:21]WiFi: Defaulf SSID (Your_Network) used.
[16:46:21]initConnection() called @ 66s.
[16:46:21]WiFi-E: Event 3
[16:46:21]WiFi-E: Event 2
[16:46:21]No connection configured.
[16:46:25]ETH-E: Connected 								<<< Ethernet reconnected
[16:46:25]WiFi-E: Event 22
[16:46:25]
[16:46:25]Connected! IP address: 192.168.137.11 		<<< Static IP Address used and now connected
[16:46:25]Init STA interfaces
[16:46:25]mDNS started
[16:46:25]WiFi-E: AP Stopped
[16:46:25]Access point disabled (connected).
[16:46:25]WiFi-E: AP Started
[16:46:25]WiFi-E: AP Stopped
[16:46:25]Loop took 36ms.
[16:46:25]Usermods took 0ms.
[16:46:25]Strip took 0ms.

*** WLED CONFIG ***
{"rev":[1,0],"vid":2506160,"id":{"mdns":"wled-adcb90","name":"WLED","sui":false},"nw":{"espnow":false,"linked_remote":[],"ins":[{"ssid":"Your_Network","pskl":0,"bssid":"","ip":[192,168,137,11],"gw":[192,168,137,1],"sn":[255,255,255,0]}],"dns":[192,168,137,1]},"ap":{"ssid":"WLED-AP1","pskl":8,"chan":6,"hide":0,"behav":0,"ip":[4,3,2,1]},"wifi":{"sleep":false,"phy":false,"txpwr":78},"eth":{"type":8,"pin":[21,19,22,25,26,27,23,18,17]},"hw":{"led":{"total":30,"maxpwr":0,"cct":false,"cr":false,"ic":false,"cb":0,"fps":0,"rgbwm":255,"prl":false,"ins":[{"start":0,"len":30,"pin":[0],"order":0,"rev":false,"skip":0,"type":22,"ref":false,"rgbwm":0,"freq":0,"maxpwr":0,"ledma":55,"text":""},{"start":0,"len":30,"pin":[14],"order":0,"rev":false,"skip":0,"type":22,"ref":false,"rgbwm":0,"freq":0,"maxpwr":0,"ledma":55,"text":""},{"start":0,"len":30,"pin":[2],"order":0,"rev":false,"skip":0,"type":22,"ref":false,"rgbwm":0,"freq":0,"maxpwr":0,"ledma":55,"text":""},{"start":0,"len":30,"pin":[3],"order":0,"rev":false,"skip":0,"type":22,"ref":false,"rgbwm":0,"freq":0,"maxpwr":0,"ledma":55,"text":""},{"start":0,"len":30,"pin":[4],"order":0,"rev":false,"skip":0,"type":22,"ref":false,"rgbwm":0,"freq":0,"maxpwr":0,"ledma":55,"text":""},{"start":0,"len":30,"pin":[5],"order":0,"rev":false,"skip":0,"type":22,"ref":false,"rgbwm":0,"freq":0,"maxpwr":0,"ledma":55,"text":""},{"start":0,"len":30,"pin":[12],"order":0,"rev":false,"skip":0,"type":22,"ref":false,"rgbwm":0,"freq":0,"maxpwr":0,"ledma":55,"text":""},{"start":0,"len":30,"pin":[13],"order":0,"rev":false,"skip":0,"type":22,"ref":false,"rgbwm":0,"freq":0,"maxpwr":0,"ledma":55,"text":""}]},"com":[],"btn":{"max":32,"pull":true,"ins":[{"type":2,"pin":[34],"macros":[0,0,0]}],"tt":32,"mqtt":false},"ir":{"pin":-1,"type":0,"sel":true},"relay":{"pin":33,"rev":false,"odrain":false},"baud":1152,"if":{"i2c-pin":[-1,-1],"spi-pin":[-1,-1,-1]}},"light":{"scale-bri":100,"pal-mode":0,"aseg":false,"gc":{"bri":1,"col":1,"val":2.2},"tr":{"dur":7,"rpc":5,"hrp":true},"nl":{"mode":1,"dur":60,"tbri":0,"macro":0}},"def":{"ps":0,"on":true,"bri":128},"if":{"sync":{"port0":21324,"port1":65506,"espnow":false,"recv":{"bri":true,"col":true,"fx":true,"pal":true,"grp":1,"seg":false,"sb":false},"send":{"en":false,"dir":true,"btn":true,"va":false,"hue":false,"grp":1,"ret":0}},"nodes":{"list":true,"bcast":true},"live":{"en":true,"mso":false,"rlm":true,"port":5568,"mc":false,"dmx":{"uni":1,"seqskip":false,"e131prio":0,"addr":1,"dss":0,"mode":4,"inputRxPin":0,"inputTxPin":0,"inputEnablePin":0,"dmxInputPort":2},"timeout":25,"maxbri":false,"no-gc":true,"offset":0},"mqtt":{"en":false,"broker":"","port":1883,"user":"","pskl":0,"cid":"WLED-adcb90","rtn":false,"topics":{"device":"wled/adcb90","group":"wled/all"}},"ntp":{"en":false,"host":"0.wled.pool.ntp.org","tz":0,"offset":0,"ampm":false,"ln":0,"lt":0}},"ol":{"clock":0,"cntdwn":false,"min":0,"max":29,"o12pix":0,"o5m":false,"osec":false,"osb":false},"timers":{"cntdwn":{"goal":[20,1,1,0,0,0],"macro":0},"ins":[]},"ota":{"lock":false,"lock-wifi":false,"pskl":7,"aota":false,"same-subnet":true},"um":{"AudioReactive":{"enabled":false,"add-palettes":false,"analogmic":{"pin":-1},"digitalmic":{"type":1,"pin":[32,15,14,-1]},"config":{"squelch":10,"gain":60,"AGC":0},"frequency":{"scale":3},"dynamics":{"limiter":true,"rise":80,"fall":1400},"sync":{"port":11988,"mode":0}}}}

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. DedeHai commented on Dec 31, 2025

    @DedeHai
    Collaborator

    @coderabbitai please check the code and indicate configuration paths that would lead to the problem described.

  2. coderabbitai commented on Dec 31, 2025

    @coderabbitai
    Contributor
    🧩 Analysis chain

    🏁 Script executed:

    #!/bin/bash
    # Fetch the details of issue #5247 to understand the problem
    gh issue view 5247 --json title,body,comments --jq '{title: .title, body: .body, comments: [.comments[] | {author: .author.login, body: .body}]}'
    

    Length of output: 23429


    🏁 Script executed:

    #!/bin/bash
    # Search for ethernet initialization code
    echo "=== Finding ethernet initialization code ==="
    rg -n "initE.*Attempting ETH config" -A 20 -B 5
    
    echo -e "\n=== Finding static IP configuration code ==="
    rg -n "staticIP|static.*IP|ETH.*config" --type=cpp -C 5
    
    echo -e "\n=== Finding ethernet event handlers ==="
    rg -n "ETH-E:|ETH_EVENT|onEvent.*eth" --type=cpp -C 5
    
    echo -e "\n=== Finding network configuration loading ==="
    rg -n "deserializeConfigFromFS|Reading settings from.*cfg.json" --type=cpp -C 3
    

    Length of output: 48420


    🏁 Script executed:

    #!/bin/bash
    # Find where ethernet is initialized and started
    echo "=== Finding ETH.begin and ethernet initialization sequence ==="
    rg -n "ETH\.begin|ETH\.config|initEthernet\(\)" --type=cpp -C 10
    
    echo -e "\n=== Finding where initEthernet is called ==="
    rg -n "initEthernet\s*\(" --type=cpp -C 5
    
    echo -e "\n=== Finding ARDUINO_EVENT_ETH_GOT_IP handler ==="
    rg -n "ARDUINO_EVENT_ETH_GOT_IP|ETH_GOT_IP" --type=cpp -C 5
    

    Length of output: 9475


    @DedeHai, I've identified the root cause of the ethernet static IP issue. Here's the detailed analysis:

    Problem Root Cause

    The issue is in wled00/network.cpp - the static IP configuration happens too late in the ethernet initialization sequence.

    Configuration Path Leading to the Problem

    When static IP is configured for ethernet:

    1. multiWiFi[0].staticIP = 192.168.137.11 (from cfg.json)
    2. multiWiFi[0].staticGW = 192.168.137.1
    3. multiWiFi[0].staticSN = 255.255.255.0

    Code Execution Flow (Boot Sequence)

    1. wled00/wled.cpp:450 - deserializeConfigFromFS() is called during boot
    2. wled00/cfg.cpp:56 - Calls initEthernet()
    3. wled00/network.cpp:234 - ETH.begin() is called, which starts ethernet hardware asynchronously
    4. wled00/network.cpp:409-410 - Static IP configuration happens in ARDUINO_EVENT_ETH_CONNECTED event handler:
      if (multiWiFi[0].staticIP != (uint32_t)0x00000000 && multiWiFi[0].staticGW != (uint32_t)0x00000000) {
        ETH.config(multiWiFi[0].staticIP, multiWiFi[0].staticGW, multiWiFi[0].staticSN, dnsAddress);
      }

    The Bug

    Line 410 is TOO LATE - by the time ARDUINO_EVENT_ETH_CONNECTED fires, the ethernet link is already established and:

    • With DHCP on network: The DHCP client has already started/completed negotiation, assigning the DHCP address (192.168.137.173)
    • Without DHCP: The interface gets the static IP but the network stack isn't fully configured because the config came after connection

    Why Reconnecting Fixes It

    When you unplug and replug the ethernet cable:

    1. ARDUINO_EVENT_ETH_DISCONNECTED fires
    2. Then ARDUINO_EVENT_ETH_CONNECTED fires again
    3. This time, ETH.config() runs at the right moment during reconnection
    4. The static IP is applied correctly

    Comparison with WiFi (Correct Implementation)

    In wled00/wled.cpp:657-661, WiFi correctly applies static IP BEFORE connecting:

    if (multiWiFi[selectedWiFi].staticIP != 0U && multiWiFi[selectedWiFi].staticGW != 0U) {
      WiFi.config(multiWiFi[selectedWiFi].staticIP, multiWiFi[selectedWiFi].staticGW, ...);
    }
    // Then connects...

    The Fix

    Move the ETH.config() call from the event handler (line 409-413) to immediately after ETH.begin() in the initEthernet() function (after line 248 in network.cpp). This ensures static IP is configured before the ethernet link negotiation completes.

    The configuration should happen in initEthernet() right after the successful ETH.begin() call, similar to how WiFi does it.

  3. DedeHai commented on Dec 31, 2025

    @DedeHai
    Collaborator

    @brettbear thanks for reporting this. are you able to test the rabbits suggestion?

  4. brettbear commented on Jan 1, 2026

    @brettbear
    ContributorAuthor

    @DedeHai - I'm not familiar with this project, but gave it a try (was unsuccessful).

    To reiterate... this is the first time I've looked into the code for this project... have done some reverse engineering to try and understand it but I'm sure I'm oblivious to various nuances that others (like yourself) are aware of.

    I think the suggestion was on the right track, however, there's more to the issue.

    1. setup() in wled.cpp calls deserializeConfigFromFS()
    2. deserializeConfigFromFS() in cfg.cpp calls deserializeConfig()
    3. deserializeConfig() in cfg.cpp calls initEthernet() at the very start of the deserializeConfig function if WLED_USE_ETHERNET is defined. https://github.com/wled/WLED/blob/main/wled00/cfg.cpp#L52-L57
    4. However, the deserialization is not complete at this point. From what I can tell, the global multiWiFi (in wled.h) is not set in cfg.cpp until this code block is executed... https://github.com/wled/WLED/blob/main/wled00/cfg.cpp#L91-L119
    5. Once I moved https://github.com/wled/WLED/blob/main/wled00/cfg.cpp#L52-L57 to https://github.com/wled/WLED/blob/main/wled00/cfg.cpp#L120 (and implemented the rabbits suggestion), the issue seems to be resolved.

    The reason WiFi doesn't have the issue seems to be because WLED setup() inits the ethernet (at the same time as parsing the config Json), while WLED loop() inits WiFi (via handleConnection() and initConnection()) well after setup (and the config file has been parsed).

    Summary of what I did to get it to work...
    Cut https://github.com/wled/WLED/blob/main/wled00/network.cpp#L409-L413
    Insert the code code here https://github.com/wled/WLED/blob/main/wled00/network.cpp#L249
    Cut https://github.com/wled/WLED/blob/main/wled00/cfg.cpp#L52-L57
    Insert the code here https://github.com/wled/WLED/blob/main/wled00/cfg.cpp#L120

    Not sure if the above changes will break something else or if there might be other config settings that are no loading values.

  5. DedeHai commented on Jan 1, 2026

    @DedeHai
    Collaborator

    @coderabbitai as mentioned, there is an additional change needed: move the initEthernet(); in deserializeConfig() to after the static IP is read from the config. Is this the correct way to do it i.e. will this break any existing functionlity or is it the correct order?

  6. coderabbitai commented on Jan 1, 2026

    @coderabbitai
    Contributor
    🧩 Analysis chain

    🏁 Script executed:

    #!/bin/bash
    # Read the cfg.cpp file to understand the full deserializeConfig() function
    echo "=== Reading cfg.cpp file to see deserializeConfig() function ==="
    cat wled00/cfg.cpp
    
    echo -e "\n=== Reading network.cpp to understand initEthernet() dependencies ==="
    # Find initEthernet function definition
    ast-grep --pattern $'bool initEthernet() {
      $$$
    }'
    

    Length of output: 50241


    🏁 Script executed:

    #!/bin/bash
    # Read network.cpp file to find initEthernet function
    echo "=== Reading network.cpp to find initEthernet() function ==="
    cat wled00/network.cpp | head -300
    
    echo -e "\n=== Search for initEthernet definition ==="
    rg -n "^bool initEthernet|^void initEthernet" --type=cpp -A 30
    

    Length of output: 13375


    🏁 Script executed:

    #!/bin/bash
    # Check what comes after line 120 in cfg.cpp and verify no dependencies
    echo "=== Lines 115-130 in cfg.cpp to see context around line 120 ==="
    sed -n '115,130p' wled00/cfg.cpp
    
    echo -e "\n=== Check the ethernet event handler in network.cpp ==="
    rg -n "ARDUINO_EVENT_ETH_CONNECTED" --type=cpp -A 15 -B 5
    
    echo -e "\n=== Check if multiWiFi is used anywhere in initEthernet ==="
    rg -n "multiWiFi" wled00/network.cpp
    

    Length of output: 4303


    @DedeHai, yes, brettbear's approach is correct and won't break existing functionality. However, the complete fix requires two changes:

    Analysis of the Changes

    Change 1: Move initEthernet() call in cfg.cpp ✅ SAFE

    Current location: Lines 52-57 (before multiWiFi is populated)
    New location: Line 120 (after multiWiFi is populated)

    Why this is safe:

    • Between lines 57-120, only these settings are read: cmDNS, serverDescription, alexaInvocationName, simplifiedUI, ESP-NOW settings, and linked_remotes
    • None of these depend on ethernet being initialized
    • The initEthernet() function itself doesn't use multiWiFi - it only uses ethernetType and ethernetBoards configuration
    • DNS settings (lines 121-125) are read after line 120, which is fine

    Change 2: Move ETH.config() call in network.cpp ✅ REQUIRED

    Current location: Lines 409-413 (in ARDUINO_EVENT_ETH_CONNECTED event handler)
    New location: Inside initEthernet() function, immediately after ETH.begin() succeeds (after line 248)

    Why this is needed:

    // Inside initEthernet() after ETH.begin() succeeds (around line 249):
    if (multiWiFi[0].staticIP != (uint32_t)0x00000000 && multiWiFi[0].staticGW != (uint32_t)0x00000000) {
      ETH.config(multiWiFi[0].staticIP, multiWiFi[0].staticGW, multiWiFi[0].staticSN, dnsAddress);
    } else {
      ETH.config(INADDR_NONE, INADDR_NONE, INADDR_NONE);
    }

    Why Both Changes Are Necessary

    1. Change 1 alone would still leave ETH.config() being called too late (in the event handler)
    2. Change 2 alone would fail because multiWiFi wouldn't be populated yet when initEthernet() runs
    3. Both changes together ensure static IP configuration happens at the right time - after multiWiFi is populated but before DHCP negotiation starts

    This approach mirrors how WiFi does it (in wled.cpp lines 657-661), where WiFi.config() is called before WiFi.begin().

    Impact on Existing Functionality

    ✅ No breaking changes - The order of operations becomes:

    1. Read ethernetType from config
    2. Read multiWiFi settings from config
    3. Initialize ethernet with static IP configured immediately
    4. Event handlers fire afterward

    The code between the old and new initEthernet() call locations doesn't depend on ethernet being initialized, so moving it is completely safe.


    🧠 Learnings used
    Learnt from: blazoncek
    Repo: wled/WLED PR: 5140
    File: wled00/data/settings_time.htm:66-76
    Timestamp: 2025-12-01T07:01:16.949Z
    Learning: In WLED PR #5134, the fix for macros being initialized with the enable bit set only handles new configurations, not existing ones. If there is a bug in timer/macro handling code (e.g., in settings_time.htm), it must be fixed to work correctly for existing configurations as well.
    

    Learnt from: DedeHai
    Repo: wled/WLED PR: 4939
    File: wled00/FX_fcn.cpp:1176-1187
    Timestamp: 2025-09-16T18:08:42.848Z
    Learning: In WLED finalizeInit() bus creation (wled00/FX_fcn.cpp), intentionally allowing memory overruns when bus configurations exceed MAX_LED_MEMORY is a deliberate design choice. The trade-off prioritizes creating buses with reduced LED counts over completely failing to create buses, which would cause no LED output and UI failures. This approach forces users to update configurations after migrating to version 0.16 while maintaining basic functionality.
    

    Learnt from: mval-sg
    Repo: wled/WLED PR: 4876
    File: wled00/wled_eeprom.cpp:0-0
    Timestamp: 2025-09-01T10:26:17.959Z
    Learning: In WLED PR #4876, the DMXStartLED EEPROM backward compatibility issue was partially addressed by keeping it at address 2550 and reading it as a 16-bit value, with DMXChannelsValue array moved to addresses 2552-2566. This maintains compatibility with pre-0.11 EEPROM layouts for DMXStartLED, though legacy "Set to 255" (code 6) configurations may still need migration logic.
    

    Learnt from: willmmiles
    Repo: wled/WLED PR: 4859
    File: usermods/udp_name_sync/udp_name_sync.cpp:62-70
    Timestamp: 2025-08-21T00:00:17.196Z
    Learning: In WLED codebase, UDP packet processing code must never rely on null termination being present on the wire and must always validate packet size first. The codebase already has some vulnerabilities where malformed data can crash the software, so avoiding introduction of new ones is a priority.
    
  7. DedeHai commented on Jan 1, 2026

    @DedeHai
    Collaborator

    @brettbear you findings are correct, the only thing I am not sure about is if the ETH init should be done after dns is read from config as I do not know when or where that is used, I am not too familiar with how the network initialization works in detail.

    do you want to prepare a PR with your changes? Otherwise we can task copilot to do it.

  8. brettbear commented on Jan 1, 2026

    @brettbear
    ContributorAuthor

    I'll do some digging into the DNS @DedeHai and if I can't see anything sus, I'll submit a PR. Will update you.

  9. brettbear commented on Jan 2, 2026

    @brettbear
    ContributorAuthor

    @DedeHai

    ETH.config() at line https://github.com/wled/WLED/blob/main/wled00/network.cpp#L410 also configures DNS when setting the IP Address, gateway and subnet...
    ETH.config(multiWiFi[0].staticIP, multiWiFi[0].staticGW, multiWiFi[0].staticSN, dnsAddress);
    This implies that DNS settings must be parsed from the config before initEthernet() is called.

    PR submitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions