完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
[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(); for(i=0;i |
|
相关推荐
5个回答
|
|
请指教!!??
|
|
|
|
|
|
|
|
手册上说睡眠是可以用任何一个中断唤醒的
|
|
|
|
没有中断配置,如果用按钮唤醒,你需要在接按钮的引脚配置中断
|
|
|
|
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1187 浏览 0 评论
AD7686芯片不传输数据给STM32,但是手按住就会有数据。
1122 浏览 2 评论
2223 浏览 0 评论
如何解决MPU-9250与STM32通讯时,出现HAL_ERROR = 0x01U
1311 浏览 1 评论
hal库中i2c卡死在HAL_I2C_Master_Transmit
1735 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-27 23:35 , Processed in 0.645370 second(s), Total 81, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号