tica, SimSun, sans-serif">[size=11.818181991577148px]我现在使用STM32L151进入STOP模式,测试程序运行后电流72uA,按钮按下后电流为331uA,LED灯也不闪烁。按钮松开后电流有变为0.5uA。
[size=11.818181991577148px]好像没有从STOP模式唤醒,理论上唤醒后应该在while(1)的循环里面灯闪烁。
[size=11.818181991577148px]希望使用过这个模式的人指点一下,谢谢!
[size=11.818181991577148px]void LEDInit(void)
[size=11.818181991577148px]{
[size=11.818181991577148px] GPIO_InitTypeDef GPIO_InitStructure;
[size=11.818181991577148px]
[size=11.818181991577148px] /* Enable the GPIO_LED Clock */
[size=11.818181991577148px] RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);
[size=11.818181991577148px] /* Configure the GPIO_LED pin */
[size=11.818181991577148px] GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
[size=11.818181991577148px] GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
[size=11.818181991577148px] GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
[size=11.818181991577148px] GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
[size=11.818181991577148px] GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;
[size=11.818181991577148px] GPIO_Init(GPIOB, &GPIO_InitStructure);
[size=11.818181991577148px]
[size=11.818181991577148px] GPIOB->BSRRL= GPIO_Pin_4;
[size=11.818181991577148px]}
[size=11.818181991577148px]int main(void)
[size=11.818181991577148px]{
[size=11.818181991577148px] uint16_t i=0,j=0;
[size=11.818181991577148px] GPIO_InitTypeDef GPIO_InitStructure;
[size=11.818181991577148px] RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC
[size=11.818181991577148px] | RCC_AHBPeriph_GPIOD | RCC_AHBPeriph_GPIOE | RCC_AHBPeriph_GPIOH, ENABLE);
[size=11.818181991577148px] /* config all IO to Analog Input to reduce parasite power consumption */
[size=11.818181991577148px] GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
[size=11.818181991577148px] GPIO_InitStructure.GPIO_Speed = GPIO_Speed_400KHz;
[size=11.818181991577148px] GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
[size=11.818181991577148px] GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
[size=11.818181991577148px] GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
[size=11.818181991577148px] GPIO_Init(GPIOC, &GPIO_InitStructure);
[size=11.818181991577148px] GPIO_Init(GPIOD, &GPIO_InitStructure);
[size=11.818181991577148px] GPIO_Init(GPIOE, &GPIO_InitStructure);
[size=11.818181991577148px] GPIO_Init(GPIOH, &GPIO_InitStructure);
[size=11.818181991577148px] GPIO_Init(GPIOA, &GPIO_InitStructure);
[size=11.818181991577148px] GPIO_Init(GPIOB, &GPIO_InitStructure);
[size=11.818181991577148px] /* Enable PB7 as external PVD input so as to set it as AIN_IN */
[size=11.818181991577148px] RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
[size=11.818181991577148px] /* Configure the PVD Level to 3 (2.5V) */
[size=11.818181991577148px] PWR_PVDLevelConfig(PWR_PVDLevel_7);
[size=11.818181991577148px] /* Enable the PVD Output */
[size=11.818181991577148px] PWR_PVDCmd(ENABLE);
[size=11.818181991577148px] RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA
[size=11.818181991577148px] | RCC_AHBPeriph_GPIOB
[size=11.818181991577148px] | RCC_AHBPeriph_GPIOC
[size=11.818181991577148px] | RCC_AHBPeriph_GPIOD
[size=11.818181991577148px] | RCC_AHBPeriph_GPIOE
[size=11.818181991577148px] | RCC_AHBPeriph_GPIOH, DISABLE);
[size=11.818181991577148px]
[size=11.818181991577148px] LEDInit();
[size=11.818181991577148px]
[size=11.818181991577148px] /* Enable WKUP pin 1 */
[size=11.818181991577148px] PWR_WakeUpPinCmd(PWR_WakeUpPin_1, ENABLE);
[size=11.818181991577148px]
[size=11.818181991577148px] /* Clear WakeUp flag */
[size=11.818181991577148px] PWR_ClearFlag(PWR_FLAG_WU);
[size=11.818181991577148px] PWR_UltraLowPowerCmd(ENABLE);
[size=11.818181991577148px] PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
[size=11.818181991577148px] while(1)
[size=11.818181991577148px] {
[size=11.818181991577148px] LEDInit();
<span style="color: rgb(68, 68, 68); font-family: Tahoma, Helvetica, SimSun, sans-serif; font-size: 11.818181991577148px; line-height: 16.363636016845703px; background-color: rgb(238, 238, 238);"> for(i=0;i
一周热门 更多>