完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
第一次发帖,求助原子哥,以及论坛的各位大神帮忙下。我使用STM32107VCT6的板子,调试LWIP,在使用RMII的映射功能时,程序能跑,但是去掉映射功能后,就跑不起来了,怎么解决?PB11 ETH_MII_TX_EN
PB12 ETH_MII_TXD0 PB13 ETH_MII_TXD1 PD9 ETH_MII_RXD0---------------------------->改成 PC4 PD10 ETH_MII_RXD1---------------------------->改成 PC5 PD8 ETH_MII_RX_DV/ETH_RMII_CRS_DV------>改成 PA7 PC1 ETH_MII_MDC PA2 ETH_MII_MDIO PA1 ETH_MII_RX_CLK/ETH_RMII_REF_CLK(模块的晶振已经去掉了) PA8 MCO 我修改前代码如下: [C] 纯文本查看 复制代码 void GPIO_Configuration(void){ GPIO_InitTypeDef GPIO_InitStructure; /* ETHERNET pins configuration */ /* AF Output Push Pull: - ETH_MII_MDIO / ETH_RMII_MDIO: PA2 - ETH_MII_MDC / ETH_RMII_MDC: PC1 - ETH_MII_TXD2: PC2 - ETH_MII_TX_EN / ETH_RMII_TX_EN: PB11 - ETH_MII_TXD0 / ETH_RMII_TXD0: PB12 - ETH_MII_TXD1 / ETH_RMII_TXD1: PB13 - ETH_MII_PPS_OUT / ETH_RMII_PPS_OUT: PB5 - ETH_MII_TXD3: PB8 */ /* Configure PA2 as alternate function push-pull */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOA, &GPIO_InitStructure); /* Configure PC1, PC2 and PC3 as alternate function push-pull */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOC, &GPIO_InitStructure); /* Configure PB5, PB8, PB11, PB12 and PB13 as alternate function push-pull */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_8 | GPIO_Pin_11 |GPIO_Pin_12 | GPIO_Pin_13; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); /**************************************************************/ /* For Remapped Ethernet pins */ /*************************************************************/ /* Input (Reset Value): - ETH_MII_CRS CRS: PA0 - ETH_MII_RX_CLK / ETH_RMII_REF_CLK: PA1 - ETH_MII_COL: PA3 - ETH_MII_RX_DV / ETH_RMII_CRS_DV: PD8 - ETH_MII_TX_CLK: PC3 - ETH_MII_RXD0 / ETH_RMII_RXD0: PD9 - ETH_MII_RXD1 / ETH_RMII_RXD1: PD10 - ETH_MII_RXD2: PD11 - ETH_MII_RXD3: PD12 - ETH_MII_RX_ER: PB10 */ /* ETHERNET pins remapp in STM3210C-EVAL board: RX_DV and RxD[3:0] */ GPIO_PinRemapConfig(GPIO_Remap_ETH, ENABLE); /* Configure PA0, PA1 and PA3 as input */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_3; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOA, &GPIO_InitStructure); /* Configure PB10 as input */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOB, &GPIO_InitStructure); /* Configure PC3 as input */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOC, &GPIO_InitStructure); /* Configure PD8, PD9, PD10, PD11 and PD12 as input */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOD, &GPIO_InitStructure); /**/ /* ADC Channel14 config --------------------------------------------------------*/ /* Relative to STM3210D-EVAL Board */ /* Configure PC.04 (ADC Channel14) as analog input -------------------------*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; GPIO_Init(GPIOC, &GPIO_InitStructure); /* MCO pin configuration------------------------------------------------- */ /* Configure MCO (PA8) as alternate function push-pull */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOA, &GPIO_InitStructure);} 我修改后如下: void GPIO_Configuration(void) { GPIO_InitTypeDef GPIO_InitStructure; /* ETHERNET pins configuration */ /* AF Output Push Pull: - ETH_MII_MDIO / ETH_RMII_MDIO: PA2 - ETH_MII_MDC / ETH_RMII_MDC: PC1 - ETH_MII_TXD2: PC2 - ETH_MII_TX_EN / ETH_RMII_TX_EN: PB11 - ETH_MII_TXD0 / ETH_RMII_TXD0: PB12 - ETH_MII_TXD1 / ETH_RMII_TXD1: PB13 - ETH_MII_PPS_OUT / ETH_RMII_PPS_OUT: PB5 - ETH_MII_TXD3: PB8 */ /* Configure PA2 as alternate function push-pull */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOA, &GPIO_InitStructure); /* Configure PC1, PC2 and PC3 as alternate function push-pull */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOC, &GPIO_InitStructure); /* Configure PB5, PB8, PB11, PB12 and PB13 as alternate function push-pull */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_8 | GPIO_Pin_11 |GPIO_Pin_12 | GPIO_Pin_13; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); /**************************************************************/ /* For Remapped Ethernet pins */ /*************************************************************/ /* Input (Reset Value): - ETH_MII_CRS CRS: PA0 - ETH_MII_RX_CLK / ETH_RMII_REF_CLK: PA1 - ETH_MII_COL: PA3 - ETH_MII_RX_DV / ETH_RMII_CRS_DV: PD8 - ETH_MII_TX_CLK: PC3 - ETH_MII_RXD0 / ETH_RMII_RXD0: PD9 - ETH_MII_RXD1 / ETH_RMII_RXD1: PD10 - ETH_MII_RXD2: PD11 - ETH_MII_RXD3: PD12 - ETH_MII_RX_ER: PB10 */ /* ETHERNET pins remapp in STM3210C-EVAL board: RX_DV and RxD[3:0] */ //GPIO_PinRemapConfig(GPIO_Remap_ETH, ENABLE); //默认PD8->PA7 /* Configure PA0, PA1 and PA3 as input */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_3| GPIO_Pin_7; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOA, &GPIO_InitStructure); /* Configure PB10 as input */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOB, &GPIO_InitStructure); //默认PD9 PD10 ->PC4 PC5 /* Configure PC3 as input */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3|GPIO_Pin_4 | GPIO_Pin_5; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOC, &GPIO_InitStructure); //关闭PD8 PD9 PD10 的映射功能 /* Configure PD8, PD9, PD10, PD11 and PD12 as input */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOD, &GPIO_InitStructure); /**/ /* ADC Channel14 config --------------------------------------------------------*/ /* Relative to STM3210D-EVAL Board */ /* Configure PC.04 (ADC Channel14) as analog input -------------------------*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; GPIO_Init(GPIOC, &GPIO_InitStructure); /* MCO pin configuration------------------------------------------------- */ /* Configure MCO (PA8) as alternate function push-pull */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOA, &GPIO_InitStructure); } |
|
相关推荐
16个回答
|
|
原子哥会么?我用的DP83848的模块,某宝买的,用的也是STM32F107的核心板,同样是某宝买的,因为官网的LWIP使用了映射,占用了一个串口,导致我串口不够用了,所以想去掉LWIP的映射功能,可是一去掉就不行了,以太网的灯还是照常亮,可是程序初始化就是不成功,网上找了好多,全是求助帖,没一个解决的~~郁闷死了!!
|
|
|
|
http://www.openedv.com/thread-79137-1-1.html
|
|
|
|
工程下载地址 ,这里不知道怎么回事,上传不了,链接:http://pan.baidu.com/s/1qY1UFCw 密码:slbc
|
|
|
|
|
|
原子哥会么?我用的DP83848的模块,某宝买的,用的也是STM32F107的核心板,同样是某宝买的,因为官网的LWIP使用了映射,占用了一个串口,导致我串口不够用了,所以想去掉LWIP的映射功能,可是一去掉就不行了,以太网的灯还是照常亮,可是程序初始化就是不成功,网上找了好多,全是求助帖,没一个解决的~~郁闷死了!!
|
|
|
|
开启AFIO时钟了吗?
|
|
|
|
没事了,已经解决了,将代码中的ADC相关的代码去掉,然后将部分不相关的IO初始化代码也去掉,就好了,我的代码因为是参考金龙开发板的。
|
|
|
|
你好,我这边也遇到了这样的情况。我自己做了个板子,用的是PC4、PC5,代码参考的也是金龙的,按照你说的方法试了也不行,求指教!
|
|
|
|
将金龙的代码里面与LWIP无关的代码都删除掉,就可以用了,什么ADC的,和一些无关的IO初始化,然后只要去掉金龙代码里面的端口映射,以及修改下初始化IO,就OK了。主要还是那个ADC代码影响了程序
|
|
|
|
你好,方便加个QQ***,谢了啊
|
|
|
|
这里有个根据金龙的程序改的STM32F107.C的代码,有2个,一个是带映射的,一个是不带映射的,具体哪个是映射的,哪个不是映射的,你看下代码吧,我也忘记了stm32f107.zip (6.57 KB )
|
|
|
|
按照你说的实现了。但是为什么用PC4、PC5的时候,一定要把PD8改为PA7?
|
|
|
|
我用的是2个板子,板子上这个接口有点不一样
|
|
|
|
我自己画的板子是PD8,死活不行,不知道为啥啊
|
|
|
|
去看下数据手册中对于端口映射的说明,可能是PD8也做了映射,不记得了~~
|
|
|
|
好的,多谢
|
|
|
|
只有小组成员才能发言,加入小组>>
如何使用STM32+nrf24l01架构把有线USB设备无线化?
2568 浏览 7 评论
请问能利用51单片机和nRF24L01模块实现实时语音无线传输吗?
2361 浏览 5 评论
3208 浏览 3 评论
2836 浏览 8 评论
为什么ucosii上移植lwip后系统进入了HardFault_Handler?
2787 浏览 4 评论
请教各位大咖:有没有接收频率32M左右的芯片推荐的?先感谢啦!
662浏览 1评论
900浏览 0评论
1022浏览 0评论
666浏览 0评论
496浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-21 08:49 , Processed in 1.185577 second(s), Total 76, Slave 70 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号