mega8的输出IO接STM32输入IO(GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; //浮空输入 或 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //上拉输入)
STM32的IO竞然吸入20MA的电流~~~
同事在搞一项目,mega8的功耗一直下不去,唯有我亲自操刀,一测,发现STM23的输入IO吸入了20MA的电流
声明,STM32的IO用作中断,配置如下:
//外部中断管脚配置,中断输入 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; //浮空输入 GPIO_Init(GPIOB,&GPIO_InitStructure); GPIO_EXTILineConfig(GPIO_PortSourceGPIOB,GPIO_PinSource0);
中断配置如下:
void SetInterrupt(void) { EXTI_InitTypeDef EXTI_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; /* Connect Key Button EXTI Line to Key Button GPIO Pin */ GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource0); /* Enable the EXTI6 Interrupt */ NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQChannel; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure);
/*Enable the EXTI Line6 Interrupt*/ EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Line = EXTI_Line0; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure);
}
另:
mega8 工作于5V , STM32 工作于3.3V,
难道是灌电流,请问官方,有何解决???
|