乐鑫技术交流
直播中

半导体开发

10年用户 863经验值
擅长:可编程逻辑
私信 关注
[问答]

使用ethernetLan8720进行以太网运行报错是怎么回事?

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

更多回帖

发帖
×
20
完善资料,
赚取积分