不能进入STM32 RTC 的AlARM 中断服务程序,请求帮忙,不知道问题出在哪里?
中断配置如下:void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
/* Configure the NVIC Preemption Priority Bits */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
/* Enable the RTC Interrupt*/
NVIC_InitStructure.NVIC_IRQChannel = RTC_IRQChannel;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Enable the RTCAlarm Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = RTCAlarm_IRQChannel;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
RTC配置中有:/* Wait for RTC registers synchronization */
RTC_WaitForSynchro();
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
/* Enable the RTC Alarm */
RTC_ITConfig(RTC_IT_SEC, ENABLE);
RTC_WaitForLastTask();
RTC_SetAlarm(RTC_GetCounter()+ 5);
RTC_WaitForLastTask();
RTC_ITConfig(RTC_IT_ALR, ENABLE);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
中断服务程序:
void RTC_IRQHandler(void)
{
if(RTC_GetITStatus(RTC_IT_SEC) != RESET)
{
//GPIO_ResetBits(GPIOB, GPIO_Pin_8);
RTC_ClearITPendingBit(RTC_IT_SEC); //首先必须清中断,否则一直响应中断
SecStatus = OneSec; //设置标志位,表示现在达到一秒
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
}
if(RTC_GetITStatus(RTC_IT_ALR) != RESET)
{
GPIO_SetBits(GPIOB, GPIO_Pin_9);
RTC_ClearITPendingBit(RTC_IT_ALR); //首先必须清中断,否则一直响应中断
SecStatus = OneSec; //设置标志位,表示现在达到一秒
/*Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
/* Set the RTC Alarm after 5s */
RTC_SetAlarm(RTC_GetCounter()+ 5);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
}
/* Reset RTC Counter when Time is 23:59:59 */
if(RTC_GetCounter() == 0x00015180) //15180即为24小时的秒计数
{
RTC_SetCounter(0x0);
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
}
}
在线仿真,进不去闹铃中断标志的服务程序,就算写在void RTCAlarm_IRQHandler (void) 里面也没有用,
到底是怎么回事呢?手册上说RTC_ALARM 是和EXTI_LINE17级联的,难道是配置的问题么? |