Ethernet basic example - Error: lan8720_pwrctl: power up failed

francisconavy
Posts: 3
Joined: Thu Jan 21, 2021 7:27 pm

Ethernet basic example - Error: lan8720_pwrctl: power up failed

Postby francisconavy » Thu Jan 21, 2021 7:35 pm

Hello, I'm trying to use ethernet basic example of esp-idf on esp32 and LAN8720.
The errors are these:

Code: Select all

E (514) lan8720: lan8720_pwrctl(359): power up failed
E (514) lan8720: lan8720_init(421): power control failed
E (514) esp_eth: esp_eth_driver_install(205): init phy failed
I already saw Frank Sautter tutorial https://sautter.com/blog/ethernet-on-es ... g-lan8720/, tried to increase sw reset timeout to 500ms and my local esp-idf repository is up to date.

My conections are exactly like this:
(the only difference is that I'm using two parallel 10k resistors as pullup and pulldown)
Image

The oscilator enable is connected to NC:
Image

And my configs are these in the moment:
Image
Image

I think did everything I could find on internet to solve this, but I must be missing out some point. Does anyone have a sugestion? I really want to make this work.

deimos
Posts: 8
Joined: Thu Jul 09, 2020 5:36 pm

Re: Ethernet basic example - Error: lan8720_pwrctl: power up failed

Postby deimos » Fri Jan 22, 2021 6:36 am

Hi,

which esp-idf version are you using? I had the same issue: https://github.com/espressif/esp-idf/issues/5425
As far, as I know, the fix is yet not released in all available versions.

Alex

francisconavy
Posts: 3
Joined: Thu Jan 21, 2021 7:27 pm

Re: Ethernet basic example - Error: lan8720_pwrctl: power up failed

Postby francisconavy » Fri Jan 22, 2021 11:25 am

Thanks for answering

My current lan8720_pwrctl function is this:

Code: Select all

static esp_err_t lan8720_pwrctl(esp_eth_phy_t *phy, bool enable)
{
    phy_lan8720_t *lan8720 = __containerof(phy, phy_lan8720_t, parent);
    esp_eth_mediator_t *eth = lan8720->eth;
    bmcr_reg_t bmcr;
    PHY_CHECK(eth->phy_reg_read(eth, lan8720->addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)) == ESP_OK,
              "read BMCR failed", err);
    if (!enable) {
        /* General Power Down Mode */
        bmcr.power_down = 1;
    } else {
        /* Normal operation Mode */
        bmcr.power_down = 0;
    }
    PHY_CHECK(eth->phy_reg_write(eth, lan8720->addr, ETH_PHY_BMCR_REG_ADDR, bmcr.val) == ESP_OK,
              "write BMCR failed", err);
    if (!enable) {
        PHY_CHECK(eth->phy_reg_read(eth, lan8720->addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)) == ESP_OK,
                  "read BMCR failed", err);
        PHY_CHECK(bmcr.power_down == 1, "power down failed", err);
    } else {
        /* wait for power up complete */
        uint32_t to = 0;
        for (to = 0; to < lan8720->reset_timeout_ms / 10; to++) {
            vTaskDelay(pdMS_TO_TICKS(10));
            PHY_CHECK(eth->phy_reg_read(eth, lan8720->addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)) == ESP_OK,
                      "read BMCR failed", err);
            if (bmcr.power_down == 0) {
                break;
            }
        }
        PHY_CHECK(to < lan8720->reset_timeout_ms / 10, "power up timeout", err);
    }
    return ESP_OK;
err:
    return ESP_FAIL;
}
I think it already has the timeout you were talking about in the issue. I also tried to increase the timeout a little bit with some hope but it didn't work.

bjh3482
Posts: 2
Joined: Sun May 31, 2020 5:37 am

Re: Ethernet basic example - Error: lan8720_pwrctl: power up failed

Postby bjh3482 » Thu Jan 28, 2021 11:06 am

phy_address = 0

bjh3482
Posts: 2
Joined: Sun May 31, 2020 5:37 am

Re: Ethernet basic example - Error: lan8720_pwrctl: power up failed

Postby bjh3482 » Thu Jan 28, 2021 11:09 am

The same problem occurred to me, but I solved the problem by setting Phy address 1 to 0.

francisconavy
Posts: 3
Joined: Thu Jan 21, 2021 7:27 pm

Re: Ethernet basic example - Error: lan8720_pwrctl: power up failed

Postby francisconavy » Thu Jan 28, 2021 6:42 pm

bjh3482 wrote:
Thu Jan 28, 2021 11:09 am
The same problem occurred to me, but I solved the problem by setting Phy address 1 to 0.
I already tried it, but it doesn't work :(
I added some prints to understand what's going on, but apparently phy_reg_write isn't doing anything.
Image
Can you send your sdkconfig file so I can take a look in your configs?

zhangshuangdong
Posts: 1
Joined: Mon Feb 22, 2021 6:34 am

Re: Ethernet basic example - Error: lan8720_pwrctl: power up failed

Postby zhangshuangdong » Mon Feb 22, 2021 7:45 am

楼主您好,我也遇到了相同的问题,请问您解决了吗?
我尝试单独使用电源给LAN8720供电,然后再使用USB口给esp32上电,可以解决这个问题。
我猜测可能与phy的供电顺序有关,期待有人能给出解决方案。


Hello, I also encountered the same problem. Have you solved it?
I tried to use the power supply alone to power the LAN8720, and then use the USB port to power on the esp32, which can solve this problem.
I guess it may be related to the power supply sequence of the phy, and I hope someone can give a solution.

jaiminajmeri
Posts: 1
Joined: Tue Apr 20, 2021 12:48 pm

Re: Ethernet basic example - Error: lan8720_pwrctl: power up failed

Postby jaiminajmeri » Tue Apr 20, 2021 1:03 pm

@francisconavy, I am facing exactly the same issue.

Were able to resolve this issue yet?
If so, please share your debug analysis or solution. Are you using the waveshare LAN8720 breakout board?

I am using a custom PCB (5 no.s) and flashed the basic ethernet example on all 5 boards.
1. I see that on 3 of my boards it works fine.
2. However on the other 2 boards, I see the "power up timeout" error.

For analysis, I print the "bmcr.power_down" value after write, as you have done, it's always 1 the write doesn't do anything.
bmcr.power_down.jpg
bmcr.power_down.jpg (71.27 KiB) Viewed 11345 times

Dansen
Posts: 9
Joined: Thu Oct 28, 2021 9:42 am

Re: Ethernet basic example - Error: lan8720_pwrctl: power up failed

Postby Dansen » Thu Dec 09, 2021 7:45 am

Hello!

did you manage to solve this problem? currently I'm stuck at the same point. Tried all of your stuff mentioned too, without success.

thanks in advance!

wrgallo
Posts: 1
Joined: Mon Jun 13, 2022 9:53 pm

Re: Ethernet basic example - Error: lan8720_pwrctl: power up failed

Postby wrgallo » Mon Jun 13, 2022 10:03 pm

In my case I was using the WT32-ETH01 and the pin used for clock (GPIO_0) was pulled up, but it should be 'not connected', simple opening that connection fixed the issue.

Who is online

Users browsing this forum: Google [Bot] and 125 guests