OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 4013|回复: 2

急,stm32f407配置dp83848MII模式

[复制链接]

15

主题

34

帖子

0

精华

新手入门

积分
15
金钱
15
注册时间
2015-8-15
在线时间
17 小时
发表于 2017-3-2 18:44:32 | 显示全部楼层 |阅读模式
5金钱
师兄们您们好, 最近在调一个板子 用到了f407+dp83848 MII 模式 调了一周了 还是没有进展 这是我的配置程序 看对吗
u8 DP83848_Init()
{
  u8 rval = 0;
        GPIO_InitTypeDef   GPIO_InitStructure;
        RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE);
        RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB,ENABLE);
        RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC,ENABLE);//ê1ÄüGPIOê±Öó
        RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG,ENABLE);//ê1ÄüSYSCLKê±Öó
        SYSCFG_ETH_MediaInterfaceConfig(SYSCFG_ETH_MediaInterface_MII);//MACoíPHYÖ®¼äê1óÃMII½ó¿ú
       
        //PA0        PA8
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8|GPIO_Pin_0;
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;   
        GPIO_Init(GPIOA, &GPIO_InitStructure);
//        RCC_MCO1Config(RCC_MCO1Source_HSE, RCC_MCO1Div_1);
       

        //ÅäÖ&#195A1 PA2 PA7
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_7;
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
        GPIO_Init(GPIOA,&GPIO_InitStructure);
       
        GPIO_PinAFConfig(GPIOA,GPIO_PinSource1,GPIO_AF_ETH);
        GPIO_PinAFConfig(GPIOA,GPIO_PinSource2,GPIO_AF_ETH);
        GPIO_PinAFConfig(GPIOA,GPIO_PinSource7,GPIO_AF_ETH);
        GPIO_ResetBits(GPIOA,GPIO_PinSource7);
       
        //Å&#228B8        PB11 PB12 PB13
        GPIO_InitStructure.GPIO_Pin =GPIO_Pin_8|GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13;
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
        GPIO_Init(GPIOB,&GPIO_InitStructure);
        GPIO_PinAFConfig(GPIOB,GPIO_PinSource8,GPIO_AF_ETH);
        GPIO_PinAFConfig(GPIOB,GPIO_PinSource11,GPIO_AF_ETH);
        GPIO_PinAFConfig(GPIOB,GPIO_PinSource12,GPIO_AF_ETH);
        GPIO_PinAFConfig(GPIOB,GPIO_PinSource13,GPIO_AF_ETH);
        //PC2        PC3
        GPIO_InitStructure.GPIO_Pin        =GPIO_Pin_2|GPIO_Pin_3;
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
        GPIO_Init(GPIOC,&GPIO_InitStructure);
        GPIO_PinAFConfig(GPIOC,GPIO_PinSource2,GPIO_AF_ETH);
        GPIO_PinAFConfig(GPIOC,GPIO_PinSource3,GPIO_AF_ETH);
        //ÅäÖ&#195C1 PC4 PC5 PB0 PB1 PB10
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_10;
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
        GPIO_Init(GPIOB,&GPIO_InitStructure);
        GPIO_PinAFConfig(GPIOB,GPIO_PinSource0,GPIO_AF_ETH);
        GPIO_PinAFConfig(GPIOB,GPIO_PinSource1,GPIO_AF_ETH);
        GPIO_PinAFConfig(GPIOB,GPIO_PinSource10,GPIO_AF_ETH);

        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_4|GPIO_Pin_5;
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
        GPIO_Init(GPIOC,&GPIO_InitStructure);
        GPIO_PinAFConfig(GPIOC,GPIO_PinSource1,GPIO_AF_ETH);
        GPIO_PinAFConfig(GPIOC,GPIO_PinSource4,GPIO_AF_ETH);
        GPIO_PinAFConfig(GPIOC,GPIO_PinSource5,GPIO_AF_ETH);
       
        ETHERNET_NVICCongfiguration();
        rval = ETH_MACDMA_Config();
        return !rval;//ETHμÄ1æÔòÎa£o0£¬ê§°ü£»1£¬3é1|£»ËùòÔÕaàïòaè¡·′ò»ÏÂ
}

学习没有捷径,唯有坚持不懈!
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165540
金钱
165540
注册时间
2010-12-1
在线时间
2117 小时
发表于 2017-3-6 19:07:41 | 显示全部楼层
回复

使用道具 举报

0

主题

2

帖子

0

精华

新手入门

积分
15
金钱
15
注册时间
2019-12-3
在线时间
5 小时
发表于 2019-12-13 09:11:50 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-22 05:41

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表