hi all,
i am using the RTC and having a problem understanding the priority of the RTCIV. My code sends the time to a display, but it is one minute slow. i have traced this to be the event interrupt (every minute, that sends the time), is being executed before the ready interrupt (on RTCRDY, that updates the time). I was expecting that RTCRDYIFG was higher priority than RTCEVIFG, and on a minute rollover they will both be set (per fig 29-1 in user manual).
#pragma vector = RTC_VECTOR
__interrupt void RTC_ISR(void)
{
switch(__even_in_range(RTCIV, 16))
{
case RTCIV_NONE: break; //No interrupts
case RTCIV__RTCOFIFG: break; //RTCOFIFG - fault.
case RTCIV__RTCRDYIFG: //RTCRDYIFG - triggered just after 1Hz reg-update.
//Safest point to Update the RTC internal time
sRtcTime.Seconds = HWREG8(RTC_C_BASE + OFS_RTCTIM0_L);
sRtcTime.Minutes = HWREG8(RTC_C_BASE + OFS_RTCTIM0_H);
sRtcTime.Hours = HWREG8(RTC_C_BASE + OFS_RTCTIM1_L);
sRtcTime.DayOfWeek = HWREG8(RTC_C_BASE + OFS_RTCTIM1_H);
sRtcTime.DayOfMonth = HWREG8(RTC_C_BASE + OFS_RTCDATE_L);
sRtcTime.Month = HWREG8(RTC_C_BASE + OFS_RTCDATE_H);
sRtcTime.Year = HWREG16(RTC_C_BASE + OFS_RTCYEAR);
Task_SysTick_1s.flag = true;
APP_WAKEUP;
break;
case RTCIV__RTCTEVIFG: //RTCEVIFG - Interrupts every minute
Task_MinuteTick.flag = true;
APP_WAKEUP;
break;
break;
case RTCIV__RTCAIFG: break;
case RTCIV__RT0PSIFG: break;
case RTCIV__RT1PSIFG: break;
default: break;
}
}
in the main loop it checks, checks if Task_MinuteTick is set and copies out sRtcTime (Calendar) to another instance and sends it on. I can see with gpio toggles in each case above that EVIFG runs 3.9-4ms before RTCRDY, but i though it would be the other way round?
i have a workaround for it, but just want to know if im misinterpreting how the interrupt vector is working.
thanks,
michael.