This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP432 RTC Count/Timer register

Good day,

I was wondering if there was a register not specified within the datasheet for the Real-Time Clock peripheral that holds the current count in seconds. After reading through the User's guide/datasheet it doesn't seem like there is one, but it would be helpful rather than converting the mm/dd/yr etc. And by seconds register I mean a register that would contain the UNIX epoch count.

Thank you for your time.

--Alexander

  • Good day Alexander,

    When using the RTC in hexadecimal format the RTCSEC, RTCMIN, RTCHOUR, RTCDOW, RTCDAY, RTCMON, and RTCYEAR registers contain the decimal representation of the seconds, minutes, hours, day of week, day of month, month, and year, respectively. There is not, however, a register that keeps track of the UNIX epoch count, you would have to create a variable that stores that information manually.

    Regards,
    Ryan
  • Alright thankyou, just making sure.

    Best,

    --Alexander

  • Hello Ryan,

    Is it possible to use the RTC for creating a time and a datestamp, because I want to put the values of the ADC on the UART with a time and a datestamp.?

    I tried to read out the values of the RTCSEC but the value was always the same.

  • Hi guys,

    I want to use the internal RTC for creating date- and timestamps, but when I set the parameters and start the RTC the values of the RTC Register (e.g. RTCMIN) didn't change.

    Could I use the RTC for my desired function? (the source code is mentioned below)

    void RTCConfig(void)
    {
    		RTCYEAR = 2010;                         // Year = 0x2010
    	    RTCMON = 4;                             // Month = 0x04 = April
    	    RTCDAY = 5;                            // Day = 0x05 = 5th
    	    RTCDOW = 1;                            // Day of week = 0x01 = Monday
    	    RTCHOUR = 10;                           // Hour = 0x10
    	    RTCMIN = 32;                            // Minute = 0x32
    	    RTCSEC = 45;                            // Seconds = 0x45
    
    	    RTCCTL1 &= ~(RTCHOLD);                    // Start RTC calendar mode
    	    RTCCTL0_H = 0;                            // Lock the RTC registers
    }

    Thanks.

  • Hello Christoph,

    Yes it is possible, it is called RTC_C calendar mode and is covered in Chapter 18 of the MSP432P4xx Family Technical Reference Manual. Examples of this mode (msp432p401_rtc_01, rtc_c_calendar_alarm_interrupt.c) are provided in both C and driverlib format. Pay special attention as to whether you are operating in hexadecimal or BCD format as this changes the output values of the RTC registers. If the value of RTCSEC is always the same then the RTC has most likely not been initialized/started properly.  Usual cases involve not unlocking/holding the RTC before setting the timestamp registers or setting the timestamp registers to a nonsensical value for the given format.

    Regards,
    Ryan

**Attention** This is a public forum