用的是LL的库写的。 定时唤醒工作。进入STOP模式后,电流1微安以内, 但是醒过一次后电流就达到了10微安,并后面的进入STOP模式也是10。
经过测试,程序启动后先不进入STOP模式,等待一次RTC中断后再进入STOP模式,电流直接达到10。
void RTC_IRQHandler(void)
{
if(LL_RTC_IsAc
tiveFlag_WUT(RTC) )
{
LL_RTC_ClearFlag_WUT(RTC);
}
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_20);
}
/* USER CODE BEGIN 1 */
void Start_RTC(void)
{
/* Disable RTC registers write protection */
LL_RTC_DisableWriteProtection(RTC);
/* Disable wake up timer to modify it */
LL_RTC_WAKEUP_Disable(RTC);
while (LL_RTC_IsActiveFlag_WUTW(RTC) != 1)
{
}
/* Setting the Wakeup time to RTC_WUT_TIME s
If LL_RTC_WAKEUPCLOCK_CKSPRE is selected, the frequency is 1Hz,
this allows to get a wakeup time equal to RTC_WUT_TIME s
if the counter is RTC_WUT_TIME */
LL_RTC_WAKEUP_SetAutoReload(RTC, 30);
LL_RTC_WAKEUP_SetClock(RTC, LL_RTC_WAKEUPCLOCK_CKSPRE);
/* Enable wake up counter and wake up interrupt */
/* Note: Periodic wakeup interrupt should be enabled to exit the device
from low-power modes.*/
LL_RTC_EnableIT_WUT(RTC);
LL_RTC_WAKEUP_Enable(RTC);
/* Enable RTC registers write protection */
LL_RTC_EnableWriteProtection(RTC);
/* ######## ENTER IN STANDBY MODE ######################################*/
/** Request to enter STANDBY mode
* Following procedure describe in
STM32L1xx Reference Manual
* See PWR part, section Low-power modes, Standby mode
*/
LL_EXTI_EnableIT_0_31(LL_EXTI_LINE_20);
LL_EXTI_EnableRisingTrig_0_31(LL_EXTI_LINE_20);
/* Reset Internal Wake up flag */
LL_RTC_ClearFlag_WUT(RTC);
}
有人碰到过这个问题么??
中断函数如上。清了下标志,啥都没干
前段时间,有坛友说STM32F103的GPIO高8位用LL库不受控,亲测的确是这样。
珍爱生命,远离LL
建议你用HAL或标准库再试一下
一周热门 更多>