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.

Unable to write to RTC month register reliably

Other Parts Discussed in Thread: MSP430F5438, CODECOMPOSER

I'm running on a MSP430F5438 using CodeComposer Studio v4.  After initializing the RTC to calender mode using Binary/Hexadecimal format (a more detailed initialization is found below) I'm calling a method that writes a specified date and time sequence composed of unsigned chars to the RTCSEC (always set to 0), RTCMIN, RTCHOUR, RTCDOW (always set to 0), RTCDAY, RTCMON, RTCYEAR_H, and RTCYEAR_L registers.   Now the wacky part is that the RTCTIM0 register (composed of RTCMIN & RTCHOUR), the RTCTIM1 register (composed of RTCHOUR & RTCDOW), and  RTCYEAR register (composed of RTCYEAR_H & RTCYEAR_L) all are being written to successfully, BUT the RTCMON portion of the RTCDATE (composed of RTCDAY & RTCMON) has been inconsistently getting bad values.  I say inconsistently because it actually works sometimes.  I'm aware that only 1-12 are valid entries for RTCMON and only that range was tested.  I've tried holding the RTC using the RTCHOLD bit before writing and checking the RTCRDY flag but that didn't fix it.  Are you able to write to these registers more than once?  I'm open to suggestions and/or advice.

RTC Control Register Values:

RTCCTL0 = 0x00 (No Interrupts)

  • RTCTEVIE: Real-time clock time event interrupt NOT enabled
  • RTCAIE: Real-time clock alarm interrupt NOT enabled
  • RTCRDYIE: Real-time clock read ready interrupt NOT enabled
  • RTCTEVIFG: Real-time clock time event flag. No time event occurred
  • RTCAIFG: Real-time clock alarm flag. No time event occurred
  • RTCRDYIFG: Real-time clock read ready flag. RTC cannot be read safely.

 RTCCTL1 = 0x20

  • RTCBCD: Binary/hexadecimal code selected
  • RTCHOLD: Real-time clock (32-bit counter or calendar mode) is operational.
  • RTCMODE: Calendar mode
  • RTCRDY: RTC time values in transition
  • RTCSSEL:  Real-time clock source select. ACLK

RTCCTL2 = 0x00; RTCCTL3 = 0x00 (No calibration done)

Thanks in advance.

**Attention** This is a public forum