esp32外接lan8720模块报错

mulinluo
Posts: 6
Joined: Thu May 23, 2019 1:42 am

esp32外接lan8720模块报错

Postby mulinluo » Fri Jul 12, 2019 2:53 am

我使用esp32外接lan8720模块做ethernet。使用esp-idf-release-v3.2的Ethernet示例代码进行编译。clock信号使用的是lan8720模块上的50MHz晶振,nINT/REFCLKO引脚与gpio0连接,模式选择为Ethernet PHY Clock Mode (GPIO0 Input) 。编译后报错E (1301) emac: Reset EMAC Timeout。
具体log如下:

Code: Select all

I (0) cpu_start: App cpu up.
I (232) heap_init: Initializing. RAM available for dynamic allocation:
I (239) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (245) heap_init: At 3FFB4090 len 0002BF70 (175 KiB): DRAM
I (251) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (257) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (264) heap_init: At 40089B48 len 000164B8 (89 KiB): IRAM
I (270) cpu_start: Pro cpu start user code
I (288) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (291) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
E (1301) emac: Reset EMAC Timeout
请教大神这是什么原因导致的,我该怎么做?谢谢!

ESP_morris
Posts: 41
Joined: Wed Sep 05, 2018 6:23 am

Re: esp32外接lan8720模块报错

Postby ESP_morris » Mon Jul 15, 2019 7:35 am

1. 示波器查看GPIO0是否有50MHz时钟输入
2. 检查PHY的原理图,确保PHY地址在软件中被正确设置

mulinluo
Posts: 6
Joined: Thu May 23, 2019 1:42 am

Re: esp32外接lan8720模块报错

Postby mulinluo » Tue Aug 27, 2019 8:11 am

您好,
我用示波器测量有50MHz的clock信号,VDDCR有1.2V电压输出,lan8720是买的模块,其原理图如下:
Image
烧入esp-idf/examples/ethernet/ethernet示例代码,始终无法获取IP地址且无法ping通,我通过phy_lan8720_dump_registers()函数读取其寄存器值,log信息如下:

Code: Select all

I (189) esp_image: segment 5: paddr=0x0004b514 vaddr=0x40080400 size=0x08170 ( 33136) load
I (216) boot: Loaded app from partition at offset 0x10000
I (216) boot: Disabling RNG early entropy source...
I (217) cpu_start: Pro cpu up.
I (220) cpu_start: Application information:
I (225) cpu_start: Project name:     ethernet_demo
I (231) cpu_start: App version:      v3.3-beta3-181-g70ecb7e-dirty
I (238) cpu_start: Compile time:     Aug 27 2019 15:42:30
I (244) cpu_start: ELF file SHA256:  ae28c3e97850e957...
I (250) cpu_start: ESP-IDF:          v3.3-beta3-181-g70ecb7e-dirty
I (256) cpu_start: Starting app cpu, entry point is 0x40080eb8
0x40080eb8: call_start_cpu1 at /home/mu/esp/esp-idf/components/esp32/cpu_start.c:267

I (0) cpu_start: App cpu up.
I (267) heap_init: Initializing. RAM available for dynamic allocation:
I (274) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (280) heap_init: At 3FFB4088 len 0002BF78 (175 KiB): DRAM
I (286) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (292) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (299) heap_init: At 40088570 len 00017A90 (94 KiB): IRAM
I (305) cpu_start: Pro cpu start user code
I (323) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (326) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (326) lan8720: LAN8720 Registers:
I (336) lan8720: BCR    0x3100
I (336) lan8720: BSR    0x782d
I (346) lan8720: PHY1   0x0007
I (346) lan8720: PHY2   0xc0f1
I (346) lan8720: ANAR   0x0de1
I (356) lan8720: ANLPAR 0xcde1
I (356) lan8720: ANER   0x0009
I (356) lan8720: MCSR   0x0000
I (366) lan8720: SM     0xffff
I (366) lan8720: SECR   0x0009
I (376) lan8720: CSIR   0xffff
I (376) lan8720: ISR    0xffff
I (376) lan8720: IMR    0x0040
I (386) lan8720: PSCSR  0x0002
I (396) emac: emac reset done
I (396) lan8720: phy_lan8720_get_speed_mode(10)
I (396) eth_example: Ethernet Started
I (4396) lan8720: LAN8720 Registers:
I (4396) lan8720: BCR    0x3100
I (4396) lan8720: BSR    0x782d
I (4396) lan8720: PHY1   0x0007
I (4396) lan8720: PHY2   0xc0f1
I (4396) lan8720: ANAR   0x0de1
I (4406) lan8720: ANLPAR 0xcde1
I (4406) lan8720: ANER   0x000b
I (4416) lan8720: MCSR   0x0000
I (4416) lan8720: SM     0xffff
I (4416) lan8720: SECR   0x0009
I (4426) lan8720: CSIR   0xffff
I (4426) lan8720: ISR    0xffff
I (4426) lan8720: IMR    0x0040
I (4436) lan8720: PSCSR  0x0002
I (4436) lan8720: phy_lan8720_get_speed_mode(100)
I (4446) lan8720: LAN8720 Registers:
I (4446) lan8720: BCR    0x3100
I (4456) lan8720: BSR    0x782d
I (4456) lan8720: PHY1   0x0007
I (4456) lan8720: PHY2   0xc0f1
I (4466) lan8720: ANAR   0x0de1
I (4466) lan8720: ANLPAR 0xcde1
I (4466) lan8720: ANER   0x0009
I (4476) lan8720: MCSR   0x0000
I (4476) lan8720: SM     0xffff
I (4486) lan8720: SECR   0x0009
I (4486) lan8720: CSIR   0xffff
I (4486) lan8720: ISR    0xffff
I (4496) lan8720: IMR    0x0040
I (4496) lan8720: PSCSR  0x0002
I (4496) lan8720: phy_lan8720_get_speed_mode(100)
I (4506) lan8720: LAN8720 Registers:
I (4506) lan8720: BCR    0x3100
I (4516) lan8720: BSR    0x782d
I (4516) lan8720: PHY1   0x0007
I (4526) lan8720: PHY2   0xc0f1
I (4526) lan8720: ANAR   0x0de1
I (4526) lan8720: ANLPAR 0xcde1
I (4536) lan8720: ANER   0x0009
I (4536) lan8720: MCSR   0x0000
I (4546) lan8720: SM     0xffff
I (4546) lan8720: SECR   0x0009
I (4546) lan8720: CSIR   0xffff
I (4556) lan8720: ISR    0xffff
I (4556) lan8720: IMR    0x0040
I (4556) lan8720: PSCSR  0x0002
I (4566) lan8720: phy_lan8720_get_speed_mode(100)
I (4566) lan8720: LAN8720 Registers:
I (4576) lan8720: BCR    0x3100
I (4576) lan8720: BSR    0x782d
I (4586) lan8720: PHY1   0x0007
I (4586) lan8720: PHY2   0xc0f1
I (4586) lan8720: ANAR   0x0de1
I (4596) lan8720: ANLPAR 0xcde1
I (4596) lan8720: ANER   0x0009
I (4596) lan8720: MCSR   0x0000
I (4606) lan8720: SM     0xffff
I (4606) lan8720: SECR   0x0009
I (4616) lan8720: CSIR   0xffff
I (4616) lan8720: ISR    0xffff
I (4616) lan8720: IMR    0x0040
I (4626) lan8720: PSCSR  0x0002
I (4626) lan8720: phy_lan8720_get_speed_mode(100)
I (4636) lan8720: LAN8720 Registers:
I (4636) lan8720: BCR    0x3100
I (4636) lan8720: BSR    0x782d
I (4646) lan8720: PHY1   0x0007
I (4646) lan8720: PHY2   0xc0f1
I (4656) lan8720: ANAR   0x0de1
I (4656) lan8720: ANLPAR 0xcde1
I (4656) lan8720: ANER   0x0009
I (4666) lan8720: MCSR   0x0000
I (4666) lan8720: SM     0xffff
I (4676) lan8720: SECR   0x0009
I (4676) lan8720: CSIR   0xffff
I (4676) lan8720: ISR    0xffff
I (4686) lan8720: IMR    0x0040
I (4686) lan8720: PSCSR  0x0002
I (4686) lan8720: phy_lan8720_get_speed_mode(100)
I (4696) lan8720: LAN8720 Registers:
I (4696) lan8720: BCR    0x3100
I (4706) lan8720: BSR    0x782d
I (4706) lan8720: PHY1   0x0007
I (4716) lan8720: PHY2   0xc0f1
I (4716) lan8720: ANAR   0x0de1
I (4716) lan8720: ANLPAR 0xcde1
I (4726) lan8720: ANER   0x0009
I (4726) lan8720: MCSR   0x0000
I (4726) lan8720: SM     0xffff
I (4736) lan8720: SECR   0x0009
I (4736) lan8720: CSIR   0xffff
I (4746) lan8720: ISR    0xffff
I (4746) lan8720: IMR    0x0040
I (4746) lan8720: PSCSR  0x0002
I (4756) lan8720: phy_lan8720_get_speed_mode(100)
I (4756) eth_example: Ethernet Link Up
请教我该怎么调试解决?谢谢!!!

@In逍遥子
Posts: 76
Joined: Thu Nov 15, 2018 2:06 am

Re: esp32外接lan8720模块报错

Postby @In逍遥子 » Fri Aug 30, 2019 5:52 am

报错E (1301) emac: Reset EMAC Timeout。
这个你是如何解决的呢。

mulinluo
Posts: 6
Joined: Thu May 23, 2019 1:42 am

Re: esp32外接lan8720模块报错

Postby mulinluo » Mon Sep 02, 2019 2:20 am

设置正确的phy address,确保有clock信号,把接线多焊了两遍就解决了

Who is online

Users browsing this forum: No registered users and 9 guests