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.

CCS/MSP430FR5969: RTC_C Alarm not interrupting

Part Number: MSP430FR5994

Tool/software: Code Composer Studio

Hi all,
I have already asked this question, but since I did not get a response, I thought I would ask it again for clarity.
I am trying to use the MSP430FR5994 RTC_C module. I have breakpoints for the RTCIV_RTCTEVIFG and the RTCIV_RTCAIFG interrupts. But only the first interrupt is being called. I am attaching my code to help with any questions about setup you may have. For the most part, my setup is similar to the example TI code. Thank you for your help!

/*
 * mainTest.c
 *
 *  Created on: Jul 31, 2018
 *      Author: Sanskriti Joshi
 */

#include <msp430fr5994.h>

int PollingInterval = 2;
volatile int counter = 0;


int main(void){
    MCU_Init();
    MCU_Init_Clock();
    RTCsetup();

    while(1){
        __bis_SR_register(GIE|LPM3_bits);
    }
}

void MCU_Init()
{
    // configure MCU Pins
    WDTCTL = WDTPW | WDTHOLD;   // Stop watchdog timer
    PM5CTL0 &= ~LOCKLPM5;       //disable the GPIO power-on default high-impedance
}

void MCU_Init_Clock()
{
      PJSEL0 = BIT4 | BIT5;               //initialize the LFXT pins

      CSCTL0_H = CSKEY >> 8;                                // Unlock CS registers
      CSCTL0 = CSKEY;
      CSCTL1 = DCOFSEL_0;                                   // Set DCO = 1MHz (measured with Oscilloscope to be slightly less that 1 MHz)
      CSCTL2 = SELA__VLOCLK | SELS__DCOCLK | SELM__DCOCLK;  // set ACLK=VLO;SMCLK=DCO Note: the VLO is typically 10 kHz (measured with Oscilloscope to be slightly less that 10 MHz)
      CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1;                 // set all dividers
      //start of code added for RTC
      CSCTL4 &= ~LFXTOFF;                                       //enable the crystal
      do{
          CSCTL5 &= ~LFXTOFFG;                                  //clear LFXT  fault flag
          SFRIFG1 &= ~OFIFG;
      }while (SFRIFG1 & OFIFG);                                 //test oscillator fault flag
      //end of code added for real time clock
      CSCTL0_H = 0;                                         // Lock CS Registers
}

void RTCsetup(void){
    //RTC_C setup

    RTCCTL0_H = RTCKEY_H; // unlock RTC registers
    RTCCTL0_L = RTCTEVIE_L | RTCRDYIE_L; //Enable RTC Ready Interrupt and Time Event Interrupt
    RTCCTL13 = RTCBCD | RTCMODE | RTCHOLD; // Enable BCD mode, enable RTC in calendar mode, hold while date/time values are set

    //SET date time info
    RTCYEAR = 0x2018;
    RTCMON = 0x7;
    RTCDAY = 0x25;
    RTCDOW = 0x4;
    RTCHOUR = 0x12;
    RTCMIN = 0x50;
    RTCSEC = 0x00;

    //RTC clock alarm setup
    RTCalarmSet(PollingInterval);
    RTCAMIN |= RTCAE; //enable minute alarm
    RTCCTL13 &= ~(RTCHOLD); //start RTC
    RTCCTL0_H = 0;

}

void RTCalarmSet(int PollingInterval){
    RTCAMIN = 0x00;
    RTCAHOUR = 0x00;
    RTCADOW = 0x00;
    RTCADAY =0x00;

    unsigned int Temp_time = 0;
    Temp_time = (((RTCMIN >> 4) & 0x0F) * 10) + (RTCMIN & 0x0F);
    Temp_time += PollingInterval;
    if(Temp_time > 59){
        Temp_time -= 60;
        RTCAMIN = (Temp_time / 10) << 4;
        RTCAMIN |= (Temp_time % 10);
    }else{
        RTCAMIN = (Temp_time / 10) << 4;
        RTCAMIN |= (Temp_time % 10);
    }
}

#pragma vector = RTC_C_VECTOR
__interrupt void RTC_C_ISR(void){
    switch(__even_in_range(RTCIV, RTCIV__RT1PSIFG)){
    case RTCIV_RTCTEVIFG:   //minuteInterrupt
        counter = counter - 1;
        break;
    case RTCIV_RTCRDYIFG:   //secondInterrupt
        break;
    case RTCIV_RTCAIFG:     //alarm interrupt
        //RTCalarmSet(PollingInterval);
        RTCAMIN |= RTCAE; //enable minute alarm
        counter = counter + 1;
        break;
    default:
        break;
    }
    __bic_SR_register_on_exit(LPM3_bits);
}

**Attention** This is a public forum