Steve Underwood wrote:
The insight debugger also seems to hang at crystal startup

do // wait in loop until crystal
is stable   {
   IFG1 &= ~OFIFG;
-> } while (IFG1 & OFIFG);

Why would you expect this to do anything but loop forever? The interrupt says there is a problem. You do nothing to fix it.


the snipet above is from the tcpip example, according to the xtal doc of the msp430 the code above do nothing because the flag is not set immediatly after it as been cleared. You need to add a delay of approx 50 cyles at 1Mhz before polling the flag again.

see code below.

unsigned int i;
WDTCTL = WDTPW + WDTHOLD;             // Stop WDT
BCSCTL1 |= XTS;                       // ACLK = LFXT1 = HF XTAL

do
{
        IFG1 &= ~OFIFG;                       // Clear OSCFault flag
        for (i = 0xFF; i > 0; i--);           // Time for flag to set
}
while ((IFG1 & OFIFG) == OFIFG); // OSCFault flag still set?

This code is the correct way to wait for OSC to be stabilized, unfortunatly it hang in GDB. Any workaround?

--
Dominic Pageau


Reply via email to