Use: We need to drive the MSP with an external 29070 Hz 0-3V squarewave that is more accurate than REFOCLK.
Hardware: MSP-FET430UIF USB Debugger. TI MSP430PZ100B demo board.
What we are seeing is that the UCSCTL7 : XT1LFOFFG bit is always 1. It switches away from XCT1CLK to REFOCLK due to fault. We can setup the REFOCLK but its not stable enough for us. So we are trying to get the FLL to use the XTC1 source.
Here is the code I am using:
PMM_setVCore(PMM_CORE_LEVEL_3); WDTCTL = WDTPW | WDTHOLD; // not sure but stuck in anyway __bis_SR_register(SCG0); // Disable the FLL control loop Bits16 ratio = 609; UCSCTL6 &= ~(XT1OFF); // FAULT? Turn on XCT1 external UCSCTL1 = DCORSEL_6; // Select DCO range 20MHz operation UCSCTL2 = ratio; //FLLD_1 | ratio; // Set DCO Multiplier (FLLN, FLLD) (32768 x 610 = 19,988,480 REFO, but not what we want exactly) UCSCTL3 = FLLREFDIV_0; // Was 0x0020-> Now 0x0000, put on XT1CLK (not REFO) for FLL FAULT? __bic_SR_register(SCG0); // Enable the FLL control loop UCSCTL7 = 0; // clear fault flags, fails SFRIFG1 &= ~OFIFG; // not sure but looks cool __delay_cycles(625000); // wait maybe work after stable? SFRIFG1 &= ~OFIFG; UCSCTL7 = 0; // clear fault flags, fails UCSCTL4 = SELA2 | SELS2 | SELM2; // dcoclkdiv smclk & mclk & aclk, fails UCSCTL7 = 0; // clear fault flags, fails //HACK END
Could it be the debugger or am I just doing it wrong? Trying all sorts of things, nothing good.
TIA.