Other Parts Discussed in Thread: MSP430FR5994, TM4C1294NCPDT
Hi,
I have gone through the RTC configuration example section as part of the Out-of-box demo for MSP-EXP430FR5994. In the code below, it shows how to set the RTC upon system startup. But how do I skip the RTC setting upon system startup? I mean that the RTC is holding its value (rather maintaining the clock) and upon system startup I do not want to set the time again, I just want the RTC to continue and I will fetch the time whenever necessary. I commented the blue coloured section below to see if it helps; but this results into wrong RTC time (during RTC value read). For example, the original year setting was 'Year = 0x2018' but while reading the year value after an MCU reset, the value came as 843 (decimal).
Note that in my application, I kept the RTC running in BCD mode while the application uses binary mode for its internal calculations. For setting the clock & for retrieving the same, the driverlib BCDtoBinary & BinaryToBCD functions have been used.
-
void Init_RTC() { //Setup Current Time for Calendar calendar.Seconds = 0x00; calendar.Minutes = 0x00; calendar.Hours = 0x00; calendar.DayOfWeek = 0x01; calendar.DayOfMonth = 0x01; calendar.Month = 0x01; calendar.Year = 0x2019; // Initialize RTC with the specified Calendar above RTC_C_initCalendar(RTC_C_BASE, &calendar, RTC_C_FORMAT_BCD); RTC_C_setCalendarEvent(RTC_C_BASE, RTC_C_CALENDAREVENT_MINUTECHANGE ); RTC_C_clearInterrupt(RTC_C_BASE, RTC_C_TIME_EVENT_INTERRUPT ); RTC_C_enableInterrupt(RTC_C_BASE, RTC_C_TIME_EVENT_INTERRUPT ); //Start RTC Clock RTC_C_startClock(RTC_C_BASE); }
-
Thanks
-
Regards
Soumyajit