I'm experiencing an issue with ESP32 emulation in QEMU where I get the error "E (104160) opencores.emac: no mem for receive buffer".
I have a setup as explained here (https://github.com/espressif/esp-toolch ... working.md). I am starting a docker container and set the network configurations. ESP emulations are assigned IP addresses without a problem from the DHCP server. I am training the a model on the devices and then devices are exchanging neural network parameters, and after a few rounds of training and communication, the EMAC buffer error occurs.
xTaskCreatePinnedToCore(tcp_server_task, "tcp_server", STACK_SIZE, (void*)AF_INET, TASK_PRIORITY, NULL, 0);
I am starting my tcpserver with the line (I had a problem with PSRAM which I fixed it pinning the task to a core). I tried to increase the CONFIG_EXAMPLE_ETHERNET_EMAC_TASK_STACK_SIZE value but regardless, I get the receive buffer error around same time which makes me think it doesn't make any difference. Below is my ethernet register function, I am also setting up a random Mac address at the start, if I keep the Mac value as default all of the devices have the same value and they are assigned to the same ip address.
Code: Select all
void register_ethernet(void)
{
uint8_t random_mac[6]; // Example MAC address
random_mac[0] = 0x02; // Set the first byte as '02' (locally administered address)
random_mac[1] = esp_random() & 0xFF; // Random byte 1
random_mac[2] = esp_random() & 0xFF; // Random byte 2
random_mac[3] = esp_random() & 0xFF; // Random byte 3
random_mac[4] = esp_random() & 0xFF; // Random byte 4
random_mac[5] = esp_random() & 0xFF; // Random byte 5
esp_err_t err = esp_base_mac_addr_set(random_mac);
nvs_flash_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
eth_netif = esp_netif_new(&cfg);
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
mac_config.rx_task_stack_size = CONFIG_EXAMPLE_ETHERNET_EMAC_TASK_STACK_SIZE;
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
esp_eth_mac_t *mac = esp_eth_mac_new_openeth(&mac_config);
esp_eth_phy_t *phy = esp_eth_phy_new_dp83848(&phy_config);
esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy);
ESP_ERROR_CHECK(esp_eth_driver_install(&config, ð_handle)); // THIS FAILS
ESP_ERROR_CHECK(esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handle)));
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, &event_handler, NULL));
ESP_ERROR_CHECK(esp_eth_start(eth_handle));
}