CoreS3 and W5500 fail
-
I need to use the W5500 with m5unified library and SPI.
Here my initialization code
static esp_netif_t *eth_start(void) { // Initialize TCP/IP network interface (should be called only once in application) ESP_ERROR_CHECK(esp_netif_init()); // Create default event loop that running in background ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_inherent_config_t esp_netif_config = ESP_NETIF_INHERENT_DEFAULT_ETH(); // Warning: the interface desc is used in tests to capture actual connection details (IP, gw, mask) esp_netif_config.if_desc = "eth0"; esp_netif_config.if_key = "ETH_SPI_0"; esp_netif_config.route_prio = 64; esp_netif_config_t netif_config = { .base = &esp_netif_config, .stack = ESP_NETIF_NETSTACK_DEFAULT_ETH }; esp_netif_t *netif = esp_netif_new(&netif_config); assert(netif); eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); mac_config.rx_task_stack_size = 3072; eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); phy_config.phy_addr = 1; phy_config.reset_gpio_num = GPIO_NUM_7; gpio_install_isr_service(0); spi_device_interface_config_t spi_devcfg = { .command_bits = 16, //Aggiunto .address_bits = 8, //Aggiumto .mode = 0, .clock_speed_hz = 20 * 1000 * 1000, //Configurare .spics_io_num = GPIO_NUM_9, .queue_size = 20 }; eth_w5500_config_t w5500_config = ETH_W5500_DEFAULT_CONFIG(SPI1_HOST, &spi_devcfg); w5500_config.int_gpio_num = GPIO_NUM_14; s_mac = esp_eth_mac_new_w5500(&w5500_config, &mac_config); s_phy = esp_eth_phy_new_w5500(&phy_config); vTaskDelay(pdMS_TO_TICKS(10)); esp_eth_config_t config = ETH_DEFAULT_CONFIG(s_mac, s_phy); ESP_ERROR_CHECK(esp_eth_driver_install(&config, &s_eth_handle)); uint8_t eth_mac[6] = {0}; ESP_ERROR_CHECK(esp_read_mac(eth_mac, ESP_MAC_ETH)); ESP_ERROR_CHECK(esp_eth_ioctl(s_eth_handle, ETH_CMD_S_MAC_ADDR, eth_mac)); // attach Ethernet driver to TCP/IP stack ESP_ERROR_CHECK(esp_netif_attach(netif, esp_eth_new_netif_glue(s_eth_handle))); ESP_ERROR_CHECK(esp_event_handler_register(ETH_EVENT, ETHERNET_EVENT_CONNECTED, &on_eth_event, netif)); ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_ETH_GOT_IP, ð_on_got_ip, NULL)); esp_eth_start(s_eth_handle); esp_netif_init(); return netif; }
it fail with
E (1214) spi_master: spi_bus_add_device(389): invalid host
E (1214) w5500.mac: w5500_spi_init(87): adding device to SPI host #1 failed
E (1214) w5500.mac: esp_eth_mac_new_w5500(915): SPI initialization failed
E (1234) esp_eth: esp_eth_driver_install(189): can't set eth->mac or eth->phy to nullwhen execute
ESP_ERROR_CHECK(esp_eth_driver_install(&config, &s_eth_handle));
What's wrong?
SPI interface is just initialized by the Display code.And what about INTn (GPIO14) used by microphone?
I just disable microphone during init
auto cfg = M5.config(); cfg.output_power = false; cfg.internal_mic = false;
Gio
-
-
Hi @felmue,
thank you for your fast response.
I think a GPIO conflict.I use PoE Lan Module w5500 that use as Interrupt PIN the GPIO_14 and is also the I2S_DIN used by the integrated microphone.
Now it works without M5 initialization
M5.begin(cfg);
.I also try to set the polling mode without success.
Gio