21ic问答首页 - G455 SLEEP 下RTC 唤醒的问题
G455 SLEEP 下RTC 唤醒的问题
ybbo2121262022-09-28
请教,G455 SLEEP 下RTC这样配置是否存在唤醒问题,我是在EXIT20配置的, RTC_SetWakeUpCounter(9)只配置了一次,是否需要在中断配置,;谢谢int main(void)
{
/* Initialize USART,TX: PC10 RX: PC11*/
log_init();
log_info("\r\n RTC Init \r\n");
/* Enable PWR Clock */
RCC_EnableAPB1PeriphClk(RCC_APB1_PERIPH_PWR, ENABLE);
/* RTC date time alarm default value*/
RTC_DateAndTimeDefaultVale();
/* RTC clock source select */
RTC_CLKSourceConfig(RTC_CLK_SRC_TYPE_LSI, true, true);
RTC_PrescalerConfig();
log_info("\r\n RTC configured....\r\n");
/* Adjust time by values entered by the user on the hyperterminal */
RTC_DateRegulate();
RTC_TimeRegulate();
/* wake up clock select */
RTC_ConfigWakeUpClock(RTC_WKUPCLK_CK_SPRE_16BITS);
/* wake up timer value */
RTC_SetWakeUpCounter(9);
#if (RTC_ALARM_TEST_TYPE == RTC_ALARM_TEST_TYPE_IRQ) // 1.Alarm interrupt test
EXTI20_RTCWKUP_Configuration(ENABLE);
/* Enable the RTC Wakeup Interrupt */
RTC_ConfigInt(RTC_INT_WUT, ENABLE);
RTC_EnableWakeUp(ENABLE);
while (1)
{
/* Insert a long delay */
delay(60);
log_info("\r\n enter sleep \r\n");
/* Request to enter SLEEP mode*/
PWR_EnterSLEEPMode(SLEEP_NOW, PWR_STOPENTRY_WFI);
log_info("\r\n sleep Wakeup From RTC \r\n");
void RTC_WKUP_IRQHandler(void)
{
if (RTC_GetITStatus(RTC_INT_WUT) != RESET)
{
RTC_ClrIntPendingBit(RTC_INT_WUT);
EXTI_ClrITPendBit(EXTI_LINE20);
}
}
{
/* Initialize USART,TX: PC10 RX: PC11*/
log_init();
log_info("\r\n RTC Init \r\n");
/* Enable PWR Clock */
RCC_EnableAPB1PeriphClk(RCC_APB1_PERIPH_PWR, ENABLE);
/* RTC date time alarm default value*/
RTC_DateAndTimeDefaultVale();
/* RTC clock source select */
RTC_CLKSourceConfig(RTC_CLK_SRC_TYPE_LSI, true, true);
RTC_PrescalerConfig();
log_info("\r\n RTC configured....\r\n");
/* Adjust time by values entered by the user on the hyperterminal */
RTC_DateRegulate();
RTC_TimeRegulate();
/* wake up clock select */
RTC_ConfigWakeUpClock(RTC_WKUPCLK_CK_SPRE_16BITS);
/* wake up timer value */
RTC_SetWakeUpCounter(9);
#if (RTC_ALARM_TEST_TYPE == RTC_ALARM_TEST_TYPE_IRQ) // 1.Alarm interrupt test
EXTI20_RTCWKUP_Configuration(ENABLE);
/* Enable the RTC Wakeup Interrupt */
RTC_ConfigInt(RTC_INT_WUT, ENABLE);
RTC_EnableWakeUp(ENABLE);
while (1)
{
/* Insert a long delay */
delay(60);
log_info("\r\n enter sleep \r\n");
/* Request to enter SLEEP mode*/
PWR_EnterSLEEPMode(SLEEP_NOW, PWR_STOPENTRY_WFI);
log_info("\r\n sleep Wakeup From RTC \r\n");
void RTC_WKUP_IRQHandler(void)
{
if (RTC_GetITStatus(RTC_INT_WUT) != RESET)
{
RTC_ClrIntPendingBit(RTC_INT_WUT);
EXTI_ClrITPendBit(EXTI_LINE20);
}
}
赞0
评论
2022-11-24
赞0
评论
2022-09-29
赞0
评论
2022-09-29
您需要登录后才可以回复 登录 | 注册