Olimex Support Forum

Microcontrollers => ESP32 => Topic started by: MihaMarkic on September 21, 2022, 11:48:08 PM

Title: Wrong WiFiEvent_t values
Post by: MihaMarkic on September 21, 2022, 11:48:08 PM
Just got my ESP32-PoE-ISO and trying Ethernet connection (oddly through WifiClient if I understand correctly).
Anyway, simple DHCP connection seems working it's just that WiFiEvent_t values I'm getting in WiFi.onEvent callback don't match ones declared in esp_event_legacy.h.
I'm getting values in this order: 18, 20, 22 while SYSTEM_EVENT_ETH_START is defined as 26, SYSTEM_EVENT_ETH_CONNECTED as 28, etc.
I'm using PlatformIO with Arduino framework and #include <ETH.h>

Perhaps it's something obvious?
Title: Re: Wrong WiFiEvent_t values
Post by: LubOlimex on September 22, 2022, 10:47:40 AM
Maybe you can test with the default Arduino IDE demo, I can vouch it works since I've tested that one. Such a test would reduce the chances of a software problem (not eliminate it, since it still can be an issue in the network equipment and/or its configuration).

The board is supported in the official Arduino package for ESP32. So, if you haven't already first install the latest official package, follow the advice here:

https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html

Then go to Tools -> Board -> Olimex ESP32-POE-ISO and select it then also select the COM port of the device.

Then load the default example for Ethernet, from File -> Examples -> Ethernet -> ETH_LAN8720. Compile and upload. The demo probes www.google.com, check the "Serial Monitor" for activity.
Title: Re: Wrong WiFiEvent_t values
Post by: MihaMarkic on September 22, 2022, 12:25:26 PM
Duh, mystery solved. I was using wrong enums, i.e. SYSTEM_EVENT_ETH_START instead of ARDUINO_EVENT_ETH_START. Oh well, that's C++ for me. :)