ESP-PoE-ISO - not getting any events

Started by Drjaymz, November 10, 2022, 07:08:29 PM

Previous topic - Next topic

Drjaymz

Using the example sketch I never get any events and thus eth_connected is always false.

However, once you turn verbose on you see this....

[     4][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
[  1747][V][WiFiGeneric.cpp:435] _arduino_event_cb(): Ethernet Started
[  1747][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 18 - ETH_START
[  1749][V][WiFiGeneric.cpp:428] _arduino_event_cb(): Ethernet Link Up
[  1755][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 20 - ETH_CONNECTED
[  1763][V][WiFiGeneric.cpp:443] _arduino_event_cb(): Ethernet got newip:192.168.0.92
[  1770][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 22 - ETH_GOT_IP
[  1777][D][WiFiGeneric.cpp:1027] _eventCallback(): ETH IP: 192.168.0.92, MASK: 255.255.255.0, GW: 192.168.0.1

So looks like its working to me and firing the events.
So why does the event not fire?

Replacing the eth_connected and....

connecting to google.com
HTTP/1.1 301 Moved Permanently       
Location: http://www.google.com/     
Content-Type: text/html; charset=UTF-8
Date: Thu, 10 Nov 2022 19:05:26 GMT   
Expires: Sat, 10 Dec 2022 19:05:26 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 219
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
closing connection


So its working but not working

Drjaymz

My work around for now is to:

  Serial.print("info: Ethernet connecting ");

  int timeout = 0;

  while (!ETH.localIP()[0] && timeout < 20)
  {
    delay(500);
    Serial.print(".");
    timeout++;
  }
  Serial.print(" Connected\n");

So this looks to see when the first IP byte is not 0 and then we're connected.

The message callbacks are not working deeper in the framework because the ETH.linkup() is still false when we're connected.

So, with this board, or the latest framework or something - the example doesn't work.

Drjaymz

Resolved:

Example is out of date.  Back in 2021 this changed.
I added a debug and noticed that the event is firing but that the enumerations are wrong.  I saw elsewhere people fiddling with the framework, just change your example, otherwise people's projects will not work when other people download them.

void WiFiEvent(WiFiEvent_t event)
{
  //debug.println("info: WiFiEvent Received");
  switch (event)
  {
  case ARDUINO_EVENT_ETH_START:
    debug.println("ETH Started");
    // set eth hostname here
    ETH.setHostname("esp32-ethernet");
    break;
  case ARDUINO_EVENT_ETH_CONNECTED:
    debug.println("ETH Connected");
    break;
  case ARDUINO_EVENT_ETH_GOT_IP:
    debug.print("ETH MAC: ");
    debug.print(ETH.macAddress());
    debug.print(", IPv4: ");
    debug.print(ETH.localIP());
    if (ETH.fullDuplex())
    {
      debug.print(", FULL_DUPLEX");
    }
    debug.print(", ");
    debug.print(ETH.linkSpeed());
    debug.println("Mbps");
    eth_connected = true;
    break;
  case ARDUINO_EVENT_ETH_DISCONNECTED:
    debug.println("ETH Disconnected");
    eth_connected = false;
    break;
  case ARDUINO_EVENT_ETH_STOP:
    debug.println("ETH Stopped");
    eth_connected = false;
    break;
  default:
    break;
  }
}

LubOlimex

Yeah for this basic Ethernet example it is better to load the one inside the Arduino package for ESP32, it should work fine.

The examples at our GitHub were made with older versions of the ESP32 package for Arduino, maybe libraries and more changed. If you are having issues with them either use them only as basis (and consider re-work) or install older version of the ESP32 package for Arduino or simply use them as a template.
Technical support and documentation manager at Olimex