This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR60431: MSP430FR60431 boots fine in debug mode, but not after flashing – hangs at USS_runAlgorithmsFixedPoint

Part Number: MSP430FR60431
Other Parts Discussed in Thread: MSP430FR6043

Tool/software:

I'm using a custom board with MSP430FR60431. Oscillator configuration:

  • 8 MHz HF crystal for MCLK/SMCLK

  • 32.768 kHz crystal for ACLK

  • 8 MHz crystal for USSXTIN/USSXTOUT

I ported the FR6043_USSSWLib_template_example project for MSP430FR6043 to this board. Debug via Spy-Bi-Wire using CCS works fine. I can capture ultrasonic data and process it as expected.

Issue: After flashing the code and power cycling, the board does not boot.

Through testing, I found the problem occurs at:

c
CopyEdit
code = USS_runAlgorithmsFixedPoint(config, &fixedResults);

If I comment this out, the board boots fine and the main loop runs. If left in, nothing happens post-reset — no LED, no LCD update, no UART. No watchdog reset either.

Any idea why USS_runAlgorithmsFixedPoint would hang only after flashing, but not during a debug session?

Thanks.

#ifdef __TI_COMPILER_VERSION__
int _system_pre_init(void)
#elif __IAR_SYSTEMS_ICC__
int __low_level_init(void)
#elif __GNUC__
extern int system_pre_init(void) __attribute__((constructor));
int system_pre_init(void)
#else
#error Compiler not supported!
#endif
{
    /* Insert your low-level initializations here */

    /* Disable Watchdog timer to prevent reset during */
    /* int32_t variable initialization sequences. */
    // Stop WDT
    WDTCTL = WDTPW + WDTHOLD;

    /*
     * Configure CS module
     * MCLK  = 16 MHz from DCOCLK
     * SMCLK = 8MHz from DCOCLK
     * ACLK  = LFXTCLK expected to have a 32.768 KHz
     */
	// Unlock CS registers
	CSCTL0_H = CSKEY >> 8;
#if (USS_PULSE_MODE == 2)
    // Set DCO to 16MHz
    CSCTL1 = DCORSEL | DCOFSEL_4;
    // Configure wait states to be able to use 16 MHz MCLK
    FRCTL0 = (FRCTLPW | NWAITS_2);
    // Configure clock dividers all dividers
    CSCTL3 = (DIVA__1 | DIVS__2 | DIVM__1);
#else
    // Set DCO to 8MHz
    CSCTL1 = DCORSEL | DCOFSEL_3;
    // Configure clock dividers all dividers
    CSCTL3 = (DIVA__1 | DIVS__1 | DIVM__1);
#endif
    // Set SMCLK = MCLK = DCO, ACLK = LFXTCLK
    CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK;
	CSCTL4 |= (LFXTDRIVE_3);
	CSCTL4 &= ~(LFXTOFF);
	CSCTL0_H = 0;

	// GPIO Configuration
	PAOUT = 0;
	PADIR = 0xFFFF;

	PBOUT = 0;
	PBDIR = 0xFFFF;

	PCOUT = 0;
	PCDIR = 0xFFFF;

	PDOUT = 0;
	PDDIR = 0xFFFF;

    PEOUT = 0;
    PEDIR = 0xFFFF;

#if APPLICATION_ENABLE_UART_DEBUG
	// GPIO Configuration for UART mode
    P1SEL0 |= (BIT2 | BIT3);
    P1SEL1 &= ~(BIT2 | BIT3);

    // Configure USCI_A0 for UART mode, 8-bit data, 1 stop bit
    UCA1CTLW0 = UCSWRST;                    // Put eUSCI in reset
    UCA1CTLW0 |= UCSSEL__SMCLK;             // CLK = SMCLK

    // For BRCLK = SMCLK = 8MHz, and Baud rate = 115200 (See UG)
    UCA1BRW = 4;
    // UCBRSx (bits 7-4) = 0x55, UCBRFx (bits 3-1) = 5, UCOS16 (bit 0) = 1
    UCA1MCTLW = 0x5551;

    UCA1CTLW0 &= ~UCSWRST;                 // release from reset
#endif

    /*
     * Configure LFXT GPIO pins and start
     */
	PJSEL0 |= BIT4 | BIT5;

    lcd_init();
    // Timer_A0 setup for 0.5 ms interrupt
    TA0CCR0 = 3999;                             // 0.5 ms at 8 MHz
    TA0CCTL0 = CCIE;                            // Enable CCR0 interrupt
    TA0CTL = TASSEL_2 | MC_1 | TACLR;           // SMCLK, Up mode, clear TAR

    P3DIR |= BIT1;      // Set P3.1 as output
    P3OUT &= ~BIT1;     // Start with LED off
    __enable_interrupt();  // Just enable global interrupts
	PM5CTL0 &= ~LOCKLPM5;


    /*==================================*/
    /* Choose if segment initialization */
    /* should be done or not.           */
    /* Return: 0 to omit initialization */
    /* 1 to run initialization          */
    /*==================================*/
    return(1);
}

void lcd_init(void)
{
    //Initialize COMS pins and External bias resistor pins
    P6SEL0 = (BIT4 | BIT5 | BIT6 | BIT7);
    P6SEL1 = (BIT4 | BIT5 | BIT6 | BIT7);

    // Initialize LCD segments 0 - 21;
    LCDCPCTL0 = 0xFE63;     
    LCDCPCTL1 = 0x213F;     
    LCDCPCTL2 = 0x0003;

    LCDCCTL0 = LCDDIV__1 | LCDPRE__16 | (LCDMX1+LCDMX0+LCDSON) | LCDLP;

    LCDCMEMCTL = LCDCLRM;                   // Clear LCD memory

    //Turn LCD on
    LCDCCTL0 |= LCDON;
}


**Attention** This is a public forum