MSP430F20x3 with watchdog and smclk

Hi all,

I try to test the watchdog functionnality coupled with the lmp3.

here my code. I would like to have the maximum time that i can sleep in a msp430. I’m new to this micro. Here what i have up to now.

#include <msp430.h>

void main(void)

{

DCOCTL = 0x00;

BCSCTL1 = 0x00 | (XT2OFF | DIVA_3); // ACLK/8

BCSCTL2 = 0x00 | (SELM_3 | SELS);

BCSCTL3 = 0x00 | (XCAP_3);

WDTCTL = WDT_MDLY_32; // WDT 32768 with SMCLK as source

IE1 |= WDTIE; // Enable WDT interrupt

P1DIR = 0xFF; // All P1.x outputs

P1OUT = 0; // All P1.x reset

P2DIR = 0xFF; // All P2.x outputs

P2OUT = 0; // All P2.x reset

int i;

while(1)

{

P1OUT |= 0x01; // Set P1.0 LED on

for (i = 5000; i>0; i–); // Delay

P1OUT &= ~0x01;

_BIS_SR(LPM3_bits + GIE); // Enter LPM3

}

}

#pragma vector=WDT_VECTOR

__interrupt void watchdog_timer (void)

{

_BIC_SR_IRQ(LPM3_bits); // Clear LPM3 bits from 0(SR)

}

With this code, the watch dog is not fired. But i use

WDTCTL = WDT_ADLY_1000; (ACLK) it’s work.

I have plugged an 32K oscillator to external pins.

what is wrong with this code.

Jonathan

nvm.

Smclk doesn’t run in lpm3

Jonathan