[应用相关]

stm32PD0,PD1禁止重映射问题

[复制链接]
312|10
手机看帖
扫描二维码
随时随地手机跟帖
huwr|  楼主 | 2019-10-13 13:56 | 显示全部楼层 |阅读模式
stm32C8 (48管脚)PD0,PD1已经禁止了重映射,为什么还是用不了,一直检测到为低电平,而其他的管脚输出正常

使用特权

评论回复
liuzaiy| | 2019-10-13 13:59 | 显示全部楼层

楼主程序可以公开吗?贴程序看下吧,这么说看不出什么原因

使用特权

评论回复
huwr|  楼主 | 2019-10-13 14:14 | 显示全部楼层
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);

}

使用特权

评论回复
huwr|  楼主 | 2019-10-13 14:19 | 显示全部楼层
692895da2c14104f89.png

使用特权

评论回复
supernan| | 2019-10-13 14: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.

使用特权

评论回复
ousj| | 2019-10-13 14:24 | 显示全部楼层
用寄存器配置试试

使用特权

评论回复
morrisk| | 2019-10-13 14:33 | 显示全部楼层
PD0和PD1重映射后可以当中普通的IO管脚使用?

使用特权

评论回复
zyf部长| | 2019-10-13 14:46 | 显示全部楼层

没看英文说明吗?只能作为输出使用

使用特权

评论回复
xxmmi| | 2019-10-13 14:58 | 显示全部楼层
不能作为输入使用

使用特权

评论回复
kangzj| | 2019-10-13 15:01 | 显示全部楼层
可以作为输入使用,验证过了

使用特权

评论回复
zwll| | 2019-10-13 15:04 | 显示全部楼层

你最后那句把映射又打开了

使用特权

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

本版积分规则

780

主题

8627

帖子

5

粉丝