Hello all,
My project requires a real time clock AND sub-seconds event timing. Somewhere in it, I need to create a timestamp that would be like HH:MM:SS.ss - (1/100s resolution is good enough)
I got the RTC of the hibernation module to work just fine.
The HIBERNATE_COUNTER_24HR (Calendar) mode is really convenient to allow for a proper calendar behavior without having to worry with functions that increment seconds, minutes, hours, etc... But such mode does not allow for using the RTCSS value.
So I thought about Calendar mode together with a second timer (TIMER7_A), running from the same clock as the Hibernation module. My event time would be HibernateCalendarGet(¤t_time) plus the fraction of the current timer value.
I am however failing to sync both timers. I tried to start the hibernate time, enable a "round second" interrupt and immediately start TIMER7_A, but it won't sync at all (they both loop every second, but I can't get the TIMER7_A to reset at the same instant as the round second (a piece of code below).
ui32Status = HibernateIntStatus(0); HibernateIntClear(ui32Status); HibernateCalendarGet(&temptime); temptime.tm_sec = 0xFF; HibernateCalendarMatchSet(0,&temptime); HibernateIntEnable(HIBERNATE_INT_RTC_MATCH_0); while (!(HibernateIntStatus(0))); // waits for any interrupt (there is only one type enabled) TimerEnable(TIMER7_BASE, TIMER_A); ui32Status = HibernateIntStatus(0); HibernateIntClear(ui32Status); HibernateIntDisable(HIBERNATE_INT_RTC_MATCH_0);
Any suggestions for a different approach or to make this one work?
Thanks!
Bruno