Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
error
Ethernet_以太网
stm32F107+DM9161AEP的PHY芯片 运行出现错误
发布于 2020-08-11 11:19:05 浏览:2076
订阅该版
问题: rrt-4.0.2+lwIP1.4.1+stm32F107VCT6+DM9161AEP的PHY芯片出现错误eth hardware init failed错误 系统:rt-thread 4.0.2 LwIP版本:1.4.1 主控芯片:stm32F107VCT6 phy芯片:DM9161AEP IDE:rt-thread studio 基于芯片建立的工程,串口1为log打印串口 ①新建 RT-Thread 完整版项目 ②board.h中定义 BSP_USING_ETH 和 PHY 相关的宏(使用这个#define PHY_USING_DM9161CEP,#define BSP_USING_ETH) ③board.c中初始化 ETH 相关的引脚和时钟(下面有介绍) ④stm32xxxx_hal_config.h中打开 HAL 库函数对 ETH 的支持(#define HAL_ETH_MODULE_ENABLED) ⑤board.c 中实现自己的 PHY 复位函数(接stm32的NRST) ⑥配置 lwIP 协议栈 ---------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------- 关于用stm32CubeMX生成的eth和时钟硬件如下图,就做了引脚对应的位置而已,其他没做,也不知道需不需要做 ![stm32cubemX.jpg](/uploads/20200812/86bd3399a72029a71f1fa9d60ff65d4d.jpg) 复制stm32CubeMX生成的stm32f1xx_hal_msp.c的HAL_ETH_MspInit函数定义到board.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 */ } } ``` ---------------------------------------------------------------- ---------------------------------------------------------------- **以下是烧录固件串口打印出来的错误** ---------------------------------------------------------------- ---------------------------------------------------------------- ``` \ | / - RT - Thread Operating System / | \ 4.0.2 build Aug 11 2020 2006 - 2019 Copyright by rt-thread team lwIP-1.4.1 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 14 0F 01 01 06 00 58 51 ...D.C.<......XQ 00000030: F4 2D 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 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 93 0D 01 01 06 00 40 B1 ...D.C.<......@. 00000030: 8C CF 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. no memory for shell 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 93 0D 01 01 06 00 40 B1 ...D.C.<......@. 00000030: 8C CF 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 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 93 0D 01 01 06 00 40 B1 ...D.C.<......@. 00000030: 8C CF 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 [E/drv.emac] No PHY device was detected, please check hardware! [E/drv.emac] No PHY device was detected, please check hardware! [E/drv.emac] No PHY device was detected, please check hardware! [D/drv.emac] buffer not valid [E/drv.emac] No PHY device was detected, please check hardware! ``` 以下是stm32F107的图 ![stm32.png](/uploads/20200811/a6843043f93a0dd66cb1d061708c90ea.png) 以下是DM9161AEP的图 ![DM9161AEp.png](/uploads/20200811/dbe8c7741e9dd2da814104228db0c4b2.png) **麻烦大佬们指点下。感谢感谢!**
查看更多
1
个回答
默认排序
按发布时间排序
james_s
2021-06-16
这家伙很懒,什么也没写!
drv.emac对应的接口函数是不是没有实现, 可以用gdb单步一下看执行到哪儿了.
撰写答案
登录
注册新账号
关注者
0
被浏览
2.1k
关于作者
辣手熊猫
这家伙很懒,什么也没写!
提问
6
回答
1
被采纳
0
关注TA
发私信
相关问题
1
以太网先上电再连网线通信
2
ethernet 和 use memory layout冲突
3
stm32h743的LAN8720A驱动编译错误, 不知道怎么改
4
关于在stm32F107CVT6中使用以太网芯片DM9161AEP的内存不足异常
5
stm32f107+dm9161的phy芯片报错eth硬件初始化失败
6
stm32f107+DM9161出现硬件初始化问题
7
基于芯片建立工程,以太网卡无法使用
8
SPI总线挂接2个W5500以太网芯片
9
STM32H743 以太网驱动 问题
10
以太网不能ping通 返回receive frame faild
推荐文章
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
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部