Page 1 of 1

ESP32-DevKitC / LAN 8720 Waveshare DHCP Client doesn't start

Posted: Wed Feb 27, 2019 8:37 pm
by joelparker
I have the sample Ethernet code running and have managed to bring the Ethernet stack up but for some reason the DHCP client is not starting. Does anyone know why this is happening ? Am I missing a menu config parameter or something ?

Here is the relevant output from monitor mode:

I (0) cpu_start: App cpu up.
I (258) heap_init: Initializing. RAM available for dynamic allocation:
I (265) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (271) heap_init: At 3FFB4030 len 0002BFD0 (175 KiB): DRAM
I (277) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (284) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (290) heap_init: At 400883DC len 00017C24 (95 KiB): IRAM
I (296) cpu_start: Pro cpu start user code
I (314) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (317) eth_example: Power On Ethernet PHY
I (327) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (337) emac: emac reset done
I (337) eth_example: Ethernet Started
I (4337) eth_example: Ethernet Link Up

*** I was expecting the dhcp client to obtain an IP Address at this point but the output ends as soon as the link goes up.

Re: ESP32-DevKitC / LAN 8720 Waveshare DHCP Client doesn't start

Posted: Thu Feb 28, 2019 2:21 am
by ESP_morris
Can you show how you connect LAN8720 with ESP32-DevKitC? And the sdkconfig file?

And I would suggest you see this first: https://github.com/espressif/esp-idf/pull/1127

Re: ESP32-DevKitC / LAN 8720 Waveshare DHCP Client doesn't start

Posted: Thu Feb 28, 2019 2:04 pm
by joelparker
I wired it exactly like this article : https://sautter.com/blog/ethernet-on-es ... g-lan8720/ I don't seem to have any clock issues but with getting assigned a dynamic IP address. The clock was originally giving me pain and always stopping with an emac : Reset EMAC Timeout error but when I changed the config to use the Inverted output of 50MHz APLL clock it seems to work fine or at least get to the point where the ethernet link is up. I have attached the sdkconfig file.

Also as a point of clarification, this is what I am not seeing after the ethernet link is up :

I (11616) event: eth ip: 192.168.2.156, mask: 255.255.255.0, gw: 192.168.2.2
I (11616) eth_example: Ethernet Got IP Addr
I (11616) eth_example: ~~~~~~~~~~~
I (11616) eth_example: ETHIP:192.168.2.156
I (11626) eth_example: ETHMASK:255.255.255.0
I (11626) eth_example: ETHGW:192.168.2.2
I (11636) eth_example: ~~~~~~~~~~~

Re: ESP32-DevKitC / LAN 8720 Waveshare DHCP Client doesn't start

Posted: Fri Mar 01, 2019 2:59 am
by ESP_morris
So you're using GPIO17 output mode for Ethernet RMII Clock.
Something you need to check:
1. You're not using a ESP32 with a PSRAM, because PSRAM also take on this GPIO.
2. Make sure you have connected GPIO17 to LAN8720's REFCLOCK (and LAN8720's clock mode has been set to using external clock by some strapping resistance).
3. In you sdkconfig file, I found you also enable the CONFIG_PHY_USE_POWER_PIN which also configured to GPIO17! Actually you event don't have to enable this function since you're not using the GPIO0 Input mode for RMII Clock.

Code: Select all

CONFIG_PHY_IP101=
CONFIG_PHY_TLK110=
CONFIG_PHY_LAN8720=y
CONFIG_PHY_ADDRESS=1
CONFIG_PHY_CLOCK_GPIO0_IN=
CONFIG_PHY_CLOCK_GPIO0_OUT=
CONFIG_PHY_CLOCK_GPIO16_OUT=
CONFIG_PHY_CLOCK_GPIO17_OUT=y	# GPIO17 Here
CONFIG_PHY_CLOCK_MODE=3
CONFIG_PHY_USE_POWER_PIN=y		
CONFIG_PHY_POWER_PIN=17			# GPIO17 Here Again
CONFIG_PHY_SMI_MDC_PIN=23
CONFIG_PHY_SMI_MDIO_PIN=18

Re: ESP32-DevKitC / LAN 8720 Waveshare DHCP Client doesn't start

Posted: Fri Mar 01, 2019 3:22 pm
by joelparker
I am still running into the same issue and have verified the following:

1. I am using an ESP32-WROOM-32 which does not use PSRAM (https://docs.espressif.com/projects/esp ... oards.html)
2. I removed the CONFIG_PHY_USE_POWER_PIN option from my configuration ( I attached the new sdkconfig file)

Lastly, here is the wiring for the clock:

NC-4.7k - GPIO17
nINT/RETClk - 4.7k - GPIO0

and the LAN 8720 Waveshare board has a wire soldered from the enable contact of the oscillator to the NC pin as described in this article:
https://sautter.com/blog/ethernet-on-es ... g-lan8720/

Re: ESP32-DevKitC / LAN 8720 Waveshare DHCP Client doesn't start

Posted: Fri Mar 01, 2019 11:28 pm
by WiFive
The instructions on that blog are for using gpio0 as clock input not gpio17 as clock output