使用RTC唤醒Halt,还没有进入halt。配置RTC时会卡在RTC_WakeUpCmd(Enable)函数/* Wait un
til WUTWF flag is set */ while (((RTC->ISR1 RTC_ISR1_WUTWF) == RESET) ( wutwfcount != WUTWF_TIMEOUT))
{
wutwfcount++;
}
请问是哪里没有备注好吗?
while(1)之前的配置:
/* Select HSE as system clock source */
CLK_SYSCLKSourceSwitchCmd(ENABLE);
CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_LSI);
/* system clock prescaler: 1*/
CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_1);
while (CLK_GetSYSCLKSource() != CLK_SYSCLKSource_LSI)
{}
//RTC_DeInit(); //初始化默认状态
CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
CLK_RTCClockConfig(CLK_RTCCLKSource_LSI, CLK_RTCCLKDiv_1);
while (CLK_GetFlagStatus(CLK_FLAG_LSIRDY) == RESET);
//RTC_WakeUpClockConfig(RTC_WakeUpClock_CK_SPRE_16bits);
RTC_WakeUpClockConfig(RTC_WakeUpClock_RTCCLK_Div16);
RTC_ITConfig(RTC_IT_WUT, ENABLE);
enableInterrupts();while(1)
{
//RTC_SetWakeUpCounter(742);
RTC_SetWakeUpCounter(1);
RTC_WakeUpCmd(ENABLE);
halt();
RTC_WakeUpCmd(DISABLE);
GPIO_ToggleBits(LED_GPIO_PORT, LED_GPIO_PINS);
}