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

Ethernet Events doesn't call callback function #11187

Closed
1 task done
sergshadrap opened this issue Mar 27, 2025 · 4 comments
Closed
1 task done

Ethernet Events doesn't call callback function #11187

sergshadrap opened this issue Mar 27, 2025 · 4 comments
Labels
Status: Awaiting triage Issue is waiting for triage

Comments

@sergshadrap
Copy link

Board

WT32-Eth01 Ethernet module

Device Description

Just plain board WT32-Eth01 Ethernet.

Hardware Configuration

WT32-Eth01 Ethernet board with Ethernet cable connected. Powered over FTDI232 from laptop USB.

Version

latest master (checkout manually)

IDE Name

Arduino IDE

Operating System

Windows 10

Flash frequency

80

PSRAM enabled

no

Upload speed

921600

Description

I use Ethernet connection for my library, it represents different kind of devices with Ethernet connection. I used to using WT32-Eth01 board for this purpose. Previously I used the v 3.0.7 release and everything was perfect (tested on multiple devices) , recently I've tried to move for 3.1.3 release and seems that the Events callback function stop working. There is nothing special I registered callback function over intermediate function (due to library usage) . The registration process says "true" , but no call for the function. The system Events goes fine and I see that the board is initialized with Ethernet and got an IP. Seems like a brake between system and application layer.

Sketch

if(!networkEvents.onEvent(MppServer::onEventStatic)) Serial.println("ETH Event function hasn't registered!");
        else Serial.println("ETH Event function registered!"); // That is callback intermediate registration   of onEventStatic() .

void MppServer::onEventStatic(arduino_event_id_t event) { 
   mppserver.MyonEvent(event); 
} // That is my static function 

 void MppServer::MyonEvent(arduino_event_id_t event) { 
      if (event == ARDUINO_EVENT_ETH_GOT_IP) {
...............
}  // that is real function

Debug Message

20:51:43.442 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
20:51:43.442 -> configsip: 0, SPIWP:0xee
20:51:43.442 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
20:51:43.442 -> mode:DIO, clock div:1
20:51:43.442 -> load:0x3fff0030,len:4916
20:51:43.442 -> load:0x40078000,len:16492
20:51:43.442 -> load:0x40080400,len:4
20:51:43.442 -> load:0x40080404,len:3524
20:51:43.442 -> entry 0x400805b8
20:51:44.047 -> [     1][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x400e8140
20:51:44.047 -> [    12][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x400e8110
20:51:44.047 -> [    26][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x400e80e0
20:51:44.047 -> [    39][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x400e80b0
20:51:44.047 -> [    53][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x400e8140
20:51:44.047 -> [    66][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x400e8110
20:51:44.047 -> [    80][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x400e80e0
20:51:44.047 -> [    93][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x400e80b0
20:51:44.047 -> [   107][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x400e8140
20:51:44.047 -> [   120][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x400e8110
20:51:44.047 -> [   134][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x400e80e0
20:51:44.047 -> [   147][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x400e80b0
20:51:44.047 -> [   161][V][NetworkServer.h:41] NetworkServer(): NetworkServer::NetworkServer(port=80, ...)
20:51:44.047 -> [   171][V][WebServer.cpp:49] WebServer(): WebServer::Webserver(port=80)
20:51:44.047 -> [   179][V][NetworkServer.h:41] NetworkServer(): NetworkServer::NetworkServer(port=80, ...)
20:51:44.047 -> [   190][V][WebServer.cpp:49] WebServer(): WebServer::Webserver(port=80)
20:51:44.047 -> [   198][V][NetworkServer.h:41] NetworkServer(): NetworkServer::NetworkServer(port=8897, ...)
20:51:44.047 -> [   209][V][esp32-hal-uart.c:421] uartBegin(): UART0 baud(115200) Mode(800001c) rxPin(3) txPin(1)
20:51:44.047 -> [   220][V][esp32-hal-uart.c:510] uartBegin(): UART0 not installed. Starting installation
20:51:44.047 -> [   230][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 3 successfully set to type UART_RX (2) with bus 0x3ffbdc14
20:51:44.047 -> [   249][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 1 successfully set to type UART_TX (3) with bus 0x3ffbdc14
20:51:44.047 -> [   260][V][esp32-hal-uart.c:575] uartBegin(): UART0 initialization done.
20:51:44.047 -> [   276][I][EEPROM.cpp:98] begin(): New EEPROM of 1024 bytes
20:51:44.047 -> EEPROM marker mismatch, found '255255255255255255255255255255255255255255'
20:51:44.047 -> EEPROM initializing...
20:51:44.047 -> Saved properties (2 bytes).
20:51:44.047 -> EEPROM initialized
20:51:44.047 -> [   295][D][esp32-hal-cpu.c:263] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
20:51:44.047 -> =========== Before Setup Start ===========
20:51:44.047 -> Chip Info:
20:51:44.047 -> ------------------------------------------
20:51:44.047 ->   Model             : ESP32
20:51:44.047 ->   Package           : D0WD-Q5
20:51:44.047 ->   Revision          : 1.01
20:51:44.047 ->   Cores             : 2
20:51:44.047 ->   CPU Frequency     : 240 MHz
20:51:44.047 ->   XTAL Frequency    : 40 MHz
20:51:44.047 ->   Features Bitfield : 0x00000032
20:51:44.047 ->   Embedded Flash    : No
20:51:44.047 ->   Embedded PSRAM    : No
20:51:44.047 ->   2.4GHz WiFi       : Yes
20:51:44.047 ->   Classic BT        : Yes
20:51:44.047 ->   BT Low Energy     : Yes
20:51:44.047 ->   IEEE 802.15.4     : No
20:51:44.047 -> ------------------------------------------
20:51:44.047 -> INTERNAL Memory Info:
20:51:44.047 -> ------------------------------------------
20:51:44.047 ->   Total Size        :   368180 B ( 359.6 KB)
20:51:44.047 ->   Free Bytes        :   321792 B ( 314.2 KB)
20:51:44.047 ->   Allocated Bytes   :    37700 B (  36.8 KB)
20:51:44.047 ->   Minimum Free Bytes:   316708 B ( 309.3 KB)
20:51:44.047 ->   Largest Free Block:   110580 B ( 108.0 KB)
20:51:44.047 -> ------------------------------------------
20:51:44.047 -> Flash Info:
20:51:44.047 -> ------------------------------------------
20:51:44.047 ->   Chip Size         :  4194304 B (4 MB)
20:51:44.047 ->   Block Size        :    65536 B (  64.0 KB)
20:51:44.047 ->   Sector Size       :     4096 B (   4.0 KB)
20:51:44.047 ->   Page Size         :      256 B (   0.2 KB)
20:51:44.047 ->   Bus Speed         : 80 MHz
20:51:44.047 ->   Bus Mode          : QIO
20:51:44.047 -> ------------------------------------------
20:51:44.186 -> Partitions Info:
20:51:44.186 -> ------------------------------------------
20:51:44.186 ->                 nvs : addr: 0x00009000, size:    20.0 KB, type: DATA, subtype: NVS
20:51:44.186 ->             otadata : addr: 0x0000E000, size:     8.0 KB, type: DATA, subtype: OTA
20:51:44.186 ->                app0 : addr: 0x00010000, size:  1280.0 KB, type:  APP, subtype: OTA_0
20:51:44.186 ->                app1 : addr: 0x00150000, size:  1280.0 KB, type:  APP, subtype: OTA_1
20:51:44.186 ->              spiffs : addr: 0x00290000, size:  1408.0 KB, type: DATA, subtype: SPIFFS
20:51:44.186 ->            coredump : addr: 0x003F0000, size:    64.0 KB, type: DATA, subtype: COREDUMP
20:51:44.186 -> ------------------------------------------
20:51:44.186 -> Software Info:
20:51:44.186 -> ------------------------------------------
20:51:44.186 ->   Compile Date/Time : Mar 26 2025 16:56:15
20:51:44.186 ->   Compile Host OS   : windows
20:51:44.186 ->   ESP-IDF Version   : v5.3.2-584-g489d7a2b3a-dirty
20:51:44.186 ->   Arduino Version   : 3.1.3
20:51:44.186 -> ------------------------------------------
20:51:44.186 -> Board Info:
20:51:44.186 -> ------------------------------------------
20:51:44.186 ->   Arduino Board     : WT32_ETH01
20:51:44.186 ->   Arduino Variant   : wt32-eth01
20:51:44.186 ->   Arduino FQBN      : esp32:esp32:wt32-eth01:PartitionScheme=default,FlashMode=qio,FlashFreq=80,UploadSpeed=921600,DebugLevel=verbose,EraseFlash=all
20:51:44.186 -> ============ Before Setup End ============
20:51:44.370 -> [   616][V][esp32-hal-uart.c:421] uartBegin(): UART0 baud(115200) Mode(800001c) rxPin(3) txPin(1)
20:51:44.370 -> [   624][V][esp32-hal-uart.c:434] uartBegin(): UART0 Driver already installed.
20:51:44.370 -> Ready..
20:51:44.370 -> ETH Event function registered!
20:51:44.370 -> Server module initialization of Ethernet, MAC:00:00:00:00:00:00
20:51:44.370 -> [   632][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type ETHERNET_RMII (49) successfully set to 0x400d981c
20:51:44.370 -> [   652][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type ETHERNET_CLK (50) successfully set to 0x400d981c
20:51:44.370 -> [   664][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type ETHERNET_MCD (51) successfully set to 0x400d981c
20:51:44.370 -> [   676][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type ETHERNET_MDIO (52) successfully set to 0x400d981c
20:51:44.370 -> [   688][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type ETHERNET_PWR (53) successfully set to 0x400d981c
20:51:45.999 -> [  2232][V][ETH.cpp:109] _onEthEvent(): eth0 Started
20:51:45.999 -> [  2232][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 0 successfully set to type ETHERNET_CLK (50) with bus 0x3ffc21f0
20:51:45.999 -> [  2248][V][NetworkEvents.cpp:117] _checkForEvent(): Network Event: 1 - ETH_START
20:51:45.999 -> [  2249][V][ETH.cpp:100] _onEthEvent(): eth0 Connected
20:51:45.999 -> [  2260][V][NetworkEvents.cpp:117] _checkForEvent(): Network Event: 3 - ETH_CONNECTED
20:51:45.999 -> [  2248][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 23 successfully set to type ETHERNET_MCD (51) with bus 0x3ffc21f0
20:51:45.999 -> [  2279][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 18 successfully set to type ETHERNET_MDIO (52) with bus 0x3ffc21f0
20:51:45.999 -> [  2290][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 21 successfully set to type ETHERNET_RMII (49) with bus 0x3ffc21f0
20:51:45.999 -> [  2301][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 19 successfully set to type ETHERNET_RMII (49) with bus 0x3ffc21f0
20:51:45.999 -> [  2313][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 22 successfully set to type ETHERNET_RMII (49) with bus 0x3ffc21f0
20:51:45.999 -> [  2324][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 25 successfully set to type ETHERNET_RMII (49) with bus 0x3ffc21f0
20:51:45.999 -> [  2335][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 26 successfully set to type ETHERNET_RMII (49) with bus 0x3ffc21f0
20:51:45.999 -> [  2346][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 27 successfully set to type ETHERNET_RMII (49) with bus 0x3ffc21f0
20:51:45.999 -> [  2358][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 16 successfully set to type ETHERNET_PWR (53) with bus 0x3ffc21f0
20:51:46.280 -> 0.0.0.0
20:51:46.280 -> 08:F9:E0:A8:55:37
20:51:46.280 -> ETH Service started!
20:51:46.280 -> Added MppRelay on pin 5
20:51:46.280 -> [  2420][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x4012f5c4
20:51:46.280 -> [  2436][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 5 successfully set to type GPIO (1) with bus 0x6
20:51:46.280 -> Added MppRelay on pin 12
20:51:46.280 -> [  2446][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x4012f5c4
20:51:46.280 -> [  2459][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 12 successfully set to type GPIO (1) with bus 0xd
20:51:46.280 -> Added MppRelay on pin 14
20:51:46.280 -> [  2469][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x4012f5c4
20:51:46.280 -> [  2482][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 14 successfully set to type GPIO (1) with bus 0xf
20:51:46.280 -> Device UDN:MppSwitch_08f9e0a85537_1 begin MAC: 08:F9:E0:A8:55:37,  IP :0.0.0.0  
20:51:46.280 -> Device UDN:MppSwitch_08f9e0a85537_2 begin MAC: 08:F9:E0:A8:55:37,  IP :0.0.0.0  
20:51:46.280 -> Device UDN:MppSwitch_08f9e0a85537_3 begin MAC: 08:F9:E0:A8:55:37,  IP :0.0.0.0  
20:51:46.280 -> Waiting for IP address.. =========== After Setup Start ============
20:51:46.280 -> INTERNAL Memory Info:
20:51:46.280 -> ------------------------------------------
20:51:46.280 ->   Total Size        :   368180 B ( 359.6 KB)
20:51:46.280 ->   Free Bytes        :   285332 B ( 278.6 KB)
20:51:46.280 ->   Allocated Bytes   :    71808 B (  70.1 KB)
20:51:46.280 ->   Minimum Free Bytes:   284728 B ( 278.1 KB)
20:51:46.280 ->   Largest Free Block:   110580 B ( 108.0 KB)
20:51:46.280 -> ------------------------------------------
20:51:46.280 -> GPIO Info:
20:51:46.280 -> ------------------------------------------
20:51:46.280 ->   GPIO : BUS_TYPE[bus/unit][chan]
20:51:46.280 ->   --------------------------------------  
20:51:46.280 ->      0 : ETHERNET_CLK
20:51:46.280 ->      1 : UART_TX[0]
20:51:46.280 ->      3 : UART_RX[  2566][V][NetworkInterface.cpp:78] _onIpEvent(): eth0 Got New IP: 192.168.1.19 MASK: 255.255.255.0 GW: 192.168.1.1
20:51:46.280 -> [0][  2576][V][NetworkEvents.cpp:117] _checkForEvent(): Network Event: 5 - ETH_GOT_IP

Other Steps to Reproduce

If only step down back to 3.0.7 without changing the code the events works fine.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@sergshadrap sergshadrap added the Status: Awaiting triage Issue is waiting for triage label Mar 27, 2025
@me-no-dev
Copy link
Member

Use Network.onEvent(...)

@sergshadrap
Copy link
Author

Thanks..... Could you be so kind a bit clear ? I see the class : class NetworkEvents and the 3 functions for registering callback inside. And I made the instance in my header like NetworkEvents networkEvents; I don't see any Network class this library..

@me-no-dev
Copy link
Member

Network is the instance on NetworkManager which implements NetworkEvents, so NetworkEvents does not need/have it's own instance.

@sergshadrap
Copy link
Author

Thanks. That is clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting triage Issue is waiting for triage
Projects
None yet
Development

No branches or pull requests

2 participants