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.

CCS/MSP432P401R: Code composer studio crash while debugging MSP432 uC

Part Number: MSP432P401R


Tool/software: Code Composer Studio

Hello, I have been working with a MSP432 red board when suddenly CCS crashes, it is weird, because when using another MSP432 red board everything goes normal. All of this began after I load one of this codes, I do not remenber wich one, but it was one of them...

First code:

/* DriverLib Includes */
#include <ti/devices/msp432p4xx/driverlib/driverlib.h>

/* Standard Includes */
#include <stdint.h>

#include <stdbool.h>

#define frecuencia_clk 2560
#define frecuencia_Mue (frecuencia_clk*1/100)
#define div 160

/* Timer_A PWM Configuration Parameter */
Timer_A_PWMConfig pwmConfig1 =
{
        TIMER_A_CLOCKSOURCE_SMCLK,
        TIMER_A_CLOCKSOURCE_DIVIDER_1,
        frecuencia_clk,
        TIMER_A_CAPTURECOMPARE_REGISTER_1,
        TIMER_A_OUTPUTMODE_RESET_SET,
        128
};

Timer_A_PWMConfig pwmConfig2 =
{
        TIMER_A_CLOCKSOURCE_SMCLK,
        TIMER_A_CLOCKSOURCE_DIVIDER_1,
        frecuencia_clk,
        TIMER_A_CAPTURECOMPARE_REGISTER_2,
        TIMER_A_OUTPUTMODE_RESET_SET,
        128
};

Timer_A_PWMConfig pwmConfig3 =
{
        TIMER_A_CLOCKSOURCE_SMCLK,
        TIMER_A_CLOCKSOURCE_DIVIDER_1,
        frecuencia_clk,
        TIMER_A_CAPTURECOMPARE_REGISTER_3,
        TIMER_A_OUTPUTMODE_RESET_SET,
        128
};

Timer_A_PWMConfig pwmConfig4 =
{
        TIMER_A_CLOCKSOURCE_SMCLK,
        TIMER_A_CLOCKSOURCE_DIVIDER_1,
        frecuencia_clk,
        TIMER_A_CAPTURECOMPARE_REGISTER_4,
        TIMER_A_OUTPUTMODE_RESET_SET,
        128
};

volatile int i,j;

int main(void)
{
    /* Halting the watchdog */
    MAP_WDT_A_holdTimer();

    /* Setting Flash wait state */
    MAP_FlashCtl_setWaitState(FLASH_BANK0, 2);
    MAP_FlashCtl_setWaitState(FLASH_BANK1, 2);

    /* Setting MCLK to REFO at 128Khz for LF mode
     * Setting SMCLK to 64Khz */
    MAP_CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_48);
    MAP_CS_setReferenceOscillatorFrequency(CS_REFO_128KHZ);
    MAP_CS_initClockSignal(CS_MCLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_1);
    MAP_CS_initClockSignal(CS_SMCLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_1);
    MAP_PCM_setPowerState(PCM_AM_LF_VCORE0);

    /* Configuring GPIO2.4 and 2.5 as peripheral output for PWM  and P1.1 for button
     * interrupt */
    MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN4,GPIO_PRIMARY_MODULE_FUNCTION);
    MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN5,GPIO_PRIMARY_MODULE_FUNCTION);
    MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN6,GPIO_PRIMARY_MODULE_FUNCTION);
    MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN7,GPIO_PRIMARY_MODULE_FUNCTION);


    MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P1, GPIO_PIN1);
    MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, GPIO_PIN1);
    MAP_GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN1);

    /* Configuring Timer_A to have a period of approximately 500ms and
     * an initial duty cycle of 10% of that (3200 ticks)  */


    /* Enabling interrupts and starting the watchdog timer */
    MAP_Interrupt_enableInterrupt(INT_PORT1);
    MAP_Interrupt_enableSleepOnIsrExit();
    MAP_Interrupt_enableMaster();

    MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfig1);
    MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfig2);
    MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfig3);
    MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfig4);
    /* Sleeping when not in use */
    while (1)
    {

    }
}

/* Port1 ISR - This ISR will progressively step up the duty cycle of the PWM
 * on a button press
 */
void PORT1_IRQHandler(void)
{
    uint32_t status = MAP_GPIO_getEnabledInterruptStatus(GPIO_PORT_P1);
    MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, status);
    if (status & GPIO_PIN1)
    {
        if(pwmConfig1.dutyCycle == frecuencia_Mue & pwmConfig2.dutyCycle == frecuencia_Mue/10)
            {
                pwmConfig1.dutyCycle = frecuencia_Mue/10;
                pwmConfig2.dutyCycle = frecuencia_Mue;
            }
        else
            {
                pwmConfig1.dutyCycle += frecuencia_Mue/10;
                pwmConfig2.dutyCycle -= frecuencia_Mue/10;
            }
        MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfig1);
        MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfig2);
    }
}

Second code:

/* DriverLib Defines */
#include <ti/devices/msp432p4xx/driverlib/driverlib.h>

/* Standard Defines */
#include <stdint.h>
#include <stdbool.h>
#include <string.h>

/* Slave Address for I2C Slave */
#define SLAVE_ADDRESS       0x68
#define NUM_OF_REC_BYTES    14

/* Variables */
const uint8_t TXData[2] = {0x6B,0X00};
static uint8_t RXData[NUM_OF_REC_BYTES];
static uint16_t Aceleromet[3];

static volatile uint32_t smclk;
//static uint16_t Giroscopio[3];
//static uint16_t Temperatura;
static volatile uint32_t xferIndex;
static volatile bool stopSent;
uint_fast16_t status;

/* I2C Master Configuration Parameter */
const eUSCI_I2C_MasterConfig i2cConfig =
{
        EUSCI_B_I2C_CLOCKSOURCE_SMCLK,          // SMCLK Clock Source
        3000000,                                // SMCLK = 3MHz
        EUSCI_B_I2C_SET_DATA_RATE_400KBPS,      // Desired I2C Clock of 100khz
        0,                                      // No byte counter threshold
        EUSCI_B_I2C_NO_AUTO_STOP                // No Autostop
};

int main(void)
{
    /* Disabling the Watchdog  */
    MAP_WDT_A_holdTimer();

    MAP_FPU_enableModule();
    CS_setDCOFrequency(30000000);
//  CS_setDCOCenteredFrequency(3000000);
    CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_4);
    smclk = CS_getSMCLK();

    int i = 0;
    int T = 10000;

    for(i = 0 ; i <= T ; i++ )

    MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1,GPIO_PIN6 + GPIO_PIN7, GPIO_PRIMARY_MODULE_FUNCTION);
    stopSent = false;
    memset(RXData, 0x00, NUM_OF_REC_BYTES);

    for(i = 0 ; i <= T ; i++ )

    MAP_I2C_initMaster(EUSCI_B0_BASE, &i2cConfig);              // Initializing I2C Master to SMCLK at 100khz with no autostop
    MAP_I2C_setSlaveAddress(EUSCI_B0_BASE, SLAVE_ADDRESS);      //Specify slave address
    MAP_I2C_enableModule(EUSCI_B0_BASE);                        //Enable I2C Module to start operations
    MAP_Interrupt_enableInterrupt(INT_EUSCIB0);
    MAP_Interrupt_enableSleepOnIsrExit();

    for(i = 0 ; i <= T ; i++ )

    I2C_masterSendMultiByteStart(EUSCI_B0_BASE, TXData[0]);
    while (MAP_I2C_masterIsStopSent(EUSCI_B0_BASE));
    I2C_masterSendMultiByteFinish(EUSCI_B0_BASE, TXData[1]);
    while (MAP_I2C_masterIsStopSent(EUSCI_B0_BASE));

    for(i = 0 ; i <= T ; i++ )

    while (1)
    {
        while (MAP_I2C_masterIsStopSent(EUSCI_B0_BASE));
        Interrupt_enableSleepOnIsrExit();
        I2C_masterSendMultiByteStart(EUSCI_B0_BASE, 0X3B);

        xferIndex = 0;
        I2C_masterReceiveStart(EUSCI_B0_BASE);
        I2C_enableInterrupt(EUSCI_B0_BASE, EUSCI_B_I2C_RECEIVE_INTERRUPT0);
        PCM_gotoLPM0InterruptSafe();

    }
}

/*******************************************************************************
 * eUSCIB0 ISR. The repeated start and transmit/receive operations happen
 * within this ISR.
 *******************************************************************************/
void EUSCIB0_IRQHandler(void)
{
    status = I2C_getEnabledInterruptStatus(EUSCI_B0_BASE);
    I2C_clearInterruptFlag(EUSCI_B0_BASE, status);

    if (status & EUSCI_B_I2C_RECEIVE_INTERRUPT0)
    {
        if (xferIndex == NUM_OF_REC_BYTES - 1)
        {
            I2C_enableInterrupt(EUSCI_B0_BASE, EUSCI_B_I2C_STOP_INTERRUPT);
            I2C_disableInterrupt(EUSCI_B0_BASE, EUSCI_B_I2C_RECEIVE_INTERRUPT0);
//

            I2C_masterReceiveMultiByteStop(EUSCI_B0_BASE);
            RXData[xferIndex++] = I2C_masterReceiveMultiByteNext(EUSCI_B0_BASE);

        }
        else
        {
            RXData[xferIndex++] = MAP_I2C_masterReceiveMultiByteNext(EUSCI_B0_BASE);
        }
    }


    else if (status & EUSCI_B_I2C_STOP_INTERRUPT)
    {

        Interrupt_disableSleepOnIsrExit();
        I2C_disableInterrupt(EUSCI_B0_BASE,EUSCI_B_I2C_STOP_INTERRUPT);

        Aceleromet[0] = RXData[0] << 8 | RXData[1];
        Aceleromet[1] = RXData[2] << 8 | RXData[3];
        Aceleromet[2] = RXData[4] << 8 | RXData[5];

    }



}

i feel that it migth be related with the clock configuration, because this problem appers when I was using the command:

CS_setDCOFrequency(48000000);

This stops the code, i do not know why.

Does anyone knows what to do?, my msp432 is ruined? there is a way to fix this problem?

Thanks in advance

**Attention** This is a public forum