Open Chillimeat opened 4 months ago
The device’s logs indicate that the Ethernet link repeatedly goes up and down, as shown below:
E (1776391) w5500.mac: emac_w5500_transmit(578): free size (0) < send length (42)
I (1776391) eth_example: Ethernet Link Up
I (1776391) eth_example: Ethernet HW Addr 00:00:00:00:00:00
I (1776401) esp_netif_handlers: eth ip: 192.168.4.101, mask: 255.255.255.0, gw: 192.168.4.1
I (1776411) eth_example: Ethernet Got IP Address
I (1776411) eth_example: ~~~
I (1776411) eth_example: ETHIP:192.168.4.101
I (1776421) eth_example: ETHMASK:255.255.255.0
I (1776421) eth_example: ETHGW:192.168.4.1
I (1776431) eth_example: ~~~
I (1778391) eth_example: Ethernet Link Down
E (1808391) w5500.mac: emac_w5500_transmit(578): free size (0) < send length (42)
I (1808391) eth_example: Ethernet Link Up
I (1808391) eth_example: Ethernet HW Addr 00:00:00:00:00:00
I (1808401) esp_netif_handlers: eth ip: 192.168.4.101, mask: 255.255.255.0, gw: 192.168.4.1
I (1808411) eth_example: Ethernet Got IP Address
I (1808411) eth_example: ~~~
I (1808411) eth_example: ETHIP:192.168.4.101
I (1808421) eth_example: ETHMASK:255.255.255.0
I (1808421) eth_example: ETHGW:192.168.4.1
I (1808431) eth_example: ~~~
I (1810391) eth_example: Ethernet Link Down
Please try esp_base_mac_addr_set() and esp_netif_set_mac() instead of esp_eth_ioctl.
I experienced this on v5.0 and the symptom was "Ethernet HW Addr 00:00:00:00:00:00"
I also experienced "w5500.mac: emac_w5500_transmit(n): free size (0) < send length (k)" when my pins were incorrectly connected. You'll need to verify tx & rx are correctly connected and your clock speed.
Change your clock speed to ".clock_speed_hz = SPI_MASTER_FREQ_8M;"
Add ".flags = SPICOMMON_BUSFLAG_MASTER | SPICOMMON_BUSFLAG_SCLK | SPICOMMON_BUSFLAG_MISO | SPICOMMON_BUSFLAG_MOSI" to the spi_bus_config_t. Change transfer speed to ".max_transfer_sz = 0".
Remove the line "phy_config.phy_addr = 1;"
@DarmorGamz Thank you for the help provided, but I found that I have been stuck in a loop of obtaining versions.
I (321) eth_example: GPIO ISR service installed
I (331) gpio: GPIO[43]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (541) eth_example: W5500 reset done
I (541) gpio: GPIO[41]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
I (541) eth_example: Interrupt GPIO configured
I (541) eth_example: SPI bus initialized
E (651) w5500.mac: W5500 version mismatched, expected 0x04, got 0x00
E (651) w5500.mac: emac_w5500_init(826): verify chip ID failed
I (651) gpio: GPIO[4]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
E (661) esp_eth: esp_eth_driver_install(228): init mac failed
ESP_ERROR_CHECK failed: esp_err_t 0x10a (ESP_ERR_INVALID_VERSION) at 0x4200a7e5
file: "./main/main.c" line 110
func: example_eth_init
expression: esp_eth_driver_install(&config, &handle)
abort() was called at PC 0x4037b50b on core 0
Backtrace: 0x40375b16:0x3fc9c600 0x4037b515:0x3fc9c620 0x40382c39:0x3fc9c640 0x4037b50b:0x3fc9c6b0 0x4200a7e5:0x3fc9c6e0 0x4200a923:0x3fc9c810 0x42035b2f:0x3fc9c880 0x4037bfa9:0x3fc9c8b0
ELF file SHA256: 15b08351e
Rebooting...
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
Saved PC:0x40375a50
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce2810,len:0x178c
Please try esp_base_mac_addr_set() and esp_netif_set_mac() instead of esp_eth_ioctl.
@DarmorGamz Could you please elaborate what is the issue? This exact scenario is tested in CI for all supported Ethernet SPI modules.
@Chillimeat how is your W5500 connected to ESP32? Do you have custom board or is it connected just via jumper wires? What W5500 board do you use?
@kostaond Thank you very much for your attention. I am using DuPont wires for connection, and I have attached the relevant pictures.
Please try esp_base_mac_addr_set() and esp_netif_set_mac() instead of esp_eth_ioctl.
@DarmorGamz Could you please elaborate what is the issue? This exact scenario is tested in CI for all supported Ethernet SPI modules.
I also used a separate 5V power supply for power.
It seems you have some issues with SPI communication. Double check (or triple check :)) SPI configuration, that the connection is correct and use wires as short as possible (max 10cm) with matching length. You can also try to lower the SPI frequency to 8 MHz.
@Chillimeat any update? Have you been able to resolve the issue?
Answers checklist.
General issue report
I am currently using ESP32S3 with W5500 to establish an Ethernet connection, using version V5.3. The current issue I'm facing is that the network card repeatedly restarts and shuts down. Even when it starts up normally, it fails to communicate with other hosts
The log information is as follows:
I (301) main_task: Started on CPU0 I (311) main_task: Calling app_main() I (311) eth_example: GPIO ISR service installed I (311) eth_example: esp-netif initialized I (321) eth_example: Event loop created I (321) eth_example: SPI bus initialized E (431) w5500.mac: W5500 version mismatched, expected 0x04, got 0xa0 E (431) w5500.mac: emac_w5500_init(826): verify chip ID failed I (431) gpio: GPIO[4]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 E (441) esp_eth: esp_eth_driver_install(228): init mac failed ESP_ERROR_CHECK failed: esp_err_t 0x10a (ESP_ERR_INVALID_VERSION) at 0x4200a752 0x4200a752: app_main at /Users/11/Documents/code/tools/w5-s3/main/main.c:205 (discriminator 1)
file: "./main/main.c" line 205 func: app_main expression: esp_eth_driver_install(&config, &handle)
abort() was called at PC 0x4037b4ef on core 0 0x4037b4ef: _esp_error_check_failed at /Users/11/esp/v5.3/esp-idf/components/esp_system/esp_err.c:49
Backtrace: 0x40375b16:0x3fc9c670 0x4037b4f9:0x3fc9c690 0x40382c1d:0x3fc9c6b0 0x4037b4ef:0x3fc9c720 0x4200a752:0x3fc9c750 0x42035973:0x3fc9c880 0x4037bf8d:0x3fc9c8b0 0x40375b16: panic_abort at /Users/11/esp/v5.3/esp-idf/components/esp_system/panic.c:463 0x4037b4f9: esp_system_abort at /Users/11/esp/v5.3/esp-idf/components/esp_system/port/esp_system_chip.c:92 0x40382c1d: abort at /Users/11/esp/v5.3/esp-idf/components/newlib/abort.c:38 0x4037b4ef: _esp_error_check_failed at /Users/11/esp/v5.3/esp-idf/components/esp_system/esp_err.c:49 0x4200a752: app_main at /Users/11/Documents/code/tools/w5-s3/main/main.c:205 (discriminator 1) 0x42035973: main_task at /Users/11/esp/v5.3/esp-idf/components/freertos/app_startup.c:208 0x4037bf8d: vPortTaskWrapper at /Users/11/esp/v5.3/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134
ELF file SHA256: d27500b09
Rebooting... ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0xc (RTC_SW_CPU_RST),boot:0x28 (SPI_FAST_FLASH_BOOT) Saved PC:0x40375a50 0x40375a50: esp_restart_noos at /Users/11/esp/v5.3/esp-idf/components/esp_system/port/soc/esp32s3/system_internal.c:158
SPIWP:0xee mode:DIO, clock div:1 load:0x3fce2810,len:0x178c load:0x403c8700,len:0x4 load:0x403c8704,len:0xcb8 load:0x403cb700,len:0x2db0 entry 0x403c8914 I (26) boot: ESP-IDF v5.3-dirty 2nd stage bootloader I (26) boot: compile time Jul 27 2024 17:30:30 I (26) boot: Multicore bootloader I (30) boot: chip revision: v0.2 I (33) boot.esp32s3: Boot SPI Speed : 80MHz I (38) boot.esp32s3: SPI Mode : DIO I (43) boot.esp32s3: SPI Flash Size : 16MB I (48) boot: Enabling RNG early entropy source... I (53) boot: Partition Table: I (57) boot: ## Label Usage Type ST Offset Length I (64) boot: 0 nvs WiFi data 01 02 00009000 00006000 I (71) boot: 1 phy_init RF data 01 01 0000f000 00001000 I (79) boot: 2 factory factory app 00 00 00010000 00100000 I (86) boot: End of partition table I (91) esp_image: segment 0: paddr=00010020 vaddr=3c040020 size=13e90h ( 81552) map I (114) esp_image: segment 1: paddr=00023eb8 vaddr=3fc94e00 size=02b58h ( 11096) load I (116) esp_image: segment 2: paddr=00026a18 vaddr=40374000 size=09600h ( 38400) load I (128) esp_image: segment 3: paddr=00030020 vaddr=42000020 size=36724h (223012) map I (168) esp_image: segment 4: paddr=0006674c vaddr=4037d600 size=07714h ( 30484) load I (182) boot: Loaded app from partition at offset 0x10000 I (183) boot: Disabling RNG early entropy source... I (194) cpu_start: Multicore app I (203) cpu_start: Pro cpu start user code I (204) cpu_start: cpu freq: 160000000 Hz I (204) app_init: Application information: I (206) app_init: Project name: w5-s3 I (211) app_init: App version: 1 I (215) app_init: Compile time: Jul 27 2024 17:30:25 I (221) app_init: ELF file SHA256: d27500b09... I (227) app_init: ESP-IDF: v5.3-dirty I (232) efuse_init: Min chip rev: v0.0 I (237) efuse_init: Max chip rev: v0.99 I (242) efuse_init: Chip rev: v0.2 I (246) heap_init: Initializing. RAM available for dynamic allocation: I (254) heap_init: At 3FC98C18 len 00050AF8 (322 KiB): RAM I (260) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM I (266) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM I (272) heap_init: At 600FE100 len 00001EE8 (7 KiB): RTCRAM I (279) spi_flash: detected chip: generic I (283) spi_flash: flash io: dio I (287) sleep: Configure to isolate all GPIO pins in sleep state I (294) sleep: Enable automatic switching of GPIO sleep configuration I (301) main_task: Started on CPU0 I (311) main_task: Calling app_main() I (311) eth_example: GPIO ISR service installed I (311) eth_example: esp-netif initialized I (321) eth_example: Event loop created I (321) eth_example: SPI bus initialized E (431) w5500.mac: W5500 version mismatched, expected 0x04, got 0x00 E (431) w5500.mac: emac_w5500_init(826): verify chip ID failed I (431) gpio: GPIO[4]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 E (441) esp_eth: esp_eth_driver_install(228): init mac failed ESP_ERROR_CHECK failed: esp_err_t 0x10a (ESP_ERR_INVALID_VERSION) at 0x4200a752
file: "./main/main.c" line 205 func: app_main expression: esp_eth_driver_install(&config, &handle)
abort() was called at PC 0x4037b4ef on core 0 0x4037b4ef: _esp_error_check_failed at /Users/11/esp/v5.3/esp-idf/components/esp_system/esp_err.c:49
Backtrace: 0x40375b16:0x3fc9c670 0x4037b4f9:0x3fc9c690 0x40382c1d:0x3fc9c6b0 0x4037b4ef:0x3fc9c720 0x4200a752:0x3fc9c750 0x42035973:0x3fc9c880 0x4037bf8d:0x3fc9c8b0
ELF file SHA256: d27500b09
Rebooting... ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0xc (RTC_SW_CPU_RST),boot:0x28 (SPI_FAST_FLASH_BOOT) Saved PC:0x40375a50 0x40375a50: esp_restart_noos at /Users/11/esp/v5.3/esp-idf/components/esp_system/port/soc/esp32s3/system_internal.c:158
SPIWP:0xee mode:DIO, clock div:1 load:0x3fce2810,len:0x178c load:0x403c8700,len:0x4 load:0x403c8704,len:0xcb8 load:0x403cb700,len:0x2db0 entry 0x403c8914 I (26) boot: ESP-IDF v5.3-dirty 2nd stage bootloader I (26) boot: compile time Jul 27 2024 17:30:30 I (27) boot: Multicore bootloader I (30) boot: chip revision: v0.2 I (33) boot.esp32s3: Boot SPI Speed : 80MHz I (38) boot.esp32s3: SPI Mode : DIO I (43) boot.esp32s3: SPI Flash Size : 16MB I (48) boot: Enabling RNG early entropy source... I (53) boot: Partition Table: I (57) boot: ## Label Usage Type ST Offset Length I (64) boot: 0 nvs WiFi data 01 02 00009000 00006000 I (72) boot: 1 phy_init RF data 01 01 0000f000 00001000 I (79) boot: 2 factory factory app 00 00 00010000 00100000 I (86) boot: End of partition table I (91) esp_image: segment 0: paddr=00010020 vaddr=3c040020 size=13e90h ( 81552) map I (114) esp_image: segment 1: paddr=00023eb8 vaddr=3fc94e00 size=02b58h ( 11096) load I (116) esp_image: segment 2: paddr=00026a18 vaddr=40374000 size=09600h ( 38400) load I (128) esp_image: segment 3: paddr=00030020 vaddr=42000020 size=36724h (223012) map I (168) esp_image: segment 4: paddr=0006674c vaddr=4037d600 size=07714h ( 30484) load I (182) boot: Loaded app from partition at offset 0x10000 I (183) boot: Disabling RNG early entropy source... I (194) cpu_start: Multicore app I (203) cpu_start: Pro cpu start user code I (204) cpu_start: cpu freq: 160000000 Hz I (204) app_init: Application information: I (206) app_init: Project name: w5-s3 I (211) app_init: App version: 1 I (215) app_init: Compile time: Jul 27 2024 17:30:25 I (221) app_init: ELF file SHA256: d27500b09... I (227) app_init: ESP-IDF: v5.3-dirty I (232) efuse_init: Min chip rev: v0.0 I (237) efuse_init: Max chip rev: v0.99 I (242) efuse_init: Chip rev: v0.2 I (246) heap_init: Initializing. RAM available for dynamic allocation: I (254) heap_init: At 3FC98C18 len 00050AF8 (322 KiB): RAM I (260) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM I (266) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM I (272) heap_init: At 600FE100 len 00001EE8 (7 KiB): RTCRAM I (279) spi_flash: detected chip: generic I (283) spi_flash: flash io: dio I (287) sleep: Configure to isolate all GPIO pins in sleep state I (294) sleep: Enable automatic switching of GPIO sleep configuration I (301) main_task: Started on CPU0 I (311) main_task: Calling app_main() I (311) eth_example: GPIO ISR service installed I (311) eth_example: esp-netif initialized I (321) eth_example: Event loop created I (321) eth_example: SPI bus initialized I (381) eth_example: Ethernet driver installed I (381) esp_eth.netif.netif_glue: 00:00:00:00:00:00 I (381) esp_eth.netif.netif_glue: ethernet attached to netif I (381) eth_example: esp-netif instance created I (391) eth_example: Ethernet driver started I (391) eth_example: Ethernet Started I (401) main_task: Returned from app_main() E (12391) w5500.mac: emac_w5500_transmit(578): free size (0) < send length (42) I (12391) eth_example: Ethernet Link Up I (12391) eth_example: Ethernet HW Addr 00:00:00:00:00:00 I (12401) esp_netif_handlers: eth ip: 192.168.4.101, mask: 255.255.255.0, gw: 192.168.4.1 I (12401) eth_example: Ethernet Got IP Address I (12411) eth_example:
~~~ I (12411) eth_example: ETHIP:192.168.4.101 I (12421) eth_example: ETHMASK:255.255.255.0 I (12421) eth_example: ETHGW:192.168.4.1 I (12431) eth_example:~~~ I (14391) eth_example: Ethernet Link DownBelow is the code I am currently using: