Tool/software: TI C/C++ Compiler
Hi Team,
We are using MSP430F5419A and during some conditions, we will put it HIBERNATE mode by doing the below method.
#if defined __MSP430_HAS_UCS__
// As per the 249 code add clock configuration
// Set to default
// Lowest current consumtion for LF
UCSCTL6 = XT2OFF | XT1DRIVE_0 | XCAP_3 | SMCLKOFF; // 12 pF load
UCSCTL0 = 0; // Make sure we do not overclock...
UCSCTL1 = DCORSEL_2; // Worst case range 6.0 - 23.7 MHz
UCSCTL2 = FLLD_1 | 31; // Multiply 244 times ~7995392 Hz - 276 ppm from 8 MHz
UCSCTL4 = SELA__XT1CLK | SELS__DCOCLKDIV | SELM__DCOCLKDIV;
UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
// Worst-case settling time for the DCO when the DCO range bits have been
// changed is n x 32 x 32 x f_MCLK / f_FLL_reference. See UCS chapter in 5xx
// UG for optimization.
// 32 x 32 x 8 MHz / 32,768 Hz = 250000 = MCLK cycles for DCO to settle
__delay_cycles(500000);
// Loop until XT1,XT2 & DCO fault flag is cleared
do
{
UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
// Clear XT2,XT1,DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear fault flags
}while (SFRIFG1&OFIFG); // Test oscillator fault flag
#elif defined __MSP430_HAS_BC2__
BCSCTL1 = XT2OFF + RSEL0 + RSEL1 + RSEL2; // DCO default
DCOCTL = DCO0 + DCO1; // DCO default
BCSCTL2 = 0;
#else
BCSCTL2 = DIVM_3; // BCL5 chip errate workaround
BCSCTL1 = XT2OFF + RSEL2; // DCO default
BCSCTL2 = 0; // BCL5 chip errate workaround
DCOCTL = DCO0 + DCO1; // DCO default
#endif
Is this code fine, to put the MSP in low power mode?
or do we have to do the below step also ?
(__bis_SR_register( __SR_GIE \
| __SR_CPU_OFF \
| __SR_SCG0 \
| __SR_SCG1 \
| __SR_OSC_OFF))
Please confirm.
Thanks & Regards,
swarna.N