LAN8720 and ESP32, Reduce power power consumption

dzungpv
Posts: 43
Joined: Thu Mar 26, 2020 4:52 am

LAN8720 and ESP32, Reduce power power consumption

Postby dzungpv » Fri Jan 10, 2025 7:44 am

I design a board with LAN8720a and ESP32 connect to it using RMII interface, with internal 1.2V enable.
In active mode speed 100Mbps it consume about 110ma, include all the LAN parts: 2 led, transformer.
My application does not require full speed of LAN8720A, 10Mbps is enough for it. So I try to reduce speed in order to reduce power power consumption

My hardware design now:
  • PHYAD0 = 1
    MODE[2:0] = 111
    REGOFF = 0 = enable 1.2V internal regulator
    nINTSEL = 1 = external clock
It working but when I try to disable auto-negotiation and force 10 Mbps it stop working.
I use ESP IDF sample here: https://github.com/espressif/esp-idf/tr ... rnet/basic

And use below code to change to 10Mbps:

Code: Select all

        bool autoneg_off = false;  // disable auto-negotiation
        eth_speed_t speed_10m = ETH_SPEED_10M;
        // -------------------------------------------------
        // Disable auto-negotiation and force 10 Mbps here
        // -------------------------------------------------
        ESP_LOGI(TAG, "Disabling auto-negotiation and forcing 10Mbps...");
        // 1) Disable Auto-Negotiation
        ESP_ERROR_CHECK(esp_eth_ioctl(eth_handle, ETH_CMD_S_AUTONEGO, &autoneg_off));

        // 2) Force 10 Mbps
        ESP_ERROR_CHECK(esp_eth_ioctl(eth_handle, ETH_CMD_S_SPEED, &speed_10m));
        ESP_ERROR_CHECK(esp_eth_start(eth_handle));
So it is possible to change above value with software, or I must change it in the hardware?

dzungpv
Posts: 43
Joined: Thu Mar 26, 2020 4:52 am

Re: LAN8720 and ESP32, Reduce power power consumption

Postby dzungpv » Fri Jan 10, 2025 9:10 am

I can make it change to 10Mbps now. I verify this with code:

Code: Select all


void check_link_speed(esp_eth_handle_t eth_handle)
{
    eth_speed_t cur_speed;
    esp_err_t ret = esp_eth_ioctl(eth_handle, ETH_CMD_G_SPEED, &cur_speed);
    if (ret == ESP_OK) {
        if (cur_speed == ETH_SPEED_10M) {
            ESP_LOGI("ETH", "Current link speed: 10 Mbps");
        } else if (cur_speed == ETH_SPEED_100M) {
            ESP_LOGI("ETH", "Current link speed: 100 Mbps");
        } else {
            ESP_LOGI("ETH", "Unknown link speed (not 10M or 100M)");
        }
    } else {
        ESP_LOGE("ETH", "Failed to get link speed (err=0x%x)", ret);
    }
}
But the power usage still the same. Anyone have experience with this chip can give me a hint?

ondrej
Espressif staff
Espressif staff
Posts: 227
Joined: Fri May 07, 2021 10:35 am

Re: LAN8720 and ESP32, Reduce power power consumption

Postby ondrej » Fri Jan 10, 2025 2:35 pm

Could be effect of LAN8720 errata, please see https://github.com/espressif/esp-idf/bl ... #L167-L182

dzungpv
Posts: 43
Joined: Thu Mar 26, 2020 4:52 am

Re: LAN8720 and ESP32, Reduce power power consumption

Postby dzungpv » Fri Jan 10, 2025 4:49 pm

Could be effect of LAN8720 errata, please see https://github.com/espressif/esp-idf/bl ... #L167-L182
Thank you for the information about errata my chip version is B and they do not plan to fix it. Is there work around from their errata docs include in the driver?
Anomaly 1: Connectivity/Link Issue in Manual Mode
Description
When the device is in manual 100BASE-TX or 10BASE-T modes with Auto-MDIX enabled, the PHY does not link to a
link partner that is configured for auto-negotiation.
End User Implications
The device will not link with an auto-negotiation PHY when auto-MDIX is enabled and the device is configured to be
limited to 100BASE-TX or 10BASE-T.
Work around
If the device is configured to be limited to 100BASE-TX or 10BASE-T, ensure that auto-MDIX is disabled via bit
15 of SMI register 27 and that the correct TX and RX channels are selected via bit 13 of register 27.
Plan
This will not be addressed in a future stepping of the device.
With your experience, should I change to other chip? And yes, what is your recommend?

ondrej
Espressif staff
Espressif staff
Posts: 227
Joined: Fri May 07, 2021 10:35 am

Re: LAN8720 and ESP32, Reduce power power consumption

Postby ondrej » Sat Jan 11, 2025 12:57 pm

The workaround are the lines of code I've already shared ;)

arjen1
Posts: 28
Joined: Sun Aug 06, 2023 4:48 pm

Re: LAN8720 and ESP32, Reduce power power consumption

Postby arjen1 » Mon Jan 27, 2025 11:46 pm

Not finding this earlier I opened a somewhat similar thread:
http://esp32.io/viewtopic.php?f=19&t=44 ... 570e429587

I managed to set LAN speed to 10M, but the strange thing is that the entire setup (WT32-eth01) draws 120mA with 80Mhz CPU and 100M LAN speed, but when I lower LAN speed to 10M it draws more! 160mA. Counter-intuitive.

I have a 'C" version LAN8720A chip that not has the anomaly.

I must overlook something...
More people having trouble with this phenomenon??

ondrej
Espressif staff
Espressif staff
Posts: 227
Joined: Fri May 07, 2021 10:35 am

Re: LAN8720 and ESP32, Reduce power power consumption

Postby ondrej » Tue Jan 28, 2025 7:14 am

Check the Note 5-7 in LAN8720 datasheet. It seems the chip itself consumes less power in 10BASE-T mode. However, the overall power consumption of Ethernet component is higher due to different signal encoding in comparison to 100BASE-TX.

arjen1
Posts: 28
Joined: Sun Aug 06, 2023 4:48 pm

Re: LAN8720 and ESP32, Reduce power power consumption

Postby arjen1 » Tue Jan 28, 2025 10:53 am

That seems to explain it:

Note 5-7 Current measurements do not include power applied to the magnetics or the optional external LEDs.
The Ethernet component current is typically 41mA in 100BASE-TX mode and 100mA in 10BASE-T
mode, independent of the 2.5V or 3.3V supply rail of the transformer.

Who is online

Users browsing this forum: Amazon [Bot], Baidu [Spider], Google [Bot], PetalBot and 4 guests