STM32F072的GPIO口的高低电平不受控制

GPIO口高低电平不受控制,下面是一段测试代码。无法把PF0、PF1、PC0、PC1、PC2拉低。MCU是STM32F072RBT6。基于STM32F0xx_StdPeriph_Lib_V1.5.0库。问题出在哪,请大家帮忙一下。

void LED_Init(void)
{             
        GPIO_InitTypeDef  GPIO_InitStructure;

        RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOA, ENABLE);//使能GPIOA时钟
        RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOC, ENABLE);//使能GPIOC时钟
        RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOF, ENABLE);//使能GPIOF时钟



        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;//LED0和LED1对应IO口
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//普通输出模式
        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽输出
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
        //GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
        GPIO_Init(GPIOF, &GPIO_InitStructure);//初始化GPIO
        GPIO_SetBits(GPIOF,GPIO_Pin_0 | GPIO_Pin_1);//GPIOF0,F1设置高,灯灭

        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
        GPIO_Init(GPIOA, &GPIO_InitStructure);
        GPIO_ResetBits(GPIOA,GPIO_Pin_15);

        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 |GPIO_Pin_1|GPIO_Pin_2;//LED0和LED1对应IO口
        GPIO_Init(GPIOC, &GPIO_InitStructure);//初始化GPIO        
        GPIO_SetBits(GPIOC,GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2);


}

你看看硬件是否连接错误,或者main函数里面写的代码有误

代码中写的是拉高, 自然不会拉低这几个脚

http://www.enmaking.com/article/ar_ZCcy9R4X http://www.enmaking.com/article/ar_ZCcy9R4X