Skip to content

Commit

Permalink
[ESP32] Fix Ethernet Commissioning on esp-idf v5.0.2 (#27285)
Browse files Browse the repository at this point in the history
  • Loading branch information
PSONALl authored and pull[bot] committed Nov 1, 2023
1 parent 40cdbe1 commit 2307292
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion config/esp32/components/chip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ endif()

include(${CMAKE_CURRENT_LIST_DIR}/ota-image.cmake)

set(CHIP_REQUIRE_COMPONENTS freertos lwip bt mbedtls fatfs app_update console openthread nvs_flash spi_flash)
set(CHIP_REQUIRE_COMPONENTS esp_eth freertos lwip bt mbedtls fatfs app_update console openthread nvs_flash spi_flash)

if(NOT "${IDF_TARGET}" STREQUAL "esp32h2")
list(APPEND CHIP_REQUIRE_COMPONENTS mdns)
Expand Down
1 change: 1 addition & 0 deletions src/platform/ESP32/ConnectivityManagerImpl_Ethernet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <platform/ESP32/NetworkCommissioningDriver.h>
#include <platform/internal/BLEManager.h>

#include "esp_eth_com.h"
#include "esp_event.h"
#include "esp_netif.h"
#include "esp_wifi.h"
Expand Down
20 changes: 12 additions & 8 deletions src/platform/ESP32/NetworkCommissioningDriver_Ethernet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "esp_eth.h"
#include "esp_eth_mac.h"
#include "esp_eth_phy.h"
#include <platform/ESP32/NetworkCommissioningDriver.h>

using namespace ::chip;
Expand All @@ -31,14 +34,15 @@ CHIP_ERROR ESPEthernetDriver::Init(NetworkStatusChangeCallback * networkStatusCh
esp_netif_t * eth_netif = esp_netif_new(&cfg);

// Init MAC and PHY configs to default
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
phy_config.phy_addr = CONFIG_ETH_PHY_ADDR;
phy_config.reset_gpio_num = CONFIG_ETH_PHY_RST_GPIO;
mac_config.smi_mdc_gpio_num = CONFIG_ETH_MDC_GPIO;
mac_config.smi_mdio_gpio_num = CONFIG_ETH_MDIO_GPIO;
esp_eth_mac_t * mac = esp_eth_mac_new_esp32(&mac_config);
esp_eth_phy_t * phy = esp_eth_phy_new_ip101(&phy_config);
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
phy_config.phy_addr = CONFIG_ETH_PHY_ADDR;
phy_config.reset_gpio_num = CONFIG_ETH_PHY_RST_GPIO;
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
esp32_emac_config.smi_mdc_gpio_num = CONFIG_ETH_MDC_GPIO;
esp32_emac_config.smi_mdio_gpio_num = CONFIG_ETH_MDIO_GPIO;
esp_eth_mac_t * mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
esp_eth_phy_t * phy = esp_eth_phy_new_ip101(&phy_config);

esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy);
esp_eth_handle_t eth_handle = NULL;
Expand Down

0 comments on commit 2307292

Please sign in to comment.