Ethernet example, IDF 4.4 and lan87xx does not work
Posted: Tue May 31, 2022 6:36 am
I have a custom board with a LAN8710AI-EZK-TR PHY where I have had a software running using ESP-IDF 4.1 with no issues. I'm using visualgdb.
Now I'm trying to upgrade to 4.4 and I have problems with getting ethernet to work. I have done what little refactoring is necessary and it still does not work.
So I'm going back to basics with the ethernet basic example and it does not work either. I have configured it for lan87xx and for ESP32 internal EMAC. I have no PHY reset so I have set that to -1 and my PHY address is 7, otherwise it's the default pinning and settings.
I get this output and it's more or less the same as in my own code:
I (12) boot: ESP-IDF v4.4.1-dirty 2nd stage bootloader (dirty due to me being forced to modify requrements.txt, I fulfil them, but i did not get it to work)
I (13) boot: compile time 15:20:40
I (13) boot: chip revision: 1
I (15) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (22) boot.esp32: SPI Speed : 40MHz
I (26) boot.esp32: SPI Mode : DIO
I (31) boot.esp32: SPI Flash Size : 2MB
I (36) boot: Enabling RNG early entropy source...
I (41) boot: Partition Table:
I (45) boot: ## Label Usage Type ST Offset Length
I (52) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (59) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (67) boot: 2 factory factory app 00 00 00010000 00100000
I (74) boot: End of partition table
I (78) boot_comm: chip revision: 1, min. application chip revision: 0
I (85) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0f0e8h ( 61672) map
I (116) esp_image: segment 1: paddr=0001f110 vaddr=3ffb0000 size=00f08h ( 3848) load
I (118) esp_image: segment 2: paddr=00020020 vaddr=400d0020 size=30104h (196868) map
I (193) esp_image: segment 3: paddr=0005012c vaddr=3ffb0f08 size=014a4h ( 5284) load
I (196) esp_image: segment 4: paddr=000515d8 vaddr=40080000 size=0b9cch ( 47564) load
I (219) esp_image: segment 5: paddr=0005cfac vaddr=50000000 size=00010h ( 16) load
I (225) boot: Loaded app from partition at offset 0x10000
I (225) boot: Disabling RNG early entropy source...
I (239) cpu_start: Pro cpu up.
I (239) cpu_start: Starting app cpu, entry point is 0x400810c4
I (233) cpu_start: App cpu up.
I (253) cpu_start: Pro cpu start user code
I (253) cpu_start: cpu freq: 160000000
I (253) cpu_start: Application information:
I (258) cpu_start: Project name: ethernet_basic
I (263) cpu_start: App version: 1
I (268) cpu_start: Compile time: May 30 2022 15:20:03
I (274) cpu_start: ELF file SHA256: b77597766924dd17...
I (280) cpu_start: ESP-IDF: v4.4.1-dirty
I (286) heap_init: Initializing. RAM available for dynamic allocation:
I (293) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (299) heap_init: At 3FFB3BF0 len 0002C410 (177 KiB): DRAM
I (305) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (311) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (318) heap_init: At 4008B9CC len 00014634 (81 KiB): IRAM
I (325) spi_flash: detected chip: generic
I (329) spi_flash: flash io: dio
W (332) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (347) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (12) boot: ESP-IDF v4.4.1-dirty 2nd stage bootloader
I (13) boot: compile time 15:20:40
I (13) boot: chip revision: 1
I (15) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (22) boot.esp32: SPI Speed : 40MHz
I (26) boot.esp32: SPI Mode : DIO
I (31) boot.esp32: SPI Flash Size : 2MB
I (36) boot: Enabling RNG early entropy source...
I (41) boot: Partition Table:
I (45) boot: ## Label Usage Type ST Offset Length
I (52) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (59) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (67) boot: 2 factory factory app 00 00 00010000 00100000
I (74) boot: End of partition table
I (78) boot_comm: chip revision: 1, min. application chip revision: 0
I (85) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0f0e8h ( 61672) map
I (116) esp_image: segment 1: paddr=0001f110 vaddr=3ffb0000 size=00f08h ( 3848) load
I (118) esp_image: segment 2: paddr=00020020 vaddr=400d0020 size=3010ch (196876) map
I (193) esp_image: segment 3: paddr=00050134 vaddr=3ffb0f08 size=014a4h ( 5284) load
I (196) esp_image: segment 4: paddr=000515e0 vaddr=40080000 size=0b9cch ( 47564) load
I (219) esp_image: segment 5: paddr=0005cfb4 vaddr=50000000 size=00010h ( 16) load
I (225) boot: Loaded app from partition at offset 0x10000
I (225) boot: Disabling RNG early entropy source...
I (239) cpu_start: Pro cpu up.
I (239) cpu_start: Starting app cpu, entry point is 0x400810c4
I (233) cpu_start: App cpu up.
I (253) cpu_start: Pro cpu start user code
I (253) cpu_start: cpu freq: 160000000
I (253) cpu_start: Application information:
I (258) cpu_start: Project name: ethernet_basic
I (263) cpu_start: App version: 1
I (268) cpu_start: Compile time: May 30 2022 15:20:03
I (274) cpu_start: ELF file SHA256: 0b0590df8e2bb201...
I (280) cpu_start: ESP-IDF: v4.4.1-dirty
I (286) heap_init: Initializing. RAM available for dynamic allocation:
I (293) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (299) heap_init: At 3FFB3BF0 len 0002C410 (177 KiB): DRAM
I (305) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (311) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (318) heap_init: At 4008B9CC len 00014634 (81 KiB): IRAM
I (325) spi_flash: detected chip: generic
I (329) spi_flash: flash io: dio
W (332) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (347) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
E (456) esp.emac: emac_esp32_init(349): reset timeout
E (456) esp_eth: esp_eth_driver_install(214): init mac failed
ESP_ERROR_CHECK failed: esp_err_t 0x107 (ESP_ERR_TIMEOUT) at 0x40085548
file: "../../../main/ethernet_example_main.c" line 122
func: app_main
expression: esp_eth_driver_install(&config, ð_handle)
abort() was called at PC 0x4008554b on core 0
Setting breakpoint at 0x40081935 and returning...
Now I'm trying to upgrade to 4.4 and I have problems with getting ethernet to work. I have done what little refactoring is necessary and it still does not work.
So I'm going back to basics with the ethernet basic example and it does not work either. I have configured it for lan87xx and for ESP32 internal EMAC. I have no PHY reset so I have set that to -1 and my PHY address is 7, otherwise it's the default pinning and settings.
I get this output and it's more or less the same as in my own code:
I (12) boot: ESP-IDF v4.4.1-dirty 2nd stage bootloader (dirty due to me being forced to modify requrements.txt, I fulfil them, but i did not get it to work)
I (13) boot: compile time 15:20:40
I (13) boot: chip revision: 1
I (15) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (22) boot.esp32: SPI Speed : 40MHz
I (26) boot.esp32: SPI Mode : DIO
I (31) boot.esp32: SPI Flash Size : 2MB
I (36) boot: Enabling RNG early entropy source...
I (41) boot: Partition Table:
I (45) boot: ## Label Usage Type ST Offset Length
I (52) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (59) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (67) boot: 2 factory factory app 00 00 00010000 00100000
I (74) boot: End of partition table
I (78) boot_comm: chip revision: 1, min. application chip revision: 0
I (85) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0f0e8h ( 61672) map
I (116) esp_image: segment 1: paddr=0001f110 vaddr=3ffb0000 size=00f08h ( 3848) load
I (118) esp_image: segment 2: paddr=00020020 vaddr=400d0020 size=30104h (196868) map
I (193) esp_image: segment 3: paddr=0005012c vaddr=3ffb0f08 size=014a4h ( 5284) load
I (196) esp_image: segment 4: paddr=000515d8 vaddr=40080000 size=0b9cch ( 47564) load
I (219) esp_image: segment 5: paddr=0005cfac vaddr=50000000 size=00010h ( 16) load
I (225) boot: Loaded app from partition at offset 0x10000
I (225) boot: Disabling RNG early entropy source...
I (239) cpu_start: Pro cpu up.
I (239) cpu_start: Starting app cpu, entry point is 0x400810c4
I (233) cpu_start: App cpu up.
I (253) cpu_start: Pro cpu start user code
I (253) cpu_start: cpu freq: 160000000
I (253) cpu_start: Application information:
I (258) cpu_start: Project name: ethernet_basic
I (263) cpu_start: App version: 1
I (268) cpu_start: Compile time: May 30 2022 15:20:03
I (274) cpu_start: ELF file SHA256: b77597766924dd17...
I (280) cpu_start: ESP-IDF: v4.4.1-dirty
I (286) heap_init: Initializing. RAM available for dynamic allocation:
I (293) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (299) heap_init: At 3FFB3BF0 len 0002C410 (177 KiB): DRAM
I (305) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (311) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (318) heap_init: At 4008B9CC len 00014634 (81 KiB): IRAM
I (325) spi_flash: detected chip: generic
I (329) spi_flash: flash io: dio
W (332) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (347) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (12) boot: ESP-IDF v4.4.1-dirty 2nd stage bootloader
I (13) boot: compile time 15:20:40
I (13) boot: chip revision: 1
I (15) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (22) boot.esp32: SPI Speed : 40MHz
I (26) boot.esp32: SPI Mode : DIO
I (31) boot.esp32: SPI Flash Size : 2MB
I (36) boot: Enabling RNG early entropy source...
I (41) boot: Partition Table:
I (45) boot: ## Label Usage Type ST Offset Length
I (52) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (59) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (67) boot: 2 factory factory app 00 00 00010000 00100000
I (74) boot: End of partition table
I (78) boot_comm: chip revision: 1, min. application chip revision: 0
I (85) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0f0e8h ( 61672) map
I (116) esp_image: segment 1: paddr=0001f110 vaddr=3ffb0000 size=00f08h ( 3848) load
I (118) esp_image: segment 2: paddr=00020020 vaddr=400d0020 size=3010ch (196876) map
I (193) esp_image: segment 3: paddr=00050134 vaddr=3ffb0f08 size=014a4h ( 5284) load
I (196) esp_image: segment 4: paddr=000515e0 vaddr=40080000 size=0b9cch ( 47564) load
I (219) esp_image: segment 5: paddr=0005cfb4 vaddr=50000000 size=00010h ( 16) load
I (225) boot: Loaded app from partition at offset 0x10000
I (225) boot: Disabling RNG early entropy source...
I (239) cpu_start: Pro cpu up.
I (239) cpu_start: Starting app cpu, entry point is 0x400810c4
I (233) cpu_start: App cpu up.
I (253) cpu_start: Pro cpu start user code
I (253) cpu_start: cpu freq: 160000000
I (253) cpu_start: Application information:
I (258) cpu_start: Project name: ethernet_basic
I (263) cpu_start: App version: 1
I (268) cpu_start: Compile time: May 30 2022 15:20:03
I (274) cpu_start: ELF file SHA256: 0b0590df8e2bb201...
I (280) cpu_start: ESP-IDF: v4.4.1-dirty
I (286) heap_init: Initializing. RAM available for dynamic allocation:
I (293) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (299) heap_init: At 3FFB3BF0 len 0002C410 (177 KiB): DRAM
I (305) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (311) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (318) heap_init: At 4008B9CC len 00014634 (81 KiB): IRAM
I (325) spi_flash: detected chip: generic
I (329) spi_flash: flash io: dio
W (332) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (347) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
E (456) esp.emac: emac_esp32_init(349): reset timeout
E (456) esp_eth: esp_eth_driver_install(214): init mac failed
ESP_ERROR_CHECK failed: esp_err_t 0x107 (ESP_ERR_TIMEOUT) at 0x40085548
file: "../../../main/ethernet_example_main.c" line 122
func: app_main
expression: esp_eth_driver_install(&config, ð_handle)
abort() was called at PC 0x4008554b on core 0
Setting breakpoint at 0x40081935 and returning...