首页 > 技术文章 > RTT+stm32f107适配DM9161网卡

weishengzhong 2019-10-30 16:59 原文

时钟:开发板上stm32使用的是8M晶振;PHY芯片未外接25M晶振,使用stm32的mco口输出50M晶振驱动phy芯片;尝试输出25M晶振,phy芯片能起来,但是获取不到ip地址,换成50M即可正常工作……时钟配置如下:

 

 

具体适配步骤:

在board文件夹下修改kconfig:

menu "Onboard Peripheral Drivers"
    config PHY_USING_DM9161CEP
        bool
    
    config BSP_USING_ETH
        bool "Enable Ethernet"
        default n
        select RT_USING_LWIP
        select PHY_USING_DM9161CEP
endmenu

在board文件夹下新建ports文件夹,创建phy_reset.c文件

#include <board.h>

void phy_reset(void)
{
    /* The phy reset pin of this BSP circuit is connected to the chip reset pin, so no additional reset is required. */
}

然后再menuconfig里面使能 Enable Ethernet

编译即可完成适配……

应用层操作网卡接口:

netdev.c

详情参考:https://www.rt-thread.org/document/site/programming-manual/netdev/netdev/

推荐阅读