[应用相关] stm32PD0,PD1禁止重映射问题

[复制链接]
2415|7
 楼主| Rospiers 发表于 2018-3-28 19:06 | 显示全部楼层 |阅读模式
stm32C8 (48管脚)PD0,PD1已经禁止了重映射,为什么还是用不了,一直检测到为低电平,而其他的管脚输出正常。求各位大神指导一下,下面是程序:
void RCC_Configuration(void)
{
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO|RCC_APB2Periph_ADC1|RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOD|RCC_APB2Periph_GPIOC,ENABLE) ;        //打开GPIOA,GPIOB,GPIOD的时钟,ADC时钟。
           RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
           GPIO_PinRemapConfig(GPIO_Remap_PD01,DISABLE);
           AFIO->MAPR=( AFIO->MAPR&~((u32)0x1<<15));//禁用PD01重映射

    GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable,ENABLE);
        DBGMCU->CR&=~((u32)1<<5);
        AFIO->MAPR=( AFIO->MAPR&~((u32)0x7<<24))|(2<<24);

}
1825yj.png
Lewisnx 发表于 2018-3-28 19:19 | 显示全部楼层
The pins number 2 and 3 in the VFQFPN36 package, and 5 and 6 in the LQFP48 and LQFP64 packages are configured as
OSC_IN/OSC_OUT after reset, however the functionality of PD0 and PD1 can be remapped by software on these pins. For the LQFP100 package, PD0 and PD1 are available by default, so there is no need for remapping. For more details, refer to the Alternate function I/O and debug configuration section in the STM32F10xxx reference manual.
The use of PD0 and PD1 in output mode is limited as they can only be used at 50 MHz in output mode.
CCompton 发表于 2018-3-28 19:31 | 显示全部楼层

用寄存器配置试试
Richardd 发表于 2018-3-28 19:41 | 显示全部楼层
PD0和PD1重映射后可以当中普通的IO管脚使用?
Mattheww 发表于 2018-3-28 20:36 | 显示全部楼层
没看英文说明吗?只能作为输出使用
Erichk 发表于 2018-3-28 20:51 | 显示全部楼层

不能作为输入使用
Thorald 发表于 2018-3-28 21:02 | 显示全部楼层
可以作为输入使用,验证过了
Bjorn 发表于 2018-3-28 21:13 | 显示全部楼层
你最后那句把映射又打开了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

116

主题

377

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部