Page 1 of 1

ESP32 以太网启动失败问题

Posted: Thu Dec 24, 2020 8:09 am
by w277277w
硬件:ESP32-WROOM-32 + LAN8720
IDF版本:v4.1
系统:windown + ESP Command Prompt

IO19 ------ RMII TXD0
IO22 ------ RMII TXD1
IO21 ------ RMII TXEN
IO25 ------ RMII RXD0
IO26 ------ RMII RXD1
IO27 ------ RMII CRS_DV
IO23 ------ RMII MDC
IO18 ------ RMII MDIO
IO4 ------- RMII RST

跑了esp32的wifi例程,功能正常,模块应该是没有什么问题的
然后测试以太网功能 example/ethernet/basic 例程
从日志中发现ESP32内部的EMAC都软复位不了,导致LAN8720也运行不起来
所以想请问下大伙,这个是什么问题导致

这是idf.py menuconfig的 配置信息
(Top) → Example Configuration
Espressif IoT Development Framework Configuration
Ethernet Type (Internal EMAC) --->
Ethernet PHY Device (LAN8720) --->
(23) SMI MDC GPIO number
(18) SMI MDIO GPIO number
(4) PHY Reset GPIO number
(0) PHY Address

这是下载运行之后的信息
根据 E (616) emac_esp32: emac_esp32_init(303): reset timeout 信息,感觉ESP32内部EMAC还没有初始化完成
所以导致了LAN8720初始化失败

但这个例程是官方例程,应该不会有问题,是我哪里操作有问题吗

Code: Select all

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4
load:0x3fff0034,len:7016
load:0x40078000,len:13072
ho 0 tail 12 room 4
load:0x40080400,len:3896
0x40080400: _init at ??:?

entry 0x40080688
I (31) boot: ESP-IDF v4.1-dirty 2nd stage bootloader
I (31) boot: compile time 14:22:24
I (31) boot: chip revision: 1
I (34) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (41) boot.esp32: SPI Speed      : 40MHz
I (46) boot.esp32: SPI Mode       : DIO
I (50) boot.esp32: SPI Flash Size : 2MB
I (55) boot: Enabling RNG early entropy source...
I (60) boot: Partition Table:
I (64) boot: ## Label            Usage          Type ST Offset   Length
I (71) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (79) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (86) boot:  2 factory          factory app      00 00 00010000 00100000
I (94) boot: End of partition table
I (98) boot_comm: chip revision: 1, min. application chip revision: 0
I (105) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x0e3d0 ( 58320) map
I (136) esp_image: segment 1: paddr=0x0001e3f8 vaddr=0x3ffb0000 size=0x01c20 (  7200) load
I (139) esp_image: segment 2: paddr=0x00020020 vaddr=0x400d0020 size=0x2f050 (192592) map
0x400d0020: _stext at ??:?

I (216) esp_image: segment 3: paddr=0x0004f078 vaddr=0x3ffb1c20 size=0x005d8 (  1496) load
I (217) esp_image: segment 4: paddr=0x0004f658 vaddr=0x40080000 size=0x00404 (  1028) load
0x40080000: _WindowOverflow4 at E:/development/espressif/esp32/esp-idf/components/freertos/xtensa_vectors.S:1778

I (223) esp_image: segment 5: paddr=0x0004fa64 vaddr=0x40080404 size=0x0a124 ( 41252) load
I (255) boot: Loaded app from partition at offset 0x10000
I (255) boot: Disabling RNG early entropy source...
I (256) cpu_start: Pro cpu up.
I (260) cpu_start: Application information:
I (264) cpu_start: Project name:     ethernet_basic
I (270) cpu_start: App version:      v4.1-dirty
I (275) cpu_start: Compile time:     Dec 22 2020 14:22:10
I (281) cpu_start: ELF file SHA256:  599aadf1b319649e...
I (287) cpu_start: ESP-IDF:          v4.1-dirty
I (292) cpu_start: Starting app cpu, entry point is 0x40081240
0x40081240: call_start_cpu1 at E:/development/espressif/esp32/esp-idf/components/esp32/cpu_start.c:271

I (284) cpu_start: App cpu up.
I (303) heap_init: Initializing. RAM available for dynamic allocation:
I (310) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (316) heap_init: At 3FFB3A00 len 0002C600 (177 KiB): DRAM
I (322) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (329) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (335) heap_init: At 4008A528 len 00015AD8 (86 KiB): IRAM
I (341) cpu_start: Pro cpu start user code
I (359) spi_flash: detected chip: generic
I (360) spi_flash: flash io: dio
W (360) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (371) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
E (616) emac_esp32: emac_esp32_init(303): reset timeout
E (616) esp_eth: esp_eth_driver_install(198): init mac failed
ESP_ERROR_CHECK failed: esp_err_t 0xffffffff (ESP_FAIL) at 0x400848cc
0x400848cc: _esp_error_check_failed at E:/development/espressif/esp32/esp-idf/components/esp32/panic.c:739

file: "../main/ethernet_example_main.c" line 125
func: app_main
expression: esp_eth_driver_install(&config, &eth_handle)

ELF file SHA256: 599aadf1b319649e

Backtrace: 0x4008431d:0x3ffb5820 0x400848cf:0x3ffb5840 0x400d5402:0x3ffb5860 0x400d209e:0x3ffb58d0 0x40084c31:0x3ffb58f0
0x4008431d: invoke_abort at E:/development/espressif/esp32/esp-idf/components/esp32/panic.c:157

0x400848cf: _esp_error_check_failed at E:/development/espressif/esp32/esp-idf/components/esp32/panic.c:740

0x400d5402: app_main at e:\development\espressif\esp32\esp-idf\examples\ethernet\basic\build/../main/ethernet_example_main.c:125 (discriminator 1)

0x400d209e: main_task at E:/development/espressif/esp32/esp-idf/components/esp32/cpu_start.c:565

0x40084c31: vPortTaskWrapper at E:/development/espressif/esp32/esp-idf/components/freertos/port.c:143


Rebooting...
ets Jun  8 2016 00:22:57

Re: ESP32 以太网启动失败问题

Posted: Fri Dec 25, 2020 6:10 am
by ESP_morris
时钟模式没有选择好,需要配合你的以太网电路进行配置,配置路径:component config->Ethernet
以太网初始化的注意事项请参考https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_eth.html#configure-mac-and-phy