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: MSP432 Compilation, including MAP_

Part Number: MSP432P401R
Other Parts Discussed in Thread: MSP432WARE, MSP430FR5994

Tool/software: Code Composer Studio

I am trying to compile an MSP432 program. I have downloaded MSP432Ware and added a link in the Project Properties Include pointing to it

c:\ti\msp\MSPWare_3_50_00_02\driverlib\driverlib\MSP432P4xx

The first errors are in the following module. Note that the first "while" is line 245. I am probably doing something stupid.

void config_CLOCK48MHZ(void)  //SMCLK CONFIGURAATION from the Driverlib
{
    while ((PCM->CTL1 & PCM_CTL1_PMR_BUSY)) ();             // Change Vcore to 1 to support 48 MHz
    PCM->CTL0 = PCM_CTL0_KEY_VAL | PCM_CTL0_AMR_1;          // Transition to VCORE Level 1 from current power state properly
    while ((PCM->CTL1 & PCM_CTL1_PMR_BUSY)) ();
    MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_PJ,
    GPIO_PIN3 | GPIO_PIN4, GPIO_PRIMARY_MODULE_FUNCTION);   // Pins for peripheral/crystal usage
//    MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0);     // need a pin to observe mclk??
    CS_setExternalClockSourceFrequency(32000, 48000000);
//    MAP_PCM_setCoreVoltageLevel(PCM_VCORE1);                // VCORE to 1 to support the 48 MHz frequency
    MAP_FlashCtl_setWaitState(FLASH_BANK0, 1);              // may need fewer wait states with more recent silicon.. check
    MAP_FlashCtl_setWaitState(FLASH_BANK1, 1);
    CS_startHFXT(false);                                    // Starting HFXT in non-bypass mode without a timeout
    MAP_CS_initClockSignal(CS_MCLK, CS_HFXTCLK_SELECT, CS_CLOCK_DIVIDER_1); // Initializing MCLK to HFXT (effectively 48MHz)
    MAP_CS_initClockSignal(CS_SMCLK,CS_HFXTCLK_SELECT, CS_CLOCK_DIVIDER_4); // 12MHz
}

with the following errors:

>> Compilation failure
subdir_rules.mk:9: recipe for target 'main.obj' failed
"../main.c", line 245: error #29: expected an expression
"../main.c", line 247: remark #1528-D: (ULP 3.1) Detected flag polling using PCM_CTL1_PMR_BUSY. Recommend using an interrupt combined with enter LPMx and ISR
"../main.c", line 247: error #29: expected an expression
"../main.c", line 248: warning #225-D: function "MAP_GPIO_setAsPeripheralModuleFunctionOutputPin" declared implicitly
and more errors in later modules.

Since I am new to MSP432 driverlib, I don't know what expression is missing from line 245. Also, I guess that I need to do something more to make "MAP_" work correctly.

  • Sorry... there were more errors relating to this module, so something is fundamentally wrong:
    subdir_rules.mk:9: recipe for target 'main.obj' failed
    "../main.c", line 245: error #29: expected an expression
    "../main.c", line 247: error #29: expected an expression
    "../main.c", line 248: warning #225-D: function "MAP_GPIO_setAsPeripheralModuleFunctionOutputPin" declared implicitly
    "../main.c", line 248: error #20: identifier "GPIO_PORT_PJ" is undefined
    "../main.c", line 249: error #20: identifier "GPIO_PIN3" is undefined
    "../main.c", line 249: error #20: identifier "GPIO_PIN4" is undefined
    "../main.c", line 249: error #20: identifier "GPIO_PRIMARY_MODULE_FUNCTION" is undefined
    "../main.c", line 251: warning #225-D: function "CS_setExternalClockSourceFrequency" declared implicitly
    "../main.c", line 253: warning #225-D: function "MAP_FlashCtl_setWaitState" declared implicitly
    "../main.c", line 253: error #20: identifier "FLASH_BANK0" is undefined
    "../main.c", line 254: error #20: identifier "FLASH_BANK1" is undefined
    "../main.c", line 255: warning #225-D: function "CS_startHFXT" declared implicitly
    "../main.c", line 256: warning #225-D: function "MAP_CS_initClockSignal" declared implicitly
    "../main.c", line 256: error #20: identifier "CS_MCLK" is undefined
    "../main.c", line 256: error #20: identifier "CS_HFXTCLK_SELECT" is undefined
    "../main.c", line 256: error #20: identifier "CS_CLOCK_DIVIDER_1" is undefined
    "../main.c", line 257: error #20: identifier "CS_SMCLK" is undefined
    "../main.c", line 257: error #20: identifier "CS_CLOCK_DIVIDER_4" is undefined
  • point the include path to the driverlib header files.
  • > while ((PCM->CTL1 & PCM_CTL1_PMR_BUSY)) (); // Change Vcore to 1 to support 48 MHz

    I could be fooled by the font here, but those look like parentheses. I'm guessing they were intended to be braces. Try:

    > while ((PCM->CTL1 & PCM_CTL1_PMR_BUSY)) {} // Change Vcore to 1 to support 48 MHz

    Did this come from one of the TI examples?
  • Some discoveries:

    1. when I put the new "include" pointer into the project properties, I used "MSPWare" but I should have had "MSP432Ware". Once the correct search path was included, many more things started to work. Sorry for bothering anyone about this.

    and I needed, of course, to put       #include "driverlib.h"      in my     main.c     as well.

    2. the "while" statements had the correct brackets, but the "()" at the end, which I always use in "while" statements that are used to wait for the termination of some process, are apparently illegal here... so when I removed the "()" at the end, the statements compiled without errors.

    3. the next error requiring your expertise is

            SCB_SCR &= ~SCB_SCR_SLEEPONEXIT;                    // Wake up from sleep on exit from ISR

    The error msgs are:
    "../main.c", line 426: error #20: identifier "SCB_SCR" is undefined
    "../main.c", line 426: error #20: identifier "SCB_SCR_SLEEPONEXIT" is undefined

    So, I guess that some other include path must be used as well.... any suggestions?

  • This looks like the "classic" syntax, where the rest uses CMSIS. Try:

    > SCB->SCR &= ~SCB_SCR_SLEEPONEXIT_Msk; // Wake up on exit from ISR

    (I lifted this from example (SLAC698D) uart_03. I don't actually remember all these names.)
  • Bruce.... you did it! It's like magic.
    Can I bother you one more time and then I will take a few days to clear up all the minor bugs:
    PMMCTL0 = PMMPW | PMMSWPOR; // SW POR
    I guess this must be valid only for MSP430 since the compiler is objecting to it.
    Is this the equivalent for MSP432:
    ResetCtl_initiateSoftReset(void);
    There are apparently a number of commands to perform a S/W POR.
    Thanks so much
  • "PMMCTL0 = PMMPW | PMMSWPOR; // SW POR"

    it is for the PWM peripheral, which I don't think the msp432 has.

    also, the programming approach to those modules vary from toolchain to toolchain, and sometimes within a toolchain.
  • Bruce.... you did it! It's like magic.
    Can I bother you one more time and then I will take a few days to clear up all the minor bugs:
    PMMCTL0 = PMMPW | PMMSWPOR; // SW POR
    I guess this must be valid only for MSP430 since the compiler is objecting to it.
    Is this the equivalent for MSP432:
    ResetCtl_initiateSoftReset(void);
    There are apparently a number of commands to perform a S/W POR.
    Thanks so much
  • The Program now compiles, but does not link. I have two main problems.
    1. Most of the problems relate to the module shown in my first post on this thread.
    <Linking>

    undefined first referenced
    symbol in file
    --------- ----------------
    CS_initClockSignal ./main.obj
    CS_setExternalClockSourceFrequency ./main.obj
    CS_startHFXT ./main.obj
    FlashCtl_setWaitState ./main.obj
    GPIO_setAsPeripheralModuleFunctionOutputPin ./main.obj
    ResetCtl_initiateSoftReset ./main.obj

    remark #10372-D: (ULP 4.1) Detected uninitialized Port 1 in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.

    2. I get the following warning for EVERY port
    remark #10372-D: (ULP 4.1) Detected uninitialized Port 1 in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.

    but I have a module initializing all ports. Here is the section handling Port 1 (all this code worked on the MSP430 as far as I know).
    P1->DIR &= ~BIT3;
    P1->REN |= BIT3;
    P1->OUT |= BIT3;
    P1->IES &= ~BIT3;
    P1->IE |= BIT3;
    P1->DIR &= ~BIT2;
    P1->SEL1 &= ~BIT2;
    P1->SEL0 |= BIT2;
    P1->DIR |= (BIT0 | BIT1);
    P1->OUT &= ~(BIT0 | BIT1);
    // Unused pins
    P1->DIR |= ( BIT4 + BIT5 + BIT6 + BIT7); // used = 1.0/1.1/1.2/1.3
    P1->OUT &= ~( BIT4 + BIT5 + BIT6 + BIT7);

    BTW, I still must check that all pins used on the MSP430FR5994 launchpad are still usable on the MSP432P401R launchpad... I will adjust accordingly before downloading the executable to the MSP432 launchpad.

    If anyone can find the reason for these errors in linking, I'll be grateful.
  • OK... forget it. I have abandoned driverlib for this module and implemented it using register-level instructions. I will figure out what has gone wrong with GPIO in due course.

    Thanks.

**Attention** This is a public forum