Hi all,
I have a ESP32 connected to a LAN8720 chip on a custom PCB.
This all works fine. And we use it to send in sensor data to the Internet.
However we noticed that sometimes in the field the LAN8720 stops responding. This could be after a week, sometimes after 20 min. So it's random.
What happens is this:
1) Communication works we have Internet connection;
2) LAN8720 stops working/responding. I'm not sure why, but Internet connection stops...
3) Our board detects loss of internet and restarts (using esp_restart() function) when no internet connection was active for 2 hours.
4) The ESP32 comes up again, but now the LAN8720 is already started (this chip is not restarted), and the ESP is locked in a loop with the following message:
"emac: Timed out waiting for PHY register 0x3 to have value 0xc0f0 (mask 0xfff0). Current value 0xffff"
You might think "there is no clock signal present". But there is a 50 Mhz clock signal on the LAN8720. So that works.
Now to prevent this loop, we should migrate to ESP-IDF 3.2 where this bug is fixed. I am aware of that, but we keep it in the loop for now...
5) We want to use the reset pin on the LAN8720 to make it reset. So while the ESP32 is in this 'emac' loop, we pull the LAN8720 reset pin low. This works. However usually it takes 'a few times' before the ESP32 breaks the loop and starts connecting to the LAN8720 again.
6) ESP32 program code executes further, and gives a "SYSTEM_EVENT_ETH_CONNECTED" event.
7) But now.... the SMI does not respond. When I read any register on the LAN8720, it returns 0xffff.
8) Rebooting the ESP32 again causes the same "emac: Timed out waiting for PHY register 0x3 to have value 0xc0f0 (mask 0xfff0). Current value 0xffff" loop.
9) Pulling the power plug, and connecting it again, causes everything to start up fine. ESP32 and LAN8720. But this is not a desired workflow.
In a running situation we can induce this effect ourselves like this:
1) LAN8720 and ESP32 running fine (we have internet communication).
2) We pull nRST on LAN8720 low, during runtime.
3) The LAN8720 stops working, returning 0xffff on the SMI registers.
4) After reboot the LAN8720 does not connect properly giving the "emac: Timed out waiting for PHY register 0x3 to have value 0xc0f0 (mask 0xfff0). Current value 0xffff" error.
5) We pull the nRST pin low during this loop a few times, and the ESP32 breaks the loop.
6) We have "SYSTEM_EVENT_ETH_CONNECTED"
7) No internet, and reading the SMI registers causes a 0xffff response.
Any one have any ideas what goes wrong here? Why can't I use the reset pin on the LAN8720 without it being unusable until a cut the power briefly.
I would expect that pulling the nRST pin will restart the LAN8720 and everything is fine after that. But not...
Also, I am aware of the fact that the 50 Mhz clock signal needs to be present during the nRST pin low. I have checked that it is.
Anyone any ideas?
LAN8720 manual reset
Re: LAN8720 manual reset
I'm sorry, but this seems no effect. I have compiled my project with both 3.1 and 3.3 IDF framework version, but the issue remains.
Only difference is that in 3.1 it's get stuck in the "Timed out waiting for PHY..." loop. In 3.2 and 3.3 this is not the case, but still no luck resetting the LAN8720.
Re: LAN8720 manual reset
I have noticed something else.
When I reset the LAN8720 by pulling the nRST line low, the 100mbit led goes off.
Then it does not seem to respond anymore. After that the SMI registers read 0xffff.
When in a running situation I reset the LAN8720 with the control register 0, bit 15, it works.
So what is the difference in a hardware reset and a software reset?
When I reset the LAN8720 by pulling the nRST line low, the 100mbit led goes off.
Then it does not seem to respond anymore. After that the SMI registers read 0xffff.
When in a running situation I reset the LAN8720 with the control register 0, bit 15, it works.
So what is the difference in a hardware reset and a software reset?
Re: LAN8720 manual reset
I found the issue!
The address of the LAN8720 is set to 0 after pulling the reset wire low.
However my system works on address 1. This works the first time initially. But when the LAN8720 gets a reset, it changes to 0. THe ESP32 however has hardcoded address 1 in it's source-code. Therefore the rest on the LAN8720 works fine, but the ESP32 loses it's communication.
Now I have to figure out why this happens anyway. But at least I found the issue.
The address of the LAN8720 is set to 0 after pulling the reset wire low.
However my system works on address 1. This works the first time initially. But when the LAN8720 gets a reset, it changes to 0. THe ESP32 however has hardcoded address 1 in it's source-code. Therefore the rest on the LAN8720 works fine, but the ESP32 loses it's communication.
Now I have to figure out why this happens anyway. But at least I found the issue.
Who is online
Users browsing this forum: Google Adsense [Bot] and 65 guests