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);
}
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.
用寄存器配置试试
意思就是说PD0和PD1重映射后可以当中普通的IO管脚使用?
还是不行,不过我加了一个上拉电阻后然后 设置GPIO_PinRemapConfig(GPIO_Remap_PD01,ENABLE);
PD1既然可以正常高低电平输出,没搞懂为什么这样,GPIO_PinRemapConfig(GPIO_Remap_PD01,ENABLE)这条语句的设置PD1/0口还是处于重映射的状态吗?。
没看英文说明吗?只能作为输出使用
不能作为输入使用