Page 1 of 1

More LAN8720 IP issues

Posted: Tue May 15, 2018 8:37 pm
by spencer
This has come up before and I've searched for everything I can find about it but still haven't found a working solution. I've been having issues similarly to what others have described trying to use a LAN8720 breakout with an ESP32 WROOM...the PHY seems to be working, it detects the ethernet cable being plugged in but I never get an IP address.

I (3483) emac: emac start success !!!
I (7483) eth_example: ~~~~~~~~~~~
I (7483) eth_example: ETHIP:0.0.0.0
I (7483) eth_example: ETHPMASK:0.0.0.0
I (7483) eth_example: ETHPGW:0.0.0.0
I (7483) eth_example: ~~~~~~~~~~~
I (7493) emac: eth link_up!!!
I (9483) eth_example: ~~~~~~~~~~~
I (9483) eth_example: ETHIP:0.0.0.0
I (9483) eth_example: ETHPMASK:0.0.0.0
I (9483) eth_example: ETHPGW:0.0.0.0
I (9483) eth_example: ~~~~~~~~~~~

Setup info:
I have 3 different variants of LAN8720 breakout, original Waveshare and 2 different kinds of cheap clones.
Testing on WROOM dev boards from two sources and a custom board.

I am using the esp-idf ethernet example: LAN8720 selected, PHY Address 1, clock mode: GPIO0 input, MDC: io16, MDIO: io17

Connected as described here: https://sautter.com/blog/ethernet-on-es ... g-lan8720/

Interestingly on one older wroom dev board I have, the link is established and I receive an IP. No other ESP modules seem to work though and I can't figure out what could be different. The one that works is older than the rest, not sure if anything internally is different.

Clock signal integrity seems to be a common cause for this, but my 50MHz signal looks clean and in some of my test setups the connections are clean and short (otherwise I'm using jumpers to connect breakout to dev board, including on the one setup that actually works).

I feel a bit stuck at the moment, does anyone have other ideas of things I should look into?

Thanks!

Re: More LAN8720 IP issues

Posted: Wed May 16, 2018 8:28 pm
by spencer
Here's a bit more info.

The working setup is using an ESP32 Core Board V2: https://www.adafruit.com/product/3269

Non-working setups are using this dev board from http://www.doit.am: http://www.smartarduino.com/esp32-devel ... 95103.html and my board with more ideal connections using modules from GridConnect (https://gridconnect.com/wireless-wifi-b ... om-32.html)

I've confirmed that the LAN8720 boards work with the one good dev board...and triple checked the connections on everything else.

Image

Here's what my clock looks like through the long jumper:
Image

Re: More LAN8720 IP issues

Posted: Thu May 17, 2018 1:07 am
by WiFive
Your image links are bad or private.

Doit has external pullup on gpio0

Re: More LAN8720 IP issues

Posted: Thu May 17, 2018 1:25 am
by spencer
WiFive wrote:Your image links are bad or private.

Doit has external pullup on gpio0
Oh thanks, should be fixed.

It should have an external pullup on gpio0 so that it doesn't get stuck in the bootloader on startup.

Re: More LAN8720 IP issues

Posted: Thu May 17, 2018 6:14 am
by spencer
WiFive wrote:Doit has external pullup on gpio0
Wow, removing the external pullup on my board and the doit dev board fixed them both. thank you!

I'm confused because espressif's Core Board v2 is working and its schematic shows a 5k pullup on io0 too. Frank Sautter's post (https://sautter.com/blog/ethernet-on-es ... g-lan8720/) mentions needing an external pullup also...

Re: More LAN8720 IP issues

Posted: Thu May 17, 2018 11:30 am
by mikemoy
Just a quick question to confirm. I don't see how you are enabling / disabling the 50mhz clock on the Ethernet board. Are you really following the instructions from https://sautter.com/blog/ethernet-on-es ... g-lan8720/

You board should have a jumper from the OSC en pin to the NC pin on the header, and did you add the resistors as well that he talks about. I do not see them on your board.
WIN_20180517_06_24_27_Pro.jpg
WIN_20180517_06_24_27_Pro.jpg (310.75 KiB) Viewed 6748 times
WIN_20180517_06_24_41_Pro.jpg
WIN_20180517_06_24_41_Pro.jpg (269.92 KiB) Viewed 6748 times

Re: More LAN8720 IP issues

Posted: Thu May 17, 2018 6:51 pm
by spencer
Initially I intended to switch power to the module with a transistor instead of toggling the oscillator enable pin so that I didn't have to modify every LAN board, but even with no power supplied to the VCC, io0 would still get pulled down. To remove the variable of booting correctly while troubleshooting the IP problem I was just booting first then plugging in the module or io0 jumper later. (plugging the module in after booting isn't a good idea, by the way. It has the same behavior of saying ETH link up and never getting an IP. )

The pull down on the OSC enable makes sense, but now I'm unsure about the pull up on the OSC output since adding a 4.7k external pull up to io0 seemed to break it. I'll investigate that more.

Re: More LAN8720 IP issues

Posted: Sun May 20, 2018 11:28 pm
by mikemoy
I have found some boards present the same issues you talk about. The main problem is sending the 50MHZ signal over these long wires.
I found that doing the following eliminated all my issues.
Hopefully the wires you have come in a ribbon cable style like this, which you peel each one off.
WIN_20180520_18_22_59_Pro.jpg
WIN_20180520_18_22_59_Pro.jpg (218.48 KiB) Viewed 6637 times
Peel off 3 as a set. (I.E. do not peel off each one separately, but 3 at one time.)
There are 2 GND pins on the LAN board. Connect the 2 outside wires to both GND pins on the LAN board, and the other ends to GND on the ESP32 board. Use the center wire for the RETCLK.
This will help shield it.

Re: More LAN8720 IP issues

Posted: Tue Feb 19, 2019 9:43 pm
by danielt514
I got it working following these instructions:
http://blog3.narimatsu.net/article/180309a
You have to remove the oscillator from LAN8720 !

Advantage: you dont use GPIO0!

Code: Select all

#include <ETH.h>
#define ETH_CLK_MODE    ETH_CLOCK_GPIO17_OUT

// Pin# of the enable signal for the external crystal oscillator (-1 to disable for internal APLL source)
#define ETH_POWER_PIN   -1

// Type of the Ethernet PHY (LAN8720 or TLK110)
#define ETH_TYPE        ETH_PHY_LAN8720

// I²C-address of Ethernet PHY (0 or 1 for LAN8720, 31 for TLK110)
#define ETH_ADDR        1

// Pin# of the I²C clock signal for the Ethernet PHY
#define ETH_MDC_PIN     23

// Pin# of the I²C IO signal for the Ethernet PHY
#define ETH_MDIO_PIN    18
Some Arduino code i use to Benchmark it with iPerf:
https://drive.google.com/drive/folders/ ... nhfkHMTbow

I get 35Mbps!

Not bad... i know it coul;d be around 60Mbps... but 35 id good enought for me!

Daniel

Re: More LAN8720 IP issues

Posted: Tue Dec 24, 2019 12:03 pm
by esp1313
Hi,

I get some trouble to use my LAN8720 board with an esp32 yellow pin board.
Before removing the crystal as you do, could it be possible that you check my issue here https://github.com/espressif/arduino-esp32/issues/2907 so I don't damage anything?