对ESP IDF开发工具内的DM9051驱动代码进行修改,使SPI以太网口芯片DM9051ANX芯片的自带MAC地址为ESP32平台运行的MAC地址。
请修改examples/ethernet/basic/components/ethernet_init/ethernet_init.c 文件
请参考以下代码:
| ================================ // The SPI Ethernet module might not have a burned factory MAC address, we can set it manually. if (spi_eth_module_config->mac_addr != NULL) { ESP_GOTO_ON_FALSE(esp_eth_ioctl(eth_handle,ETH_CMD_S_MAC_ADDR,spi_eth_module_config->mac_addr) == ESP_OK, NULL, err, TAG, "SPI Ethernet MAC address config failed"); } // The SPI Ethernet module might not have a burned factory MAC address, we can set it manually. } 這裡是ESP IDF V5.4 这样ESP32系统在上电复位后,就可以直接调用DM9051A芯片内置的MAC地址。 |
200
