void EtherneTaskStart(void)
{
// sem_tcp_ok = xSemaphoreCreateBinary();
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
esp_netif_t *eth_netif = esp_netif_new(&cfg);
// Set default handlers to process TCP/IP stuffs
ESP_ERROR_CHECK(esp_eth_set_default_handlers(eth_netif));
// Register user defined event handers
ESP_ERROR_CHECK(esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, ð_event_handler, NULL));
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_ETH_GOT_IP, &got_ip_event_handler, NULL));
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_EXAMPLE_ETH_PHY_ADDR;
phy_config.reset_gpio_num = CONFIG_EXAMPLE_ETH_PHY_RST_GPIO;
#if CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET
mac_config.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO;
mac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
#endif
esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config);
esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy);
ESP_ERROR_CHECK(esp_eth_driver_install(&config, ð_handle));
/* attach Ethernet driver to TCP/IP stack */
ESP_ERROR_CHECK(esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handle)));
/* start Ethernet driver state machine */
ESP_ERROR_CHECK(esp_eth_start(eth_handle));
}
错误现象:
[0;31mE (224369341) emac_esp32: no mem for receive buffer[0m
使用ethernetLan8720进行以太网,运行两天,报内存问题
-
- Posts: 2
- Joined: Sat Oct 09, 2021 1:05 am
Re: 使用ethernetLan8720进行以太网,运行两天,报内存问题
希望遇到过这类问题的大神,或者esp32技术支持能给出解决方法!!!!!
-
- Posts: 786
- Joined: Wed Nov 14, 2018 8:45 am
Re: 使用ethernetLan8720进行以太网,运行两天,报内存问题
定期打印剩余 heap,看看是否有内存泄露。
另外可参看:https://docs.espressif.com/projects/esp ... debug.html 来 debug。
另外可参看:https://docs.espressif.com/projects/esp ... debug.html 来 debug。
Who is online
Users browsing this forum: No registered users and 87 guests