From ad922bfc0d66e40a24212e45e4a36531aa6dda9a Mon Sep 17 00:00:00 2001 From: Ondrej Kosta Date: Wed, 28 Jan 2026 14:23:11 +0100 Subject: [PATCH] fix(esp_eth): fixed basic example MAC address config for SPI ETH --- .../basic/components/ethernet_init/ethernet_init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/ethernet/basic/components/ethernet_init/ethernet_init.c b/examples/ethernet/basic/components/ethernet_init/ethernet_init.c index 831e8cb207..93877f3988 100644 --- a/examples/ethernet/basic/components/ethernet_init/ethernet_init.c +++ b/examples/ethernet/basic/components/ethernet_init/ethernet_init.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -271,16 +271,16 @@ esp_err_t example_eth_init(esp_eth_handle_t *eth_handles_out[], uint8_t *eth_cnt // The SPI Ethernet module(s) might not have a burned factory MAC address, hence use manually configured address(es). // In this example, Locally Administered MAC address derived from ESP32x base MAC address is used. // Note that Locally Administered OUI range should be used only when testing on a LAN under your control! - uint8_t base_mac_addr[ETH_ADDR_LEN]; - ESP_GOTO_ON_ERROR(esp_efuse_mac_get_default(base_mac_addr), err, TAG, "get EFUSE MAC failed"); + uint8_t base_eth_mac_addr[ETH_ADDR_LEN]; + ESP_GOTO_ON_ERROR(esp_read_mac(base_eth_mac_addr, ESP_MAC_ETH), err, TAG, "get ETH_MAC failed"); uint8_t local_mac_1[ETH_ADDR_LEN]; - esp_derive_local_mac(local_mac_1, base_mac_addr); + esp_derive_local_mac(local_mac_1, base_eth_mac_addr); spi_eth_module_config[0].mac_addr = local_mac_1; #if CONFIG_EXAMPLE_SPI_ETHERNETS_NUM > 1 INIT_SPI_ETH_MODULE_CONFIG(spi_eth_module_config, 1); uint8_t local_mac_2[ETH_ADDR_LEN]; - base_mac_addr[ETH_ADDR_LEN - 1] += 1; - esp_derive_local_mac(local_mac_2, base_mac_addr); + base_eth_mac_addr[ETH_ADDR_LEN - 1] += 1; + esp_derive_local_mac(local_mac_2, base_eth_mac_addr); spi_eth_module_config[1].mac_addr = local_mac_2; #endif #if CONFIG_EXAMPLE_SPI_ETHERNETS_NUM > 2