AnsweredAssumed Answered

why RTC interrupts occurred only several times although rtc is set to interrupt in endless loop

Question asked by hung lam on Dec 18, 2017
Latest reply on Dec 28, 2017 by Robin_Shen

Hi,

I have tested the RTC of the FRDM-64. I used ksdk 1.3 with processor expert. All initial settings were carried out using PE. The code I used can be seen below. All it should do is to interrupt every minute in an endless loop. However, somehow interrupts occurred only several times and then the program hanged. Nothing happened after that. Anyone who can help? I would appreciate very much! Thanks

 

// events.c


extern volatile bool alarm;

void rtcTimer1_IRQHandler(void)
{
RTC_DRV_AlarmIntAction(rtcTimer1_IDX);
alarm = true;
}

 

-------------------------------
// main.c

volatile bool alarm=false;
int main(void)

{

rtc_repeat_alarm_state_t alrm_state;
rtc_datetime_t zeit_now =
{
zeit_now.year = 2017U,
zeit_now.month =12U,
zeit_now.day = 17U,
zeit_now.hour = 11U,
zeit_now.minute = 40U,
zeit_now.second = 0U,
};

rtc_datetime_t alrmRepTime =
{
zeit_now.year = 0U,
zeit_now.month =0U,
zeit_now.day = 0U,
zeit_now.hour = 0U,
zeit_now.minute = 1U,
zeit_now.second = 0U,
};

/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/

/* Write your code here */
/* For example: for(;;) { } */
RTC_DRV_InitRepeatAlarm(rtcTimer1_IDX,&alrm_state);
RTC_DRV_SetDatetime(rtcTimer1_IDX,&zeit_now);
RTC_DRV_SetAlarmRepeat(rtcTimer1_IDX,&zeit_now,&alrmRepTime);

while(1)
{
while(!alarm) {}
GPIO_DRV_TogglePinOutput(J2_4); //LED connected to PIN J2_4
alarm=false;
}

Attachments

Outcomes