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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

1,429件の閲覧回数
hunglam
Contributor II

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;
}

0 件の賞賛
返信
1 返信

1,271件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi hung,

It seems the bug of RTC in SDK1.3, please try to modify the RTC_DRV_AlarmIntAction in fsl_rtc_driver.c.

C:\Freescale\KSDK_1.3.0\platform\drivers\src\rtc\fsl_rtc_driver.c.

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信