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.

RTOS/MSP432P4111: DriverLib Crashes (SimpleLink MSP432P4 SDK 2.10.0.14 or 2.20.0.12)

Part Number: MSP432P4111


Tool/software: TI-RTOS

I have some driverlib function calls that are crashing in the driverlib functions. I'm wondering if i'm not initializing something, or if there are constraints for these functions that i'm missing.  

In my Main function, If i call the CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_48); function, interrupt vector table (interruptVenctors section in memory) has a few of it's initial words overwritten, and the program crashes on the next CS_initClockSignal calls. 

There is no useful output from ROV or concole debug for this crash.  

I'm not even sure where to start with this one.   It seems like the way the driver code is compiled it fairly easily causes crashes, despite looking correct.  

int main(void)
{
    /* Stop Watchdog  */
    WDT_A_holdTimer();

    /* Call Driver init functions */
    MPU_disableModule();
    PCM_setCoreVoltageLevel(PCM_VCORE1);
    //CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_48);  // Put this in, and things crash
    CS_setReferenceOscillatorFrequency(CS_REFO_128KHZ);
    CS_initClockSignal(CS_ACLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_1);
    CS_initClockSignal(CS_SMCLK, CS_MODOSC_SELECT, CS_CLOCK_DIVIDER_1);
    Interrupt_disableSleepOnIsrExit(); // MDR_DEBUG: Disable sleep for now.
    FPU_enableModule();
    FPU_enableLazyStacking();

    GpioInit();
    ADCInit();
...

In scenario 2, if I leave that driver call commented out in main (CS_setDCOCenteredFrequency()), when I run my GpioInit() function I get a crash.  I'm not seeing anything glaringly obvious in my code that should cause a crash.  The problem appears to be for all gpio registers who's base address LSB (bit0)= 1 . 

typedef struct SGpioPortCfg {
   uint_fast8_t port;
   uint_fast16_t outputs;
   uint_fast16_t inputs;
   uint_fast16_t pullup;
   uint_fast16_t pulldown;
   uint_fast8_t hiDrive;
   uint_fast8_t loDrive;
}TGpioPortCfg;

const TGpioPortCfg PortCfg[] = {
/*   Port         , out   , in    , pullup, pulldn, hiDrv,  loDrv  */
   { GPIO_PORT_P1 , 0x008A, 0x0075, 0x0000, 0x00FF, 0x00, 0xFF },
   { GPIO_PORT_P3 , 0x00CE, 0x0031, 0x0000, 0x00FF, 0x00, 0xFF },
   { GPIO_PORT_P4 , 0x0000, 0x00FF, 0x0000, 0x00FF, 0x00, 0xFF },
   { GPIO_PORT_P5 , 0x0000, 0x00FF, 0x0000, 0x00FF, 0x00, 0xFF },
   { GPIO_PORT_P6 , 0x001F, 0x00E0, 0x0004, 0x00FD, 0x00, 0xFF },
   { GPIO_PORT_P7 , 0x0000, 0x00FF, 0x0000, 0x00FF, 0x00, 0xFF },
   { GPIO_PORT_P8 , 0x00F7, 0x0008, 0x0000, 0x00FF, 0x00, 0xFF },
   { GPIO_PORT_P9 , 0x00FF, 0x0000, 0x0000, 0x00FF, 0x00, 0xFF },
   { GPIO_PORT_P10, 0x003F, 0x0000, 0x0000, 0x00FF, 0x00, 0xFF },
   { GPIO_PORT_PJ , 0x0000, 0x00FF, 0x0000, 0x00FF, 0x00, 0xFF },
   { GPIO_PORT_P2 , 0x00FF, 0x0000, 0x0000, 0x00FF, 0x00, 0xFF },
   { 0            , 0x0000, 0x0000, 0x0000, 0x0000, 0x00, 0x00 }
};

BOOL  GpioInit(void)
{
   BOOL success = FALSE;
#if 1
   int16 portIdx = 0;
   for( portIdx = 0; PortCfg[portIdx].port; portIdx++ )
   {
      GPIO_setAsOutputPin( PortCfg[portIdx].port, PortCfg[portIdx].outputs ); // <== It crashes here when Index = 2, regardless of the order of the PortCfg array
      GPIO_setAsInputPin( PortCfg[portIdx].port, PortCfg[portIdx].inputs );
      GPIO_setAsInputPinWithPullDownResistor( PortCfg[portIdx].port, PortCfg[portIdx].pulldown );
      GPIO_setAsInputPinWithPullUpResistor( PortCfg[portIdx].port, PortCfg[portIdx].pullup );
      GPIO_setDriveStrengthHigh( PortCfg[portIdx].port, PortCfg[portIdx].hiDrive );
      GPIO_setDriveStrengthLow( PortCfg[portIdx].port, PortCfg[portIdx].loDrive );
   }

...

Table of the port configuration attempts the GPIO driver works or crashes on

Port Offset Crash or OK
1 0x00h OK
3 0x20h OK
5 0x40h OK
7 0x60h OK
9 0x80h OK
J 0x120h OK
2 0x01h CRASH
4 0x21h CRASH
6 0x41h CRASH
8 0x61h CRASH
10 0x81h CRASH

This appears to be because of an UNALIGNED access caused in the driver code (the way it's compiled).  

 ROV does give some useful Exception info in this case

Here's the Exception Info:

Decoded exception	
Decoded	Hard Fault: FORCED: USAGE: UNALIGNED
Exception context	
$addr	0x2003fee8
$type	ti.sysbios.family.arm.m3.Hwi.ExcContext

threadType	
threadHandle	0x0
threadStack	0x2003f800
threadStackSize	2048

r0	0x40004c2b
r1	0xf5cc
r2	0x0
r3	0x4
r4	0x2
r5	0xf110
r6	0xf110
r7	0xf110
r8	0xf110
r9	0xf110
r10	0xf110
r11	0xf110
r12	0x0
sp	0x2003ffc0
lr	0x4045
pc	0x9824
psr	0x1000000
ICSR	0x803
MMFSR	0x0
BFSR	0x0
UFSR	0x100
HFSR	0x40000000
DFSR	0x1
MMAR	0xe000ed34
BFAR	0xe000ed38
AFSR	0x0

Exception call stack	
0 GPIO_setAsOutputPin at gpio.c:69 :	PC=0x00009824
1 GpioInit at Msp432Gpio.c:64 :	PC=0x00004044
2 main at main.c:180 :	PC=0x000082F6
3 _c_int00 at boot.asm:254 :	PC=0x00008C14

This is the mixed c/ssembly of where the exception is occuring:

void GPIO_setAsOutputPin(uint_fast8_t selectedPort, uint_fast16_t selectedPins)
{
    uint32_t baseAddress = GPIO_PORT_TO_BASE[selectedPort];

    HWREG16(baseAddress + OFS_LIB_PASEL0) &= ~selectedPins;  <= Exception occurs here on PORT4
    HWREG16(baseAddress + OFS_LIB_PASEL1) &= ~selectedPins;
    HWREG16(baseAddress + OFS_LIB_PADIR) |= selectedPins;
}


          GPIO_setAsOutputPin():
0000980c:   F1AD0D10            sub.w      sp, sp, #0x10
00009810:   9101                str        r1, [sp, #4]
00009812:   9000                str        r0, [sp]
 67           uint32_t baseAddress = GPIO_PORT_TO_BASE[selectedPort];
00009814:   490C                ldr        r1, [pc, #0x30]
00009816:   9800                ldr        r0, [sp]
00009818:   F8510020            ldr.w      r0, [r1, r0, lsl #2]
0000981c:   9002                str        r0, [sp, #8]
 69           HWREG16(baseAddress + OFS_LIB_PASEL0) &= ~selectedPins;
0000981e:   9802                ldr        r0, [sp, #8]
00009820:   9A01                ldr        r2, [sp, #4]
00009822:   300A                adds       r0, #0xa
00009824:   8801                ldrh       r1, [r0]                          <==== This is the PC location when the exception happens... R0 = GPIO SEL0 register location, and when it's ODD (lsb/bit0 = 1) it crashes..IE for all ports at odd offsets
00009826:   4391                bics       r1, r2
00009828:   8001                strh       r1, [r0]
 70           HWREG16(baseAddress + OFS_LIB_PASEL1) &= ~selectedPins;
0000982a:   9802                ldr        r0, [sp, #8]
0000982c:   9A01                ldr        r2, [sp, #4]
0000982e:   300C                adds       r0, #0xc
00009830:   8801                ldrh       r1, [r0]
00009832:   4391                bics       r1, r2
00009834:   8001                strh       r1, [r0]
 71           HWREG16(baseAddress + OFS_LIB_PADIR) |= selectedPins;
00009836:   9802                ldr        r0, [sp, #8]
00009838:   9901                ldr        r1, [sp, #4]
0000983a:   1D00                adds       r0, r0, #4
0000983c:   8802                ldrh       r2, [r0]
0000983e:   4311                orrs       r1, r2
00009840:   8001                strh       r1, [r0]

 How do I prevent this GPIO exception from occuring? 

Is there a compiler setting to prevent stuff like this?

  • Mark,

       There are drivers in place so that you do not need to use the driverlib APIs.  Specifically, in the board (MSP_EXP432P4111.c) file you should find the following definitions:

    /*
     *  =============================== Power ===============================
     */
    const PowerMSP432_ConfigV1 PowerMSP432_config = {
        .policyInitFxn = &PowerMSP432_initPolicy,
        .policyFxn = &PowerMSP432_sleepPolicy,
        .initialPerfLevel = 2,
        .enablePolicy = true,
        .enablePerf = true,
        .enableParking = true
    };

    Where Performance level 2 is defined as:

     * Notes for the implementation of Power_setPerformanceLevel()
     *
     * 1) Depending on the MSP432 device variant, there are three or four
     *    predefined performance levels.  For example, on MSP432P401x devices
     *    the following levels are predefined:
     *
     *    Level    MCLK (MHz)    HSMCLK (MHz)    SMCLK (MHz)    ACLK (Hz)
     *    -----    ----------    ------------    -----------    ---------
     *      0         12              3              3           32768
     *      1         24              6              6           32768
     *      2         48             24             12           32768
     *      3         48             48             24           32768
     *
     *    The levels for all device variants are defined below, via
     *    PowerMSP432_PerfLevel structures.
     *
     * 2) DCDC is assumed to be available
     *
     * 3) Hardware interrupts are disabled during the change of performance level

    Similarly for the GPIO you should find definitions.  

    Can you use the TIDrivers instead?

    Regards,
    Chris

  • Hi Chris,

    I created a project from the "empty_MSP_EXP432P4111_nortos_ccs" project in resource explorer.  

    This project does not have that file you mentioned.

    File->New->Project -> Code Composer Studio->CCS Project ->Resource Explorer

    Under Resource Explorer... ->Software->SimpleLink MSP432P4 SDK = v2.20.00.12 -> Examples ->Development Tools ->MSP432P4111 LaunchPad ->DriverLib ->empty

    Should I be using a different project template for this?  

    I only have a file called: system_msp432p4111.c

    That looks like this

    /******************************************************************************
    * @file     system_msp432p4111.c
    * @brief    CMSIS Cortex-M4F Device Peripheral Access Layer Source File for
    *           MSP432P4111
    * @version  3.231
    * @date     01/26/18
    *
    * @note     View configuration instructions embedded in comments
    *
    ******************************************************************************/
    //*****************************************************************************
    //
    // Copyright (C) 2015 - 2018 Texas Instruments Incorporated - http://www.ti.com/
    //
    // Redistribution and use in source and binary forms, with or without
    // modification, are permitted provided that the following conditions
    // are met:
    //
    //  Redistributions of source code must retain the above copyright
    //  notice, this list of conditions and the following disclaimer.
    //
    //  Redistributions in binary form must reproduce the above copyright
    //  notice, this list of conditions and the following disclaimer in the
    //  documentation and/or other materials provided with the
    //  distribution.
    //
    //  Neither the name of Texas Instruments Incorporated nor the names of
    //  its contributors may be used to endorse or promote products derived
    //  from this software without specific prior written permission.
    //
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    //
    //*****************************************************************************
    
    #include <stdint.h>
    #include <ti/devices/msp432p4xx/inc/msp.h>
    
    /*--------------------- Configuration Instructions ----------------------------
       1. If you prefer to halt the Watchdog Timer, set __HALT_WDT to 1:
       #define __HALT_WDT       1
       2. Insert your desired CPU frequency in Hz at:
       #define __SYSTEM_CLOCK   12000000
       3. If you prefer the DC-DC power regulator (more efficient at higher
           frequencies), set the __REGULATOR to 1:
       #define __REGULATOR      1
     *---------------------------------------------------------------------------*/
    
    /*--------------------- Watchdog Timer Configuration ------------------------*/
    //  Halt the Watchdog Timer
    //     <0> Do not halt the WDT
    //     <1> Halt the WDT
    #define __HALT_WDT         1
    
    /*--------------------- CPU Frequency Configuration -------------------------*/
    //  CPU Frequency
    //     <1500000> 1.5 MHz
    //     <3000000> 3 MHz
    //     <12000000> 12 MHz
    //     <24000000> 24 MHz
    //     <48000000> 48 MHz
    #define  __SYSTEM_CLOCK    48000000
    
    /*--------------------- Power Regulator Configuration -----------------------*/
    //  Power Regulator Mode
    //     <0> LDO
    //     <1> DC-DC
    #define __REGULATOR        1
    
    /*----------------------------------------------------------------------------
       Define clocks, used for SystemCoreClockUpdate()
     *---------------------------------------------------------------------------*/
    #define __VLOCLK           10000
    #define __MODCLK           24000000
    #define __LFXT             32768
    #define __HFXT             48000000
    
    /*----------------------------------------------------------------------------
       Clock Variable definitions
     *---------------------------------------------------------------------------*/
    uint32_t SystemCoreClock = __SYSTEM_CLOCK;  /*!< System Clock Frequency (Core Clock)*/
    
    /**
     * Update SystemCoreClock variable
     *
     * @param  none
     * @return none
     *
     * @brief  Updates the SystemCoreClock with current core Clock
     *         retrieved from cpu registers.
     */
    void SystemCoreClockUpdate(void)
    {
        uint32_t source = 0, divider = 0, dividerValue = 0, centeredFreq = 0, calVal = 0;
        int16_t dcoTune = 0;
        float dcoConst = 0.0;
    
        divider = (CS->CTL1 & CS_CTL1_DIVM_MASK) >> CS_CTL1_DIVM_OFS;
        dividerValue = 1 << divider;
        source = CS->CTL1 & CS_CTL1_SELM_MASK;
    
        switch(source)
        {
        case CS_CTL1_SELM__LFXTCLK:
            if(BITBAND_PERI(CS->IFG, CS_IFG_LFXTIFG_OFS))
            {
                // Clear interrupt flag
                CS->KEY = CS_KEY_VAL;
                CS->CLRIFG |= CS_CLRIFG_CLR_LFXTIFG;
                CS->KEY = 1;
    
                if(BITBAND_PERI(CS->IFG, CS_IFG_LFXTIFG_OFS))
                {
                    if(BITBAND_PERI(CS->CLKEN, CS_CLKEN_REFOFSEL_OFS))
                    {
                        SystemCoreClock = (128000 / dividerValue);
                    }
                    else
                    {
                        SystemCoreClock = (32000 / dividerValue);
                    }
                }
                else
                {
                    SystemCoreClock = __LFXT / dividerValue;
                }
            }
            else
            {
                SystemCoreClock = __LFXT / dividerValue;
            }
            break;
        case CS_CTL1_SELM__VLOCLK:
            SystemCoreClock = __VLOCLK / dividerValue;
            break;
        case CS_CTL1_SELM__REFOCLK:
            if (BITBAND_PERI(CS->CLKEN, CS_CLKEN_REFOFSEL_OFS))
            {
                SystemCoreClock = (128000 / dividerValue);
            }
            else
            {
                SystemCoreClock = (32000 / dividerValue);
            }
            break;
        case CS_CTL1_SELM__DCOCLK:
            dcoTune = (CS->CTL0 & CS_CTL0_DCOTUNE_MASK) >> CS_CTL0_DCOTUNE_OFS;
    
            switch(CS->CTL0 & CS_CTL0_DCORSEL_MASK)
            {
            case CS_CTL0_DCORSEL_0:
                centeredFreq = 1500000;
                break;
            case CS_CTL0_DCORSEL_1:
                centeredFreq = 3000000;
                break;
            case CS_CTL0_DCORSEL_2:
                centeredFreq = 6000000;
                break;
            case CS_CTL0_DCORSEL_3:
                centeredFreq = 12000000;
                break;
            case CS_CTL0_DCORSEL_4:
                centeredFreq = 24000000;
                break;
            case CS_CTL0_DCORSEL_5:
                centeredFreq = 48000000;
                break;
            }
    
            if(dcoTune == 0)
            {
                SystemCoreClock = centeredFreq;
            }
            else
            {
    
                if(dcoTune & 0x1000)
                {
                    dcoTune = dcoTune | 0xF000;
                }
    
                if (BITBAND_PERI(CS->CTL0, CS_CTL0_DCORES_OFS))
                {
                    dcoConst = *((volatile const float *) &TLV->DCOER_CONSTK_RSEL04);
                    calVal = TLV->DCOER_FCAL_RSEL04;
                }
                /* Internal Resistor */
                else
                {
                    dcoConst = *((volatile const float *) &TLV->DCOIR_CONSTK_RSEL04);
                    calVal = TLV->DCOIR_FCAL_RSEL04;
                }
    
                SystemCoreClock = (uint32_t) ((centeredFreq)
                                   / (1
                                        - ((dcoConst * dcoTune)
                                                / (8 * (1 + dcoConst * (768 - calVal))))));
            }
            break;
        case CS_CTL1_SELM__MODOSC:
            SystemCoreClock = __MODCLK / dividerValue;
            break;
        case CS_CTL1_SELM__HFXTCLK:
            if(BITBAND_PERI(CS->IFG, CS_IFG_HFXTIFG_OFS))
            {
                // Clear interrupt flag
                CS->KEY = CS_KEY_VAL;
                CS->CLRIFG |= CS_CLRIFG_CLR_HFXTIFG;
                CS->KEY = 1;
    
                if(BITBAND_PERI(CS->IFG, CS_IFG_HFXTIFG_OFS))
                {
                    if(BITBAND_PERI(CS->CLKEN, CS_CLKEN_REFOFSEL_OFS))
                    {
                        SystemCoreClock = (128000 / dividerValue);
                    }
                    else
                    {
                        SystemCoreClock = (32000 / dividerValue);
                    }
                }
                else
                {
                    SystemCoreClock = __HFXT / dividerValue;
                }
            }
            else
            {
                SystemCoreClock = __HFXT / dividerValue;
            }
            break;
        }
    }
    
    /**
     * Initialize the system
     *
     * @param  none
     * @return none
     *
     * @brief  Setup the microcontroller system.
     *
     * Performs the following initialization steps:
     *     1. Enables the FPU
     *     2. Halts the WDT if requested
     *     3. Enables all SRAM banks
     *     4. Sets up power regulator and VCORE
     *     5. Enable Flash wait states if needed
     *     6. Change MCLK to desired frequency
     *     7. Enable Flash read buffering
     */
    void SystemInit(void)
    {
        // Enable FPU if used
        #if (__FPU_USED == 1)                              /* __FPU_USED is defined in core_cm4.h */
        SCB->CPACR |= ((3UL << 10 * 2) |                   /* Set CP10 Full Access */
                       (3UL << 11 * 2));                   /* Set CP11 Full Access */
        #endif
    
        #if (__HALT_WDT == 1)
        WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD;         // Halt the WDT
        #endif
    
        // Enable all SRAM banks
        while(!(SYSCTL_A->SRAM_STAT & SYSCTL_A_SRAM_STAT_BNKEN_RDY));
        if (SYSCTL_A->SRAM_NUMBANKS == 4)
        {
        	SYSCTL_A->SRAM_BANKEN_CTL0 = SYSCTL_A_SRAM_BANKEN_CTL0_BNK3_EN;
        }
        else
        {
        	SYSCTL_A->SRAM_BANKEN_CTL0 = SYSCTL_A_SRAM_BANKEN_CTL0_BNK1_EN;
        }
    
    
        #if (__SYSTEM_CLOCK == 1500000)                                  // 1.5 MHz
        // Default VCORE is LDO VCORE0 so no change necessary
    
        // Switches LDO VCORE0 to DCDC VCORE0 if requested
        #if __REGULATOR
        while((PCM->CTL1 & PCM_CTL1_PMR_BUSY));
        PCM->CTL0 = PCM_CTL0_KEY_VAL | PCM_CTL0_AMR_4;
        while((PCM->CTL1 & PCM_CTL1_PMR_BUSY));
        #endif
    
        // No flash wait states necessary
    
        // DCO = 1.5 MHz; MCLK = source
        CS->KEY = CS_KEY_VAL;                                 // Unlock CS module for register access
        CS->CTL0 = CS_CTL0_DCORSEL_0;                                // Set DCO to 1.5MHz
        CS->CTL1 &= ~(CS_CTL1_SELM_MASK | CS_CTL1_DIVM_MASK) | CS_CTL1_SELM__DCOCLK;  // Select MCLK as DCO source
        CS->KEY = 0;
    
        // Set Flash Bank read buffering
        FLCTL_A->BANK0_RDCTL &= ~(FLCTL_A_BANK0_RDCTL_BUFD | FLCTL_A_BANK0_RDCTL_BUFI);
        FLCTL_A->BANK1_RDCTL &= ~(FLCTL_A_BANK0_RDCTL_BUFD | FLCTL_A_BANK0_RDCTL_BUFI);
    
        #elif (__SYSTEM_CLOCK == 3000000)                                  // 3 MHz
        // Default VCORE is LDO VCORE0 so no change necessary
    
        // Switches LDO VCORE0 to DCDC VCORE0 if requested
        #if __REGULATOR
        while(PCM->CTL1 & PCM_CTL1_PMR_BUSY);
        PCM->CTL0 = PCM_CTL0_KEY_VAL | PCM_CTL0_AMR_4;
        while(PCM->CTL1 & PCM_CTL1_PMR_BUSY);
        #endif
    
        // No flash wait states necessary
    
        // DCO = 3 MHz; MCLK = source
        CS->KEY = CS_KEY_VAL;                                                         // Unlock CS module for register access
        CS->CTL0 = CS_CTL0_DCORSEL_1;                                                  // Set DCO to 1.5MHz
        CS->CTL1 &= ~(CS_CTL1_SELM_MASK | CS_CTL1_DIVM_MASK) | CS_CTL1_SELM__DCOCLK;  // Select MCLK as DCO source
        CS->KEY = 0;
    
        // Set Flash Bank read buffering
        FLCTL_A->BANK0_RDCTL &= ~(FLCTL_A_BANK0_RDCTL_BUFD | FLCTL_A_BANK0_RDCTL_BUFI);
        FLCTL_A->BANK1_RDCTL &= ~(FLCTL_A_BANK0_RDCTL_BUFD | FLCTL_A_BANK0_RDCTL_BUFI);
    
        #elif (__SYSTEM_CLOCK == 12000000)                                // 12 MHz
        // Default VCORE is LDO VCORE0 so no change necessary
    
        // Switches LDO VCORE0 to DCDC VCORE0 if requested
        #if __REGULATOR
        while((PCM->CTL1 & PCM_CTL1_PMR_BUSY));
        PCM->CTL0 = PCM_CTL0_KEY_VAL | PCM_CTL0_AMR_4;
        while((PCM->CTL1 & PCM_CTL1_PMR_BUSY));
        #endif
    
        // No flash wait states necessary
    
        // DCO = 12 MHz; MCLK = source
        CS->KEY = CS_KEY_VAL;                                                         // Unlock CS module for register access
        CS->CTL0 = CS_CTL0_DCORSEL_3;                                                  // Set DCO to 12MHz
        CS->CTL1 &= ~(CS_CTL1_SELM_MASK | CS_CTL1_DIVM_MASK) | CS_CTL1_SELM__DCOCLK;  // Select MCLK as DCO source
        CS->KEY = 0;
    
        // Set Flash Bank read buffering
        FLCTL_A->BANK0_RDCTL &= ~(FLCTL_A_BANK0_RDCTL_BUFD | FLCTL_A_BANK0_RDCTL_BUFI);
        FLCTL_A->BANK1_RDCTL &= ~(FLCTL_A_BANK0_RDCTL_BUFD | FLCTL_A_BANK0_RDCTL_BUFI);
    
        #elif (__SYSTEM_CLOCK == 24000000)                                // 24 MHz
        // Default VCORE is LDO VCORE0 so no change necessary
    
        // Switches LDO VCORE0 to DCDC VCORE0 if requested
        #if __REGULATOR
        while((PCM->CTL1 & PCM_CTL1_PMR_BUSY));
        PCM->CTL0 = PCM_CTL0_KEY_VAL | PCM_CTL0_AMR_4;
        while((PCM->CTL1 & PCM_CTL1_PMR_BUSY));
        #endif
    
        // 2 flash wait state (BANK0 VCORE0 max is 24 MHz)
        FLCTL_A->BANK0_RDCTL &= ~FLCTL_A_BANK0_RDCTL_WAIT_MASK | FLCTL_A_BANK0_RDCTL_WAIT_2;
        FLCTL_A->BANK1_RDCTL &= ~FLCTL_A_BANK0_RDCTL_WAIT_MASK | FLCTL_A_BANK0_RDCTL_WAIT_2;
    
        // DCO = 24 MHz; MCLK = source
        CS->KEY = CS_KEY_VAL;                                                         // Unlock CS module for register access
        CS->CTL0 = CS_CTL0_DCORSEL_4;                                                  // Set DCO to 24MHz
        CS->CTL1 &= ~(CS_CTL1_SELM_MASK | CS_CTL1_DIVM_MASK) | CS_CTL1_SELM__DCOCLK;  // Select MCLK as DCO source
        CS->KEY = 0;
    
        // Set Flash Bank read buffering
        FLCTL_A->BANK0_RDCTL |= (FLCTL_A_BANK0_RDCTL_BUFD | FLCTL_A_BANK0_RDCTL_BUFI);
        FLCTL_A->BANK1_RDCTL &= ~(FLCTL_A_BANK0_RDCTL_BUFD | FLCTL_A_BANK0_RDCTL_BUFI);
    
        #elif (__SYSTEM_CLOCK == 48000000)                                // 48 MHz
        // Switches LDO VCORE0 to LDO VCORE1; mandatory for 48 MHz setting
        while((PCM->CTL1 & PCM_CTL1_PMR_BUSY));
        PCM->CTL0 = PCM_CTL0_KEY_VAL | PCM_CTL0_AMR_1;
        while((PCM->CTL1 & PCM_CTL1_PMR_BUSY));
    
        // Switches LDO VCORE1 to DCDC VCORE1 if requested
        #if __REGULATOR
        while((PCM->CTL1 & PCM_CTL1_PMR_BUSY));
        PCM->CTL0 = PCM_CTL0_KEY_VAL | PCM_CTL0_AMR_5;
        while((PCM->CTL1 & PCM_CTL1_PMR_BUSY));
        #endif
    
        // 3 flash wait states (BANK0 VCORE1 max is 16 MHz, BANK1 VCORE1 max is 32 MHz)
        FLCTL_A->BANK0_RDCTL &= ~FLCTL_A_BANK0_RDCTL_WAIT_MASK | FLCTL_A_BANK0_RDCTL_WAIT_3;
        FLCTL_A->BANK1_RDCTL &= ~FLCTL_A_BANK1_RDCTL_WAIT_MASK | FLCTL_A_BANK1_RDCTL_WAIT_3;
    
        // DCO = 48 MHz; MCLK = source
        CS->KEY = CS_KEY_VAL;                                                         // Unlock CS module for register access
        CS->CTL0 = CS_CTL0_DCORSEL_5;                                                  // Set DCO to 48MHz
        CS->CTL1 &= ~(CS_CTL1_SELM_MASK | CS_CTL1_DIVM_MASK) | CS_CTL1_SELM__DCOCLK;  // Select MCLK as DCO source
        CS->KEY = 0;
    
        // Set Flash Bank read buffering
        FLCTL_A->BANK0_RDCTL |= (FLCTL_A_BANK0_RDCTL_BUFD | FLCTL_A_BANK0_RDCTL_BUFI);
        FLCTL_A->BANK1_RDCTL |= (FLCTL_A_BANK1_RDCTL_BUFD | FLCTL_A_BANK1_RDCTL_BUFI);
        #endif
    
    }
    
    

  • Thank you for the clarification.   I was confused by the RTOS and TIRTOS in some of the different fields.  The MSP432P4111 requires wait-states to run at 48Mhz.  You should update your code as follows:

        MAP_WDT_A_holdTimer();
    
        /* Call Driver init functions */
        MPU_disableModule();
    
        /* Starting HFXT in non-bypass mode without a timeout. Before we start
         * we have to change VCORE to 1 to support the 48MHz frequency */
        MAP_PCM_setCoreVoltageLevel(PCM_VCORE1);
        MAP_FlashCtl_A_setWaitState(FLASH_A_BANK0, 3);
        MAP_FlashCtl_A_setWaitState(FLASH_A_BANK1, 3);
    
        CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_48);  // Put this in, and things crash
        CS_setReferenceOscillatorFrequency(CS_REFO_128KHZ);
        CS_initClockSignal(CS_ACLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_1);
        CS_initClockSignal(CS_SMCLK, CS_MODOSC_SELECT, CS_CLOCK_DIVIDER_1);
        Interrupt_disableSleepOnIsrExit(); // MDR_DEBUG: Disable sleep for now.
        FPU_enableModule();
        FPU_enableLazyStacking();

    I do not see anything immediately evident with the GPIO.  Please make sure that the variables being passed are consistent with the definition.

    /*
     * Definition
     * extern void GPIO_setAsOutputPin(uint_fast8_t selectedPort,
     *       uint_fast16_t selectedPins);
     */
    
        GPIO_setAsOutputPin(GPIO_PORT_P1,GPIO_PIN0);

    Finally, just as a matter of good practice, the driverlib code also resides in the device ROM.  By simply using the MAP_ prefix the driverLib library will determine whether to use a ROM or a FLASH based API.  

    Several of the examples use this format. 

    Regards,
    Chris

**Attention** This is a public forum