eth1改为eth0(eth1_phy)
void GPIO_ETH_MediaInterfaceConfig(uint32_t GPIO_ETH_MediaInterface)
{
assert_param(IS_GPIO_ETH_MEDIA_INTERFACE(GPIO_ETH_MediaInterface));
/* Configure MII_RMII selection bit */
*(__IO uint32_t *) MAPR_MII_RMII_SEL_BB = GPIO_ETH_MediaInterface;
}
STM32很大的优势就是:内部RAM+内部外设寄存器都可以位寻址,这是很难得的。
MAPR_MII_RMII_SEL_BB是STM32F107复用重映射配置寄存器(AFIO_MAPR)的23位的位地址映射。
#define PERIPH_BB_BASE ((uint32_t)0x42000000) /*!< Peripheral base address in the alias region */
/* --- MAPR Register ---*/ 地址0x40010004
/* Alias word address of MII_RMII_SEL bit */
#define MAPR_OFFSET (AFIO_OFFSET + 0x04) //0x10004
#define MII_RMII_SEL_BitNumber ((uint8_t)0x17)
#define MAPR_MII_RMII_SEL_BB (PERIPH_BB_BASE + (MAPR_OFFSET * 32) + (MII_RMII_SEL_BitNumber * 4))
原文链接:https://www.eeworld.com.cn/mcu/article_2016101830562.html
评论