Ethernet activity indicator flashes constantly when using softAP
Posted: Thu Nov 28, 2019 1:05 pm
The yellow ethernet activity indicator flashes constantly when using softAP, even when sending or receiving no data. This may be a hardware problem specific to the boards I'm using, which are Olimex Gateway and Olimex PoE, I don't have access to any other ESP32 boards with ethernet.
Both ethernet and softAP still work fine, so it's not exactly a huge problem. I don't actually know whether it indicates some kind of network activity or if the light is just flashing for no reason.
Below is a minimal PoC to make it happen (for IDF master), which just uses the same code as the softAP and ethernet examples:
The ethernet is configured in the sdkconfig.defaults file:
Both ethernet and softAP still work fine, so it's not exactly a huge problem. I don't actually know whether it indicates some kind of network activity or if the light is just flashing for no reason.
Below is a minimal PoC to make it happen (for IDF master), which just uses the same code as the softAP and ethernet examples:
Code: Select all
#include <esp_eth.h>
#include <esp_eth_mac.h>
#include <esp_eth_phy.h>
#include <esp_log.h>
#include <esp_netif.h>
#include <esp_netif_defaults.h>
#include <esp_netif_types.h>
#include <esp_wifi.h>
#include <nvs_flash.h>
void internal_flash_init() {
esp_err_t err = nvs_flash_init();
if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
err = nvs_flash_init();
}
ESP_ERROR_CHECK(err);
}
void ethernet_init(void) {
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
esp_netif_t *eth_netif = esp_netif_new(&cfg);
ESP_ERROR_CHECK(esp_eth_set_default_handlers(eth_netif));
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
phy_config.phy_addr = 0;
esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config);
esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy);
esp_eth_handle_t eth_handle = NULL;
ESP_ERROR_CHECK(esp_eth_driver_install(&config, ð_handle));
ESP_ERROR_CHECK(esp_netif_attach(eth_netif, eth_handle));
}
void wifi_softap_init(void) {
esp_netif_create_default_wifi_ap();
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP));
wifi_config_t wifi_config = {.ap = {.authmode = WIFI_AUTH_OPEN, .max_connection=5,}};
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_start());
}
void app_main() {
internal_flash_init();
esp_netif_init();
ESP_ERROR_CHECK(esp_event_loop_create_default());
ethernet_init();
wifi_softap_init();
}
Code: Select all
CONFIG_ETH_ENABLED=y
CONFIG_ETH_USE_ESP32_EMAC=y
CONFIG_ETH_PHY_INTERFACE_RMII=y
CONFIG_ETH_RMII_CLK_OUTPUT=y
CONFIG_ETH_RMII_CLK_OUT_GPIO=17
CONFIG_ETH_SMI_MDC_GPIO=23
CONFIG_ETH_SMI_MDIO_GPIO=18