I have some very odd behavior while trying to debug my program on an MSP430FR5959. I'm using the MSP430FR595x (HFXT Only) variant with a 16 MHz oscillator. When I try and debug the program the debugger will randomly stop at a different instruction. I cannot just let the debugger run even when I have no break points set.
In trying to debug this issue I've set the processor to use the DCOCLK also set at 16 MHz and I still have the same random jumping debugger issue. If I set the DCOCLK to 24 MHz and set DIVM__2 so that the processor is running at 12 Mhz (24 MHz / 2) then the debugger runs fine. I initially had the FRAM wait states set to NWAITS_1 but even setting it to NWAITS_7 did not seem to help when running at 16 MHz. SMCLK seems to be ok running off the 16 MHz HFXT and I've verified that SMCLK is actually running at 16 MHz by probing the SMCLK P3.4 output with a scope probe. I am sure that this is not a stack overflow or undefined interrupt problem as this code works fine on an MSP430FR5949.
Here is my code for both HFXT and DCO operation:
// Failing Code // CSCTL0_H = 0xA5; /* CSKEY unlock for clock control register access */ // CSCTL4 = HFFREQ_2 | HFXTBYPASS | VLOOFF | LFXTOFF | LFXTDRIVE_0 | HFXTDRIVE_0; // CSCTL1 = DCORSEL | DCOFSEL_4; /* Set DCO frequency to 16Mhz */ // CSCTL2 = SELA__VLOCLK | SELS__HFXTCLK | SELM__HFXTCLK; // CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1; // Ok Code CSCTL0_H = 0xA5; /* CSKEY unlock for clock control register access */ CSCTL4 = HFFREQ_2 | HFXTBYPASS | VLOOFF | LFXTOFF | LFXTDRIVE_0 | HFXTDRIVE_0; CSCTL1 = DCORSEL | DCOFSEL_4 | DCOFSEL_2; /* Set DCO frequency to 24Mhz */ CSCTL2 = SELA__VLOCLK | SELS__HFXTCLK | SELM__DCOCLK; CSCTL3 = DIVA__1 | DIVS__1 | DIVM__2; /* Test the oscillator fault flag */ do { CSCTL5 &= ~(HFXTOFFG); /* Clear XT fault flags */ SFRIFG1 &= ~OFIFG; } while(SFRIFG1 & OFIFG);
The part number for the oscillator is ASTX-H11-16.000MHZ-T
Can anyone give me any tips to help me solve this problem?