打印
[应用相关]

stm32PD0,PD1禁止重映射问题

[复制链接]
2090|7
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
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 (135.42 KB )

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管脚使用?

使用特权

评论回复
5
Mattheww| | 2018-3-28 20:36 | 只看该作者
没看英文说明吗?只能作为输出使用

使用特权

评论回复
6
Erichk| | 2018-3-28 20:51 | 只看该作者

不能作为输入使用

使用特权

评论回复
7
Thorald| | 2018-3-28 21:02 | 只看该作者
可以作为输入使用,验证过了

使用特权

评论回复
8
Bjorn| | 2018-3-28 21:13 | 只看该作者
你最后那句把映射又打开了

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

116

主题

377

帖子

0

粉丝