rtc闹钟都配置好了,就是到点之后唤醒不了 ===============rtc配置======================= EXTI_ClearITPendingBit(EXTI_Line17); EXTI_InitStructure.EXTI_Line = EXTI_Line17; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); /*使能 RTC Wakeup Interrupt */ NVIC_InitStructure.NVIC_IRQChannel = RTC_Alarm_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); //先关闭 RTC_AlarmCmd(RTC_Alarm_A,DISABLE); 才能使用RTC_SetAlarm ret = RTC_AlarmCmd(RTC_Alarm_A,DISABLE); printf("ret = %d\r\n",ret); RTC_AlarmStruct.RTC_AlarmTime.RTC_H12=RTC_HourFormat_24; RTC_AlarmStruct.RTC_AlarmTime.RTC_Hours=9; RTC_AlarmStruct.RTC_AlarmTime.RTC_Minutes=59; RTC_AlarmStruct.RTC_AlarmTime.RTC_Seconds=20; // RTC_AlarmStruct.RTC_AlarmDateWeekDay= // RTC_AlarmStruct.RTC_AlarmDateWeekDaySel= RTC_AlarmStruct.RTC_AlarmMask=RTC_AlarmMask_Seconds | RTC_AlarmMask_Minutes | RTC_AlarmMask_Hours; RTC_SetAlarm(RTC_Format_BIN,RTC_Alarm_A,&RTC_AlarmStruct); RTC_ClearFlag(RTC_FLAG_ALRAF) ===================主函数调用========================= while(1) PWR_EnterSTOPMode( PWR_Regulator_LowPower, PWR_STOPEntry_WFI ); //进去之后就出不来了 求指导 |
评分
查看全部评分
1:对于程序可能产生的标志位必须的清除干净,不清除会出现唤醒失灵现象!!
2:由于停机下所有时钟关闭,所以唤醒需要重新配置时钟!!
参考代码:
char Wakeflag=0;
void RTCAlarm_IRQHandler(void)
{
if(RTC_GetFlagStatus(RTC_IT_ALR))
{
EXTI_ClearITPendingBit(EXTI_Line17);
RTC_ClearITPendingBit(RTC_IT_ALR);
RTC_WaitForLastTask();
EXTI_ClearITPendingBit(EXTI_Line7);
EXTI_ClearITPendingBit(EXTI_Line1);//对于程序可能产生的标志位必须的清除干净,不清除会出现唤醒失灵现象!!
if(PWR_GetFlagStatus(PWR_FLAG_WU) != RESET)
{
PWR_ClearFlag(PWR_FLAG_WU);//一般没用
}
SystemInit();//重要,由于停机下对所有时钟关闭,所以唤醒需要重新配置时钟!!
Wakeflag=!Wakeflag;
GPIO_WriteBit(GPIOA, GPIO_Pin_5, Wakeflag);//LED灯指示
}
}
评分
查看全部评分
谢谢
是对照着芯片手册弄的
这里是把不需要用到的屏蔽掉。按现在的设置应该是到了对应的日期或者星期才会唤醒。
评分
查看全部评分
请问下,我也出现这个问题,您现在解决了吗?
我也遇到了这个问题,假如这句话之后就能进入中断了