stm32 将PB3,PB4设置为普通IO模式

 

   由于stm32复位后,会将PB3和PB4默认为JTAG的IO,占用这两个IO。根据网络里面介绍需要把JTAG功能disable掉 。

见下面代码

void fun_Display_PownOn(void)
{
    GPIO_InitTypeDef  GPIO_InitStructure;     
	
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_AFIO, ENABLE);	 //ENABLEPBCLK
	GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable , ENABLE); //Disable jtag
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;				 //LED0-->PA.8 端口配置
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 		 //推挽输出
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;		 //IO口速度为50MHz
    GPIO_Init(GPIOB, &GPIO_InitStructure);	 //
    GPIO_SetBits(GPIOB,GPIO_Pin_0_7);	                      //  		
    GPIO_ResetBits(GPIOB,GPIO_Pin_8_15); 					  //点亮LED灯
}

实际测试:在SWD debug模式下PB4能做普通IO ,但是PB3依旧不行。求指教

你可能感兴趣的:(stm32)