esp32-poe-iso stopped getting ip address

Started by ozy, November 18, 2019, 06:15:48 AM

Previous topic - Next topic

ozy

I have an esp32-poe-iso rev.B board and have been happily working on my project since August. I was able to connect to Ethernet both using Arduino and Micropython just fine up until yesterday. It suddenly stopped working: basically it says 'ETH Connected' but it never acquires the IP in dynamic IP configuration. I have a UniFi Switch 24 POE-250W.

I have tried to assign static IP address, that seems to work but the connections rarely succeed (most of the time I get connection refused) and when they do, they are very slow (I see a lot of timeouts). Additionally, there was a hard reset due to a core panic once (details below).

Since it was working fine before, it looks like it is an hardware issue. Since I had encountered the issue i had tried many different apps including the one from Olimex github (link below) as well as a simple Micropython app (see the code below). Since they don't succeed (in dynamic IP setup) I think that rules out any software issues and points to the hardware. Can anybody help? I can shipping the board to an U.S. address if Olimex folks believe it is a hardware issue and want to debug it.

The core panic:
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x40122ec2  PS      : 0x00060e30  A0      : 0x80105e22  A1      : 0x3ffb1d50 
A2      : 0x0000003c  A3      : 0x00000000  A4      : 0x3ffb1e4c  A5      : 0x0202a8c0 
A6      : 0x00000036  A7      : 0x0202a8c4  A8      : 0x80122e7e  A9      : 0x3ffb1d30 
A10     : 0x00000b38  A11     : 0x00000000  A12     : 0x00053643  A13     : 0x3ffb1d84 
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x00000005  EXCCAUSE: 0x0000001c 
EXCVADDR: 0x0202a8c4  LBEG    : 0x4000c46c  LEND    : 0x4000c477  LCOUNT  : 0x00000000 

Backtrace: 0x40122ec2:0x3ffb1d50 0x40105e1f:0x3ffb1dd0 0x40137d19:0x3ffb1e20 0x400d3ec6:0x3ffb1e40 0x400d373e:0x3ffb1e90 0x400d4baa:0x3ffb1ec0 0x400d4d82:0x3ffb1f00 0x400d1f83:0x3ffb1f30 0x400d2715:0x3ffb1f80 0x400d9451:0x3ffb1fb0 0x40089495:0x3ffb1fd0

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x1f (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac

The Olimex ethernet code I tried:
https://github.com/OLIMEX/ESP32-POE/blob/master/SOFTWARE/ARDUINO/ESP32_PoE_Ethernet_Arduino/ESP32_PoE_Ethernet_Arduino.ino

The micropyhton code:
class ConnectionException(Exception):
    pass

def connect_to_lan(timeout_msec):
    import network
    import utime
    import machine
    lan = network.LAN(
        mdc = machine.Pin(23),
        mdio = machine.Pin(18),
        power = machine.Pin(12),
        phy_type = network.PHY_LAN8720,
        phy_addr = 0,
        clock_mode=network.ETH_CLOCK_GPIO17_OUT)
    lan.active(True)
    if not lan.isconnected():
        print('Waiting for LAN connection...')
        start = utime.ticks_ms()
        while not lan.isconnected():
            if utime.ticks_diff(utime.ticks_ms(), start) > timeout_msec:
                raise ConnectionException
            utime.sleep(1)
        print('Waiting for IP assignment to be completed...')
    start = utime.ticks_ms()
    while lan.ifconfig()[0] == '0.0.0.0':
        if utime.ticks_diff(utime.ticks_ms(), start) > timeout_msec:
            raise ConnectionException
        utime.sleep(1)
    ipaddr = lan.ifconfig()
    print('LAN config: {}'.format(ipaddr))
    return ipaddr

def test_network():
    import socket
    s = socket.socket()

    ai = socket.getaddrinfo("google.com", 80)
    print("Address infos:", ai)
    addr = ai[0][-1]

    print("Connect address:", addr)
    s.connect(addr)

    s.send(b"GET / HTTP/1.0\r\n\r\n")
    print(s.recv(4096))

    s.close()
   
connect_to_lan(5000)
#lan.ifconfig(('192.168.2.100', '255.255.255.0','192.168.2.1','192.168.2.1'))
#test_network()

Note thar this issue seems related to both:
https://www.olimex.com/forum/index.php?topic=7215.0
https://www.olimex.com/forum/index.php?topic=7099.0

LubOlimex

This often gets reported with a lot of ESP32 boards. Unfortunately, it can't be clearly said what is the cause. If there was hardware problem with the board - typically the whole Ethernet part wouldn't work, not only the IP acquisition part.

The fastest way to see if it is hardware issue is to get another unit and compare behavior with the same hardware setup and same software loaded.

Other than that test what happens if after uploading the software you manually reset the board with the reset button. Does the board acquire IP after the reset?

Can this be related to network changes? Maybe also test with another PoE switch or regular switch. This would exclude an issue with the switch. Just some other regular switch or router and power the board from the USB or the Li-Po battery connector.

Also notice this Microphyton GitHub thread: https://github.com/micropython/micropython/issues/4502

We have no official US address, we are situated in Europe. But we have global partners and re-sellers. If you purchased it from US, notify the re-seller.
Technical support and documentation manager at Olimex