必須先感謝客服 TECH13 幫助我解決了上個問題~:關(guān)于CH579M+RT-Thread : RTC從Sleep模式喚醒數(shù)次后,喚醒失敗
回到問題:
調(diào)用LowPower_Sleep(RB_PWR_RAM2K | RB_PWR_RAM14K)無法進(jìn)入休眠
先說結(jié)論:若要進(jìn)入SLEEP模式,不可配置使用引腳的上升沿外部中斷?。。?/strong>
應(yīng)用場景:
使用RT-Thread 4.0.3 RTOS,已調(diào)用
PWR_PeriphWakeUpCfg(ENABLE,?RB_SLP_RTC_WAKE?|?RB_SLP_GPIO_WAKE);
開啟RTC與GPIO喚醒(之前只開了RTC喚醒,并且之前可以正常休眠),以上代碼注釋GPIO喚醒也能正常休眠,但無法響應(yīng)IO喚醒,不滿足項目需求
Debug表現(xiàn):在RTC中斷、GPIO中斷與LowPower_Sleep()函數(shù)均加入斷點,然后運(yùn)行,能停在LowPower_Sleep()函數(shù)斷點處,按單步運(yùn)行直接跳到下一行(正常應(yīng)該是SWD直接斷開),并且會重復(fù)調(diào)用LowPower_Sleep(),去掉該函數(shù)斷點全速運(yùn)行,依然不進(jìn)入休眠,也不進(jìn)RTC中斷與GPIO中斷
????case?PM_SLEEP_MODE_DEEP: ????????/*?Enter?STOP?2?mode??*/ LowPower_Sleep(RB_PWR_RAM2K?|?RB_PWR_RAM14K); ????????/*?Re-configure?the?system?clock?*/ // ????????DelayMs(2); // // ????????if(!(R8_HFCK_PWR_CTRL&RB_CLK_XT32M_PON))?{?????//?是否HSE上電 // ????PWR_UnitModCfg(?ENABLE,?UNIT_SYS_HSE?);???//?HSE上電 // ????DelayUs((1200)/5); // ????????} // ????????else?if(!(R16_CLK_SYS_CFG&RB_CLK_OSC32M_XT)){???//?是否選擇?HSI/5?做時鐘源 // ????DelayUs((1200-330)/5); // ????????} // ????????HSECFG_Current(?HSE_RCur_100?);?????//?降為額定電流(低功耗函數(shù)中提升了HSE偏置電流) // ????????DelayUs(5/5);???????????????????????//?等待穩(wěn)定?1-5us ????????SetSysClock(?CLK_SOURCE_HSI_32MHz?); ????????break;