Page 1 of 2

Ethernet example fails to discover DHCP assigned address

Posted: Fri Jun 29, 2018 2:02 pm
by PeterR
See attached code which is based on the "examples/ethernet" project with a few small changes.
The enclosed example will discover its IP address when connected to a DHCP server.

There seem to be (at least) two ways to stop the DHCP discovery process.
(1) Use a stack which is not sized 2^n words (possibly just even sized)
METHOD:
Change the task creation to option (2).
Build and run.
The example will no longer collect an IP address.
This is strange as the stack size parameter in xTaskCreate() is the size in words so alignment (if that is the issue) should be assured.

(2) Some uses of printf()
METHOD:
Revert back to task creation option (1).
Rebuild and confirm that the example no longer collects an IP address.
Which is also odd as displayMemoryDetails() is using printf()

I am new to the ESP world and so think that there must be something very basic which I have not yet tuned into.

Re: Ethernet example fails to discover DHCP assigned address

Posted: Sat Jun 30, 2018 6:44 pm
by PeterR
Bump. Anyone able to repeat with supplied code?

Re: Ethernet example fails to discover DHCP assigned address

Posted: Sat Jun 30, 2018 8:10 pm
by WiFive
Would suggest you set debug log level

Re: Ethernet example fails to discover DHCP assigned address

Posted: Sun Jul 01, 2018 9:10 pm
by PeterR
Can do, new to ESP32 - which compile option?
If u have 5, are youable to repeat?

Re: Ethernet example fails to discover DHCP assigned address

Posted: Mon Jul 02, 2018 9:20 am
by PeterR
Changed log level to debug using menuconfig.
The example no longer obtains an IP address even with the 'working' settings.

This is an ESP supplied simple program with a few added printf(), really should not be this hard!
Anyone able to repeat and/or advise?

Re: Ethernet example fails to discover DHCP assigned address

Posted: Tue Jul 03, 2018 1:10 pm
by PeterR
I am running code on an ESP32-EVB. Code is built on Windows.
I have tried with the board powered using USB and external PSU and with just USB.

I have monitored TXD0, TXD1, RXD0, RXD1.
RXD0, RXD1 always trigger when I PING from PC.
TXD0, TXD1 only trigger in working versions of the code.

I note that TXD0, TXD1 share GPIO with U0CTS, U0RTS.
Rxtask init() sets

Code: Select all

uart_set_pin(UART_NUM_1, TXD_PIN, RXD_PIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
however.

I can switch between 'working' and 'not working' with the most trivial of changes. Simply adding or removing an integer counter may influence.
This makes the issue extremely difficult to diagnose.

Has anyone reproduced and/or had success with ESP_IF_ETH ?

Re: Ethernet example fails to discover DHCP assigned address

Posted: Tue Jul 03, 2018 2:02 pm
by WiFive
Is there a difference in debug output?

Re: Ethernet example fails to discover DHCP assigned address

Posted: Tue Jul 03, 2018 2:17 pm
by PeterR
Debug output breaks it completely. Nothing obvious in the log.
But as said, just adding a line can break it. Also increasing stack size can break it.

Re: Ethernet example fails to discover DHCP assigned address

Posted: Tue Jul 03, 2018 4:52 pm
by WiFive
Post the debug output anyway

Re: Ethernet example fails to discover DHCP assigned address

Posted: Wed Jul 04, 2018 8:49 am
by PeterR
Thanks for the support.
This is from an ESP-EVB. I have tried on other instances of that board.

Enclosed are the outputs from one program compiled with different log options.
'info-working.txt' is with the program compiled with loglevel set to info.
Next I changed loglevel to debug using menuconfig & recompiled producing 'debug-fails.txt'

I can also cause failures by adding and/or removing code.

The working output resets the LAN8720 many times & the failing build does not.
I know that RXD0, RXD1 carry data (when I ping) in the failing cases but TXD0, TXD1 remain idle.
This suggests that the PHY has been initialised in both cases.

I will poke around the PHY initialisation and double check voltages again, delay EMAC/PHY initialisation etc.
Would be helpful to know if any have used the EVB wired Ethernet.