Environment
- Development Kit: |ESP32-DevKitC|
- Kit version (for WroverKit/PicoKit/DevKitC): [v4]
- Module or chip used: [ESP32-WROOM-32|]
- IDF version (run
git describe --tags to find it):
v4.3-dev-1901-g178b122c1-
- Build System: [idf.py]
- Compiler version (run
xtensa-esp32-elf-gcc --version to find it):
xtensa-esp32-elf-gcc-8.4.0
- Operating System: [|Linux|]
- Using an IDE?: [No|)]
- Power Supply: [USB|]
Problem Description
I am working on example Ethernet basic with external chip W5500 by SPI;
I have started example code, but I can't get IP address. The program is waiting.
//Detailed problem description goes here.
I have written on forum
https://esp32.com/viewtopic.php?f=13&t=19018
sometime it runs but after large delay.

Expected Behavior
The program should connect to the subnet and receive an IP address
Actual Behavior
Program hold and dosnt any event for GOT_IP

Steps to reproduce
// If possible, attach a picture of your setup/wiring here.
Code to reproduce this issue
void app_main()
{
// Initialize TCP/IP network interface (should be called only once in application)
printf("Initialize TCP/IP network interface\n" );
ESP_ERROR_CHECK(esp_netif_init());
// Create default event loop that running in background
ESP_ERROR_CHECK(esp_event_loop_create_default());
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();
mac_config.smi_mdc_gpio_num = -1;
mac_config.smi_mdio_gpio_num = -1;
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
phy_config.autonego_timeout_ms = 0;
phy_config.reset_gpio_num = -1;
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);
#if CONFIG_EXAMPLE_ETH_PHY_IP101
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
esp_eth_phy_t *phy = esp_eth_phy_new_rtl8201(&phy_config);
#elif CONFIG_EXAMPLE_ETH_PHY_LAN8720
esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config);
#elif CONFIG_EXAMPLE_ETH_PHY_DP83848
esp_eth_phy_t *phy = esp_eth_phy_new_dp83848(&phy_config);
#elif CONFIG_EXAMPLE_ETH_PHY_KSZ8041
esp_eth_phy_t *phy = esp_eth_phy_new_ksz8041(&phy_config);
#endif
#elif CONFIG_ETH_USE_SPI_ETHERNET
gpio_install_isr_service(0);
spi_device_handle_t spi_handle = NULL;
spi_bus_config_t buscfg = {
.miso_io_num = PIN_NUM_MISO,
.mosi_io_num = PIN_NUM_MOSI,
.sclk_io_num = PIN_NUM_CLK,
.quadwp_io_num = -1,
.quadhd_io_num = -1,
};
ESP_ERROR_CHECK(spi_bus_initialize(CONFIG_EXAMPLE_ETH_SPI_HOST, &buscfg, 1));
#if CONFIG_EXAMPLE_USE_DM9051
#elif CONFIG_EXAMPLE_USE_W5500
spi_device_interface_config_t devcfg = {
.command_bits = 16, // Actually it's the address phase in W5500 SPI frame
.address_bits = 8, // Actually it's the control phase in W5500 SPI frame
.mode = 0,
.clock_speed_hz = 12 * 1000 * 1000,
.spics_io_num = ID_DEV1_CS,
.queue_size = 20
};
ESP_ERROR_CHECK(spi_bus_add_device(CONFIG_EXAMPLE_ETH_SPI_HOST, &devcfg, &spi_handle));
/* w5500 ethernet driver is based on spi driver */
eth_w5500_config_t w5500_config = ETH_W5500_DEFAULT_CONFIG(spi_handle);
w5500_config.int_gpio_num = ETH_PIN_INT;//todo -> devkit ma INT4 a LEO na innym!
mac_config.sw_reset_timeout_ms = 10;
esp_eth_mac_t *mac = esp_eth_mac_new_w5500(&w5500_config, &mac_config);
esp_eth_phy_t *phy = esp_eth_phy_new_w5500(&phy_config);
#endif
#endif
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));
#if CONFIG_ETH_USE_SPI_ETHERNET
int port = 10;
/* The SPI Ethernet module might doesn't have a burned factory MAC address, we cat to set it manually.
02:00:00 is a Locally Administered OUI range so should not be used except when testing on a LAN under your control.
*/
ESP_ERROR_CHECK(esp_eth_ioctl(eth_handle, ETH_CMD_S_MAC_ADDR, (uint8_t[]) { //it is setter for MAC
0x00, 0x08, 0xdc, 0xab, 0xcd, 0xef
}));
#endif
/* 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));
}
// If your code is longer than 30 lines, GIST is preferred.
Debug Logs


Other items if possible
Environment
git describe --tagsto find it):v4.3-dev-1901-g178b122c1-
xtensa-esp32-elf-gcc --versionto find it):xtensa-esp32-elf-gcc-8.4.0
Problem Description
I am working on example Ethernet basic with external chip W5500 by SPI;
I have started example code, but I can't get IP address. The program is waiting.
//Detailed problem description goes here.
I have written on forum
https://esp32.com/viewtopic.php?f=13&t=19018
sometime it runs but after large delay.

Expected Behavior
The program should connect to the subnet and receive an IP address
Actual Behavior
Program hold and dosnt any event for GOT_IP

Steps to reproduce
// If possible, attach a picture of your setup/wiring here.
Code to reproduce this issue
// If your code is longer than 30 lines, GIST is preferred.
Debug Logs
Other items if possible
buildfolder (note this may contain all the code details and symbols of your project.)