Ethernet example fails to discover DHCP assigned address

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Ethernet example fails to discover DHCP assigned address

Postby PeterR » Fri Jun 29, 2018 2:02 pm

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.
Attachments
ethernet_example_main.c
(5.8 KiB) Downloaded 854 times
& I also believe that IDF CAN should be fixed.

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: Ethernet example fails to discover DHCP assigned address

Postby PeterR » Sat Jun 30, 2018 6:44 pm

Bump. Anyone able to repeat with supplied code?
& I also believe that IDF CAN should be fixed.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Ethernet example fails to discover DHCP assigned address

Postby WiFive » Sat Jun 30, 2018 8:10 pm

Would suggest you set debug log level

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: Ethernet example fails to discover DHCP assigned address

Postby PeterR » Sun Jul 01, 2018 9:10 pm

Can do, new to ESP32 - which compile option?
If u have 5, are youable to repeat?
& I also believe that IDF CAN should be fixed.

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: Ethernet example fails to discover DHCP assigned address

Postby PeterR » Mon Jul 02, 2018 9:20 am

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?
& I also believe that IDF CAN should be fixed.

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: Ethernet example fails to discover DHCP assigned address

Postby PeterR » Tue Jul 03, 2018 1:10 pm

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 ?
& I also believe that IDF CAN should be fixed.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Ethernet example fails to discover DHCP assigned address

Postby WiFive » Tue Jul 03, 2018 2:02 pm

Is there a difference in debug output?

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: Ethernet example fails to discover DHCP assigned address

Postby PeterR » Tue Jul 03, 2018 2:17 pm

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.
& I also believe that IDF CAN should be fixed.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Ethernet example fails to discover DHCP assigned address

Postby WiFive » Tue Jul 03, 2018 4:52 pm

Post the debug output anyway

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: Ethernet example fails to discover DHCP assigned address

Postby PeterR » Wed Jul 04, 2018 8:49 am

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.
Attachments
debug-fails.txt
Fails to gain IP address
(11.3 KiB) Downloaded 796 times
info-working.txt
Gains IP address
(6.61 KiB) Downloaded 781 times
& I also believe that IDF CAN should be fixed.

Who is online

Users browsing this forum: ok-home and 120 guests