芯片GD32与以太网芯片的坑

参考例程是基于gd32f450的,在移植过程中遇到一些容易忽略的地方,导致程序卡在gd32fxx_enet.c中enet_phy_config的位置。将gd32f450上的代码全部移植到gd32f470平台后,一直卡在卡在gd32fxx_enet.c中enet_phy_config,经过排查发现gd32的官方库文件也需要修改,分别为gd32f4xx_enet.h和gd32f4xx_enet.c。
需要修改的地方如下:
1,如下添加宏定义:
       #ifndef _phy_h_#define dp83848 0#define lan8700 1#define sr8201f 2#define phy_type sr8201f
#define phy_address ((uint16_t)0x3u) /*!< phy address determined by the hardware */
2,在头文件88行位置添加如下内容:
#if(phy_type == lan8700) #define phy_sr 31u /*!< tranceiver status register */#define phy_speed_status ((uint16_t)0x0004) /*!< configured information of speed: 10mbit/s */#define phy_duplex_status ((uint16_t)0x0010) /*!< configured information of duplex: full-duplex */#elif(phy_type == dp83848)#define phy_sr 16u /*!< tranceiver status register */#define phy_speed_status ((uint16_t)0x0002) /*!< configured information of speed: 10mbit/s */#define phy_duplex_status ((uint16_t)0x0004) /*!< configured information of duplex: full-duplex */#elif(phy_type == sr8201f)#define phy_sr phy_reg_bcr /*!< tranceiver status register */#define phy_speed_status ((uint16_t)0x2000) /*!< configured information of speed: 10mbit/s */#define phy_duplex_status ((uint16_t)0x0100) /*!< configured information of duplex: full-duplex */#endif /* phy_type */
3,修改函数errstatus enet_init,修改内容如下图所示
4,修改static void enet_default_init,修改内容如下图所示:
修改以上内容后,程序可以正确运行:

Molex推出Temp-Flex混合型带状电缆
照明工程如何构建设计的整体协调性
英伟达似乎并不在意和特斯拉保持“若即若离的关系”
全部停产!百年车企丑闻不断!
智能手机市场争夺战愈发的激烈,OPPO与vivo之争出现火星
芯片GD32与以太网芯片的坑
基于Xilinx Zynq的物距测量系统设计与实现
二极管种类和型号大全,厂家东沃,超齐全
赛灵思CEO兼总裁 Moshe Gavrielov退休,Victor Peng 继任 CEO
主流NVMe M.2固态硬盘SSD的标准是什么?如何选择?
海尔U+智能套装SmartCare 引领智慧生活生态圈
SIGFOX携手TI共同打造高成本效益、远程、低功耗物联网连接
AMDRadeonVII显卡新驱动比首发驱动平均游戏性能提升0.65%
视频监控、门禁对讲、防盗报警是民用安防市场的三大支柱
智慧灯杆网关路灯照明组网管控应用
泰凌微电子将参展CES 2023:带来物联网SoC最新技术和热门应用方案
什么是RS触发器,RS触发器的工作原理是什么?
精致面板与S120直接通讯网络结构图文详解
汽车整车性能检测系统的设计
三菱plc编程学习线路的总结