Hello All,
I have seen a few posting regarding my topic, "MSP430: Trouble Halting Target CPU: Internal error", but not sure if any of them related to my issue. Often when I try suspending the execution I will get the "MSP430: Trouble Halting Target CPU: Internal error" message in the Console window. I am not sure what is causing the issue. I know the code is still running since it is responding to I2C commands and I have an LED connected which is being strobed at the determined interval/pattern. In one of the posting I saw perhaps the PLL is not being set correctly, so here is my clock init routine (which I borrowed from somewhere).
void SysUtil_ClkInit(void)
{
UCSCTL3 = SELREF_2; /* Set DCO FLL reference = REFO */
UCSCTL4 |= SELA_2; /* Set ACLK = REFO */
UCSCTL0 = 0x0000; /* Set lowest possible DCOx, MODx */
/* Loop until XT1,XT2 & DCO stabilizes - In this case only DCO has to */
/* stabilize */
do
{
UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG); // Clear XT2, XT1, DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear fault flags
} while (SFRIFG1 & OFIFG); /* Test oscillator fault flag */
__bis_SR_register(SCG0); /* Disable the FLL control loop */
UCSCTL1 = DCORSEL_5; /* Select DCO range */
UCSCTL2 = SYSUTIL_FLL_LOOP_DIVIDER | SYSUTIL_FLLN;
__bic_SR_register(SCG0); /* Enable the FLL control loop */
/* Worst-case settling time for the DCO when the DCO range bits have */
/* beenchanged is n x 32 x 32 x f_MCLK / f_FLL_reference. See UCS */
/* chapter in 5xx User Guide for optimization. */
/* 32 x 32 x 8 MHz / 32,768 Hz = 230400 = MCLK cycles for DCO to settle */
__delay_cycles(230400);
CpuFrequency = ((UCSCTL2 & SYSUTIL_FLLN_MASK) + 1) * SYSUTIL_REFOCLK;
}
I read that perhaps tight loops might cause the issue or numerous high priority interrupts. I am using a timer as my foreground execution scheduler that is running at about 20 Hz (i.e., 50 ms). There is not much activity in the foreground other than strobing the LED. The other interrupt is for the I2C which isn't very often, only when I send data via a Aardvark I2C/SPI device.
Does anyone have any thoughts of what areas I might look at to resolve the problem?
Regards,
Mark