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/MSP432P4011: TI Drivers Power_init() don't return

Part Number: MSP432P4011
Other Parts Discussed in Thread: CC3120

Tool/software: Code Composer Studio

Hello,

I try to make the simplelink WiFi plug-in to work with MSP432P4011 and CC3120 in a non-OS environment. It works with the MSP-EXP432P401R Development Kit but on my platform with MSP432P4011 it's a nightmare. The first problem encountered is at the initialization of TI drivers: Power_init() doesn't return.

Here is my (simplified) main function:

int main(void) {
	// Stop watchdog timer
	WDT_A_holdTimer();
	Power_init();
	while(1);
}

And the structure to configure the Power Driver:

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

If I step into Power_init() in debug mode, the problem occurs at line 1639 in initPerfControl(), in PowerMSP432.c file:

            SET_WAIT_STATES(BANK0, perfNew.flashWaitStates);


I can not display the value of perfNew.flashWaitStates (identifier not found) and I can't step into the SET_WAIT_STATES() function.

Right after this line the program jumps in Default_Handler().

Please help.

NB: simplelink_msp432p4_sdk_2_30_00_14 and simplelink_sdk_wifi_plugin_1_60_00_07 are installed and I use the latest CCS 8.2.

  • Hello Pierre,
    could you try to run Power_init() from Flash? That should help to see values you need.
    Please, remember to turn off code optimization.
  • Hello Tomasz,

    Thank you for the answer. Optimization is turned off for my code (I use -O0 or -Og) but for the TI libraries I don't know.
    The code of Power_init() comes from the SDK library "drivers_msp432p401x.am4fg". Maybe it's not the good file to include?
    Maybe it's better if I include the source files and not the pre-compiled library?

    How can I run Power_init() from flash?

    Thanks,
    Pierre.
  • Pierre Bellier said:
    Maybe it's better if I include the source files and not the pre-compiled library?

    Do it. 

    Pierre Bellier said:
    How can I run Power_init() from flash?

    Like above or check section DriverLib in ROM here: dev.ti.com/.../

     

  • OK, thank you.

    I removed the MAP_ prefix at the define to FlashCtl_xxx() functions on top of PowerMSP432.c file and now it seems to work. The program is not blocked in Power_init() anymore.

    So the problem seems to be located in the TI library code in ROM. It's better not to trust TI code. I really don't like the way TI libraries are designed. It's really confusing.

    Thanks again for the help,
    Pierre.
  • Please, remember that the goal is low power and no assembler anywhere it is possible.

    ROM is faster and uses less power. 

  • You have missed something:

    Tom,
    I would recommend looking into how the wait-states are applied. This device (P4011) has a slightly different flash configuration and if the project symbols have not been updated from the MSP432P401R to the MSP432P4011, then the wrong wait-states will be applied in PowerMSP432.c .

    Regards,
    Chris
  • I think symbols are ok, I created a new Empty Project with target MSP432P4011 selected.

    The following symbols are defined in the project properties:

      DeviceFamily_MSP432P401x
      __MSP432P4011__
      gcc

    main.c:

    #include <ti/devices/msp432p4xx/driverlib/driverlib.h>
    #include <NoRTOS.h>
    #include <ti/drivers/Power.h>
    #include <ti/drivers/power/PowerMSP432.h>
    
    #include "msp.h"
    
    const PowerMSP432_ConfigV1 PowerMSP432_config = {
        .policyInitFxn = &PowerMSP432_initPolicy,
        .policyFxn = &PowerMSP432_sleepPolicy,
        .initialPerfLevel = 2,
        .enablePolicy = true,
        .enablePerf = true,
        .enableParking = true
    };
    
    int main(void)
    {
    	WDT_A_holdTimer();
    	Power_init();
    	while(1);
    }
    

    Inside Power_init(), both call of MAP_FlashCtl_setWaitState() and FlashCtl_setWaitState() are with the same arguments (BANK0/1, 1). Only the second one works.

  • Pierre,
    If you are running at performance level 2, then the core is running at 48Mhz and the number of wait-states should be 3 for this device. If you are using the MSP432P401R then it would be 1. If you set the waitstate to '1' at 48Mhz with the MSP432P4011 performance will be unpredictable.

    Please look at the nortos examples for this family of devices.

    #ifndef DeviceFamily_MSP432P4x1xI
    #define DeviceFamily_MSP432P4x1xI
    #endif

    Chris
  • Hello Chris,

    I totally agree with you, wait state should be 3. But it's not the same issue. If I modify the source code in PowerMSP432.c to force a wait state of 3 the problem remains the same.

    What's the best solution to make the library use the correct value? It's bad practise to modify the library source code.

    Regards,
    Pierre.
  • Pierre,
    Please confirm that we are looking at the same issue.

    In your previous post you mention that this definition is in the project settings: DeviceFamily_MSP432P401x . This is not correct. If you look into DeviceFamily.h you will see that this definition will set the DeviceFamily_ID to the incorrect device (MSP432P401R).

    In your initial post, you mention this is a non-OS example. If you look at this non-rtos example you will see how the device family definition is handled in the source file.

    C:\ti\simplelink_msp432p4_sdk_2_30_00_14\examples\nortos\MSP_EXP432P4111\drivers\pwmled2



    If you make changes to the PowerMSP432.c file you would need to rebuild the library.

    Regards,
    Chris

  • I change to use the libraries for DeviceFamily_MSP432P4x1xI and it seems to work. Thank you.

    As it is still a bit confusing which device family to choose, please confirm which DeviceFamily need to be defined when working with MSP432P4011 microcontroller. What's the difference between DeviceFamily_MSP432P4x1xI and DeviceFamily_MSP432P4x1xT. Why choose the "I" version?

    The title of the datasheet of MSP432P4011 is "MSP432P411x, MSP432P401x SimpleLink™ Mixed-Signal Microcontrollers". So I thought it was good to choose DeviceFamily_MSP432P401x (there is no DeviceFamily_MSP432P411x).

    The better would be to add automatically the good symbols when creating a new project in Code Composer Studio with MSP432P4011 as target.

    Thanks,

    Pierre.

**Attention** This is a public forum