Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
Network
以太网phy
Ethernet_以太网
stm32f107+dm9161的phy芯片报错eth硬件初始化失败
发布于 2020-08-12 15:36:18 浏览:2728
订阅该版
[tocm] ## 硬件软件配置: - 主控芯片:stm32f107VCT6 - phy芯片:DM9161AEP - 系统版本:4.0.2 - LwIP版本:2.0.2 ## 操作的步骤: - ①新建 RT-Thread 完整版项目 - ②board.h中定义 BSP_USING_ETH 和 PHY 相关的宏 - ③board.c中初始化 ETH 相关的引脚和时钟 - ④stm32xxxx_hal_config.h中打开 HAL 库函数对 ETH 的支持 - ⑤board.c 中实现自己的 PHY 复位函数(复位函数为空) - ⑥配置 lwIP 协议栈 ## 运行产生错误: ``` [E/drv.emac] eth hardware init failed ``` 麻烦大佬指定下,感谢感谢! 主要是操作的第③步骤,用stm32cubeMX配置eth的硬件关键生成的HAL_ETH_MspInit如下。 ```c void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) { GPIO_InitTypeDef GPIO_InitStruct = {0}; if(heth->Instance==ETH) { /* USER CODE BEGIN ETH_MspInit 0 */ /* USER CODE END ETH_MspInit 0 */ /* Peripheral clock enable */ __HAL_RCC_ETH_CLK_ENABLE(); __HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE(); /**ETH GPIO Configuration PC1 ------> ETH_MDC PA1 ------> ETH_REF_CLK PA2 ------> ETH_MDIO PB11 ------> ETH_TX_EN PB12 ------> ETH_TXD0 PB13 ------> ETH_TXD1 PD8 ------> ETH_CRS_DV PD9 ------> ETH_RXD0 PD10 ------> ETH_RXD1 */ GPIO_InitStruct.Pin = GPIO_PIN_1; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_1; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_2; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); __HAL_AFIO_REMAP_ETH_ENABLE(); /* USER CODE BEGIN ETH_MspInit 1 */ /* USER CODE END ETH_MspInit 1 */ } } ``` -------------------------------------------------------- 用stm32cubeMX配置成如下 ![7c65df3b9bf01be17c143686f3d9fb66.jpg](/uploads/20200812/7c65df3b9bf01be17c143686f3d9fb66.jpg) -------------------------------------------------------- stm32f107的接线图 -------------------------------------------------------- ![stm32.png](/uploads/20200812/f25bbc404af9c2e83f269ec3c5731455.png) -------------------------------------------------------- DM9161AEP的接线图 -------------------------------------------------------- ![DM9161AEp.png](/uploads/20200812/dbe8c7741e9dd2da814104228db0c4b2.png) 详细的运行log ``` \ | / - RT - Thread Operating System / | \ 4.0.2 build Aug 12 2020 2006 - 2019 Copyright by rt-thread team lwIP-2.0.2 initialized! [E/drv.emac] eth hardware init failed [D/drv.emac] emac hardware start 00000000: FF FF FF FF FF FF 00 80 E1 34 DA 32 08 00 45 00 .........4.2..E. 00000010: 01 50 00 00 00 00 FF 11 BA 9D 00 00 00 00 FF FF .P.............. 00000020: FF FF 00 44 00 43 01 3C A3 FE 01 01 06 00 00 00 ...D.C.<........ 00000030: BC 8F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000040: 00 00 00 00 00 00 00 80 E1 34 DA 32 00 00 00 00 .........4.2.... 00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000110: 00 00 00 00 00 00 63 82 53 63 35 01 01 39 02 05 ......c.Sc5..9.. 00000120: DC 37 04 01 03 1C 06 FF 00 00 00 00 00 00 00 00 .7.............. 00000130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .............. [D/drv.emac] transmit frame length :350 [D/drv.emac] emac device init success [I/sal.skt] Socket Abstraction Layer initialize success. [D/drv.emac] Found a phy, address:0x00 [D/drv.emac] RESET PHY! 00000000: FF FF FF FF FF FF 00 80 E1 34 DA 32 08 00 45 00 .........4.2..E. 00000010: 01 50 00 01 00 00 FF 11 BA 9C 00 00 00 00 FF FF .P.............. 00000020: FF FF 00 44 00 43 01 3C A3 FE 01 01 06 00 00 00 ...D.C.<........ 00000030: BC 8F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000040: 00 00 00 00 00 00 00 80 E1 34 DA 32 00 00 00 00 .........4.2.... 00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000110: 00 00 00 00 00 00 63 82 53 63 35 01 01 39 02 05 ......c.Sc5..9.. 00000120: DC 37 04 01 03 1C 06 FF 00 00 00 00 00 00 00 00 .7.............. 00000130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .............. [D/drv.emac] transmit frame length :350 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 00000000: FF FF FF FF FF FF 00 80 E1 34 DA 32 08 00 45 00 .........4.2..E. 00000010: 01 50 00 02 00 00 FF 11 BA 9B 00 00 00 00 FF FF .P.............. 00000020: FF FF 00 44 00 43 01 3C A3 FE 01 01 06 00 00 00 ...D.C.<........ 00000030: BC 8F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000040: 00 00 00 00 00 00 00 80 E1 34 DA 32 00 00 00 00 .........4.2.... 00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000110: 00 00 00 00 00 00 63 82 53 63 35 01 01 39 02 05 ......c.Sc5..9.. 00000120: DC 37 04 01 03 1C 06 FF 00 00 00 00 00 00 00 00 .7.............. 00000130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .............. [D/drv.emac] transmit frame length :350 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 00000000: FF FF FF FF FF FF 00 80 E1 34 DA 32 08 00 45 00 .........4.2..E. 00000010: 01 50 00 03 00 00 FF 11 BA 9A 00 00 00 00 FF FF .P.............. 00000020: FF FF 00 44 00 43 01 3C A3 FE 01 01 06 00 00 00 ...D.C.<........ 00000030: BC 8F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000040: 00 00 00 00 00 00 00 80 E1 34 DA 32 00 00 00 00 .........4.2.... 00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000110: 00 00 00 00 00 00 63 82 53 63 35 01 01 39 02 05 ......c.Sc5..9.. 00000120: DC 37 04 01 03 1C 06 FF 00 00 00 00 00 00 00 00 .7.............. 00000130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .............. [D/drv.emac] transmit frame length :350 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] buffer not valid [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 [D/drv.emac] phy basic status reg is 0x7849 ```
查看更多
4
个回答
默认排序
按发布时间排序
文武斌
2022-04-12
这家伙很懒,什么也没写!
muc rmii 接口 驱动phy芯片不工作。先看phy晶振是否起振了,然后再检查mcu ref clk是否有50M时钟输入了。 再看看mdio读写寄存器phy的ID是不是手册上的值。一步步来就能排查出
cxhxy12345
2021-05-05
这家伙很懒,什么也没写!
你这个很难判断,可以用断点方式进行调试,先找到fail的位置
07lhluo
2021-09-10
这家伙很懒,什么也没写!
这个问题我碰到过,log也是显示`[D/drv.emac] phy basic status reg is 0x7849`。这个需要改写`phy_linkchange()`。 我之前用的是`Marvell 88E6060`。`phy_linkchange`原检测的是BSR寄存器,我改成SSR寄存器,或者交换机的寄存器,就可以了,插拔能正常识别linkstatus以及全双工和speed检测都正常。
古凌ALEX
2024-04-01
这家伙很懒,什么也没写!
我也碰到了,求解😘 ``` [E/drv.emac] eth hardware init failed ```
撰写答案
登录
注册新账号
关注者
1
被浏览
2.7k
关于作者
辣手熊猫
这家伙很懒,什么也没写!
提问
6
回答
1
被采纳
0
关注TA
发私信
相关问题
1
lwip1.4.1连接经常会断开无法连接上,可以ping通
2
LPC1768:RTT+LWIP+webserver用IE刷网页出现硬件中断错误(已经解决)
3
求一些LWIP开发的经验,目前ping一直不稳定。
4
stm32f207+dp83848无法ping通
5
RTT下的LWIP传递机制
6
rtt内lwip的socket是否是线程安全?
7
Lwip+enc28j60无法ping通
8
坑爹的rtconfig.h lwip关掉了checksum
9
花了一个晚上,把RT2.0的LWIP、网卡驱动、文件系统整合起来了,发现一点小问题
10
lwip例程中udp发送时如何指定源端口发送到指定目的地端口
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
使用百度AI助手辅助编写一个rt-thread下的ONVIF设备发现功能的功能代码
2
RT-Thread 发布 EtherKit开源以太网硬件!
3
rt-thread使用cherryusb实现虚拟串口
4
《C++20 图形界面程序:速度与渲染效率的双重优化秘籍》
5
《原子操作:程序世界里的“最小魔法单位”解析》
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
USB
DMA
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
FAL
rt-smart
ESP8266
I2C_IIC
WIZnet_W5500
ota在线升级
UART
PWM
cubemx
freemodbus
flash
packages_软件包
BSP
潘多拉开发板_Pandora
定时器
ADC
GD32
flashDB
socket
中断
Debug
编译报错
msh
SFUD
keil_MDK
rt_mq_消息队列_msg_queue
at_device
ulog
C++_cpp
本月问答贡献
踩姑娘的小蘑菇
7
个答案
3
次被采纳
张世争
8
个答案
2
次被采纳
rv666
5
个答案
2
次被采纳
用户名由3_15位
11
个答案
1
次被采纳
KunYi
6
个答案
1
次被采纳
本月文章贡献
程序员阿伟
6
篇文章
2
次点赞
hhart
3
篇文章
4
次点赞
大龄码农
1
篇文章
2
次点赞
ThinkCode
1
篇文章
1
次点赞
Betrayer
1
篇文章
1
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部