AnsweredAssumed Answered

RTC Alarm does not work properly.

Question asked by Daniel Chai on Oct 14, 2013

Hi,

In MQX4.0.1, I use the following code to create a RTC alarm. But when it enter the rtc_alarm_interrupt, the RTC_SR is always 0x10 which seems wrong. Because it is an alarm interrupt, it should be 0x04.     Please advice.

 

Thank you.

 

void rtc_alarm_interrupt(pointer rtc_registers_ptr)

{

    uint_32 ui32Status = 0;

    ui32State = _rtc_get_status();

   

    if(ui32State & RTC_RTCISR_ALM)

    {

    }

    ui32Status = RTC_SR;

    _rtc_clear_requests(ui32State);

}

 

void main()

{

 

     DATE_STRUCT alarm_time_rtc;

     TIME_STRUCT alarm_time_mqx;

 

     if(MQX_OK != _rtc_int_install(rtc_alarm_interrupt))

     {

             _task_block();;

     }

      _rtc_clear_requests(RTC_RTCISR_ALM);

     if(0 == _rtc_int_enable(TRUE, RTC_RTCIENR_ALM))

      {

             _task_block();

     }

      _rtc_set_alarm_mqxd(&alarm_time_rtc);

    _time_to_date(&alarm_time_mqx, &alarm_time_rtc);

    alarm_time_rtc.SECOND += 30;

 

     for(;;);

}

Outcomes