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.

MSP430FR6989 RTC_C in CounterMode

Other Parts Discussed in Thread: MSP430FR6989

Hi,

I've been trying to rewrite the code below (to blink a led on the RTC interrupt):

// Setup RTC Timer
RTCCTL0_H = RTCKEY_H; // Unlock RTC

RTCCTL0_L = RTCTEVIE; // RTC event interrupt enable
// RTCCTL1 Register = Real-Time Clock Control Register 1
RTCCTL1 = RTCSSEL_2 | RTCTEV_0 | RTCHOLD; // Counter Mode, output from RTC1PS, 8-bit overflow
// RTCPS0CTL Register = Real-Time Clock Prescale Timer 0 Control Register
RTCPS0CTL = RT0PSDIV1; // ACLK, /8
// RTCPS1CTL Register = Real-Time Clock Prescale Timer 1 Control Register
RTCPS1CTL = RT1SSEL1 | RT1PSDIV0 | RT1PSDIV1; // out from RT0PS, /16

RTCCTL1 &= ~(RTCHOLD); // Start RTC

using the driverlib. After a while, I came up with this code:

RTC_C_initCounterPrescale(RTC_C_BASE, RTC_C_PRESCALE_0, RTC_C_PSCLOCKSELECT_ACLK, RTC_C_PSDIVIDER_8);
RTC_C_initCounterPrescale(RTC_C_BASE, RTC_C_PRESCALE_1, RTC_C_PSCLOCKSELECT_RT0PS, RTC_C_PSDIVIDER_16); 
RTC_C_initCounter(RTC_C_BASE, RTC_C_CLOCKSELECT_RT1PS, RTC_C_COUNTERSIZE_8BIT);
RTC_C_enableInterrupt(RTC_C_BASE, RTC_C_TIME_EVENT_INTERRUPT); // RTCTEVIE
RTC_C_startClock(RTC_C_BASE);

The code obviously does not work! After reading the code for RTC_C_initCounter (MSP430FR5xx_6xx//rtc_c.c) I realized that the routine does not start with:

HWREG8(baseAddress + OFS_RTCCTL0_H) = RTCKEY_H; 

which is supposed to unlock the RTC; (compare with RTC_C_initCalendar!)

From the datasheet:

"The RTCCTL0_H register implements key protection and controls the lock or unlock state of the module.
When this register is written with correct key, 0A5h, the module is unlocked and unlimited write access
possible to RTC_C registers."

The question is: is this behavior by design? Am I wrong assuming that the RTC_C_initCounter should also unlock the RTC first (like RTC_C_initCalendar)?

=======================================

Platform: MSP430FR6989 launchpad

Tools: CCS 6.1.2.00014 + MSP-GCC 

=======================================

Thank you & Best regards,

Radu G.

**Attention** This is a public forum