STM32F103使用RTC闹钟唤醒STOP模式
1、使用STM32CubeMx新建工程,配置时钟以及RTC闹钟,开启EXIT17线;2、设置RTC闹钟;
3、调用HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON,PWR_STOPENTRY_WFI)进入STOP模式
4、调用__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);清除标志。
按照以上操作,结果根本进不去STOP模式,求各位大佬帮忙分析一波是什么原因
卧槽,,没人理我吗?自顶一波:'( 再顶 如何确定没进STOP模式呢?有没有可能刚进去就被唤醒了呢。
你把3、4步骤对调一下试试看。 楼主,您好。周末的时候,在线的网友较少。这个问题需要先确是否进入了STOP模式。再确定是否是RTC唤醒导致。 /* Disable Wakeup Counter */
HAL_RTCEx_DeactivateWakeUpTimer(&RTCHandle);
/* ## Setting the Wake up time ############################################*/
/*RTC Wakeup Interrupt Generation:
Wakeup Time Base = (RTC_WAKEUPCLOCK_RTCCLK_DIV /(LSE or LSI))
Wakeup Time = Wakeup Time Base * WakeUpCounter
= (RTC_WAKEUPCLOCK_RTCCLK_DIV /(LSE or LSI)) * WakeUpCounter
==> WakeUpCounter = Wakeup Time / Wakeup Time Base
To configure the wake up timer to 20s the WakeUpCounter is set to 0xB4D8 for LSI:
RTC_WAKEUPCLOCK_RTCCLK_DIV = RTCCLK_Div16 = 16
Wakeup Time Base = 16 /(~37.000KHz) = ~0,432 ms
Wakeup Time = ~20s = 0,432ms* WakeUpCounter
==> WakeUpCounter = ~20s/0,432ms = 46296 = 0xB4D8 */
HAL_RTCEx_SetWakeUpTimer_IT(&RTCHandle, 0xB4D8, RTC_WAKEUPCLOCK_RTCCLK_DIV16);
/* Configure the system Power */
SystemPower_Config();
/* Enter Stop Mode */
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
这个是L0的休眠方式你可以对比一下 挂着调试器的情况下是不能进 STOP 模式的。
页:
[1]