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.

MSP430FR5969: Current Consumption with Comparator enabled with interrupt functionality

Part Number: MSP430FR5969

Hello Al

I tried below code and getting current consumption as 240-260uA on MSP430Fr5969 EVM 

int main(void)
{

WDTCTL = WDTPW | WDTHOLD; // Stop WDT
//Init_Clock();
Init_GPIO();

//Set P1.0 as an output pin.
GPIO_setAsOutputPin(
GPIO_PORT_P1,
GPIO_PIN0
);
//Set P1.0 as Output Low.
GPIO_setOutputLowOnPin(
GPIO_PORT_P1,
GPIO_PIN0
);


// Configure GPIO
P3DIR |= BIT5; // P3.5 output direction
P3SEL1 |= BIT5; // Select CEOUT function on P3.5/CEOUT

// Disable the GPIO power-on default high-impedance mode to activate
// previously configured port settings
PM5CTL0 &= ~LOCKLPM5;

// Setup Comparator_E
CECTL0 = CEIPEN | CEIPSEL_12; // Enable V+, input channel CE1
CECTL1 = CEPWRMD_3; // normal power mode
CECTL2 = CEREFL_2 | CERS_3 | CERSEL; // VREF is applied to -terminal
// R-ladder off; bandgap ref voltage
// supplied to ref amplifier to get Vcref=2.0V
CEINT &= ~(CEIFG | CEIIFG | CERDYIFG ); // Clear any errant interrupts
CEINT |= CEIE; // Enable CompB Interrupt on rising edge of CBIFG (CBIES=0)

CECTL3 = BITC; // Input Buffer Disable @P1.1/CE1
CECTL1 |= CEON; // Turn On Comparator_E

__delay_cycles(75); // delay for the reference to settle

// __no_operation();
while(1)
{
_low_power_mode_4();

__no_operation();
}

}

//******************************************************************************
//
//This is the COMP_E_VECTOR interrupt vector service routine.
//
//******************************************************************************
#pragma vector=COMP_E_VECTOR
__interrupt void COMP_E_ISR(void)
{
     GPIO_toggleOutputOnPin( 
                       GPIO_PORT_P1,
                      GPIO_PIN0
      );
}

/*
* GPIO Initialization
*/
void Init_GPIO()
{
// Set all GPIO pins to output low for low power
GPIO_setOutputLowOnPin(GPIO_PORT_P1, GPIO_PIN0|GPIO_PIN1|GPIO_PIN2|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PIO_PIN0|GPIO_PIN1|GPIO_PIN2|GPIO_PIN3|GPIO_PIN4|GPIO_PIN5|GPIO_PIN6|GPIO_PIN7|GPIO_PIN8|GPIO_PIN9|GPIO_PIN10|GPIO_PIN11|GPIO_PIN12|GPIO_PIN13|GPIO_PIN14|GPIO_PIN15);

// Set PJ.4 and PJ.5 as Primary Module Function Input, LFXT.
GPIO_setAsPeripheralModuleFunctionInputPin(
GPIO_PORT_PJ,
GPIO_PIN4 + GPIO_PIN5,
GPIO_PRIMARY_MODULE_FUNCTION
);

GPIO_selectInterruptEdge(GPIO_PORT_P1, GPIO_PIN2, GPIO_LOW_TO_HIGH_TRANSITION);
GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P1, GPIO_PIN2);
GPIO_clearInterrupt(GPIO_PORT_P1, GPIO_PIN2);
GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN2);

//Set P1.0 as an output pin.
GPIO_setAsOutputPin(
GPIO_PORT_P1,
GPIO_PIN0
);
//Set P1.0 as Output Low.
GPIO_setOutputHighOnPin(
GPIO_PORT_P1,
GPIO_PIN0
);


// Disable the GPIO power-on default high-impedance mode
// to activate previously configured port settings
PMM_unlockLPM5();
}


/*
* Clock System Initialization
*/

void Init_Clock()

{
CSCTL0_H = CSKEY >>8;

CS_setExternalClockSource(LFXT_FREQUENCY, HFXT_FREQUENCY);

CS_turnOffHFXT();

CS_turnOffVLO();

CS_turnOnLFXT(CS_LFXT_DRIVE_3);

CS_setDCOFreq(CS_DCORSEL_0, CS_DCOFSEL_6); //8MHz

CS_initClockSignal(CS_ACLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1);

//CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1);

//CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1);

}

I am having following problems:

1) Interrupt is not generated when V threshold is above 2.0 V but P3.5 is turning high...Why interrupt is not generated

2) Current consumption is around 240-260 uA.... Why Current consumption is high

**Attention** This is a public forum