Part Number: MSP430FR5994
Other Parts Discussed in Thread: ENERGYTRACE, ADS1220,
Hello,
I'm making a delay function using timers and I came across the following situation:
Without calling the delay function, the current consumption is 10uA in LPM3.
After calling any of the delay functions, the consumption current is high +/- 150uA in LPM3.
Below is a code snippet and configuration attached.
Any suggestions for my setup?
////////////////////////////////////////////////////////////////////////////////
// Rotina para Gerar Atrasos para Leituras dos Sensores de Pressões //
////////////////////////////////////////////////////////////////////////////////
void Delay_PRESS(void)
{
TA4CCTL0 |= CCIE_1; // Habilita a Interrupção do TIMER4_A0
TA4CTL = TASSEL_1 + MC_1 + TACLR; // Configura o TIMER4_A0 (ACLK, UP Mode)
TA4CCR0 = 1966; // Periodo de Tempo da Leitura dos Sensores de Pressão de Entrada e Saída
__bis_SR_register(LPM3_bits + GIE); // Entra em LPM3 (Modo de Baixo Co
}
////////////////////////////////////////////////////////////////////////////////
// Rotina para Gerar Atrasos para Acionamentos das Válvulas Solenóides //
////////////////////////////////////////////////////////////////////////////////
void Delay_SOLENOIDE(void)
{
TA3CCTL0 |= CCIE_1; // Habilita a Interrupção do TIMER3_A0
TA3CTL = TASSEL_1 + MC_1 + TACLR; // Configura o TIMER3_A0 (ACLK, UP Mode)
TA3CCR0 = 327; // Periodo de Tempo de Acionamento das Válvulas Solenóides de Controle
__bis_SR_register(LPM3_bits + GIE); // Entra em LPM3 (Modo de Baixo Consumo)
}
////////////////////////////////////////////////////////////////////////////////
// Rotina Principal do Smart Logger VRP Controller //
////////////////////////////////////////////////////////////////////////////////
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Desabilita o WDT
// Disable the GPIO power-on default high-impedance mode to activate
// previously configured port settings
PM5CTL0 &= ~LOCKLPM5;
// Rotinas para Inicialização das Portas e Pinos do MSP430FR5994
initPORTS(); // Inicializa os Ports
// Rotinas para Inicialização do Clock e Oscilador do MSP430FR5994
//initClockTo1MHz(); // Seleciona o Clock para 1MHz
//initClockTo8MHz(); // Seleciona o Clock para 8MHz
initClockTo16MHz(); // Seleciona o Clock para 16MHz
// TimerA3 configuration
TA3CTL = 0; // Desabilita o TimerA3
// TimerA4 configuration
TA4CTL = 0; // Desabilita o TimerA4
// Habilita os Periféricos RTC e BT
RTCCTL13 &= ~RTCHOLD; // Habilita o RTC
// Rotina Principal do Loop
do
{
__bis_SR_register(LPM3_bits + GIE); // Entra em LPM3 (Modo de Baixo Consumo)
__no_operation (); // Não Faz Nada
}
while (1); // Enquanto While Igual a 1, Garante o LPM3
}
////////////////////////////////////////////////////////////////////////////////
// Rotina de Tratamento da Interrupção do Timer3_A0 de Ciclos Periódicos //
////////////////////////////////////////////////////////////////////////////////
// Timer3_A0 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMER3_A0_VECTOR
__interrupt void TIMER3_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMER3_A0_VECTOR))) TIMER3_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
__bic_SR_register_on_exit(LPM3_bits); // Sai do Modo de Baixo Consumo
TA3CCTL0 |= CCIE_0; // Desabilita a Interrupção do TIMER3_A0
TA3CTL = 0; // Desabilita o TIMER3_A0
}
////////////////////////////////////////////////////////////////////////////////
// Rotina de Tratamento da Interrupção do Timer4_A0 de Ciclos Periódicos //
////////////////////////////////////////////////////////////////////////////////
// Timer4_A0 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMER4_A0_VECTOR
__interrupt void TIMER4_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMER4_A0_VECTOR))) TIMER4_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
__bic_SR_register_on_exit(LPM3_bits); // Sai do Modo de Baixo Consumo
TA4CCTL0 |= CCIE_0; // Desabilita a Interrupção do TIMER4_A0
TA4CTL = 0; // Desabilita o TIMER4_A0
}