pq412641269 发表于 2024-12-28 23:49

进入深度睡眠唤醒后程序会重新运行

MCU 型号: HC32L170JATA 问题:程序通过Lpm_GotoDeepSleep(FALSE)进入深度休眠,通过低功耗定时器 LpTim0唤醒,但是唤醒后程序会重新运行,大家有遇到过这个情况吗,可能是什么原因造成的。具体代码如下。

/******************************************************************************
** \brief深度休眠处理函数
**
** @param无
** \retval 无
**
******************************************************************************/
void app_deep_sleep_handle_func(void)
{
if(s_wakeup_status.enter_sleep_en != SLEEP_EN) {
    return;
}

/*休眠参数配置*/
s_wakeup_status.enter_sleep_en = SLEEP_DEFAULT;
App_LPTimerInit();
Lptim_Cmd(M0P_LPTIMER0, TRUE);    //LPT 运行

/*IO休眠状态配置*/
App_LowPowerModeGpioSet();
app_sleep_gpio_release();
app_sleep_uart_release();
app_sleep_adc_release();

//进入深度睡眠模式
Lpm_GotoDeepSleep(FALSE);
while (1)
{
    if(s_wakeup_status.wakeup_reason != WAKEUP_REASON_DEFAULT) {
      break;
    }
}
}

/**
******************************************************************************
** \briefLPTIMER中断服务函数
**
** \return 无
******************************************************************************/
void LpTim0_IRQHandler(void)
{
    if (TRUE == Lptim_GetItStatus(M0P_LPTIMER0))
    {
      // Gpio_WriteOutputIO(LORA_POWER_EN_PORT,LORA_POWER_EN_PIN,TRUE);
      s_wakeup_status.wakeup_reason = WAKEUP_TIMER;
      //s_wakeup_status.enter_sleep_en = SLEEP_EN;
      Lptim_ClrItStatus(M0P_LPTIMER0);//清除LPTimer的中断标志位
    }
}





地瓜patch 发表于 2025-1-21 21:48

不同模式唤醒后的动作不一样

申小林一号 发表于 2025-1-22 08:52

学习一下技术支持。
页: [1]
查看完整版本: 进入深度睡眠唤醒后程序会重新运行