guilionzo wrote on Sunday, June 23, 2019:

Hello Everybody,

I try to put the MSP432 in PCM_LPM0_LDO_VCORE0 mode , using PCM_setPowerState, but the code just keeping running the code. I don’t know what I’m doing wrong.

Has anyone passed through this before?
Thank you!

I’m using the FreeRTOS DEMO code.
code: https://github.com/guilionzzo/firmware_onBoardComputer/blob/master/src/taskManager.c

rtel wrote on Sunday, June 23, 2019:

I don’t know anything about the code you are linking to so my answer is

How the system will behave will depend on what the low power mode is
doing and the clock used to generate the tick interrupt. If you just
leave the clock that generates the tick interrupt running, and the low
power mode also keeps the clock running, then you will most likely leave
low power mode whenever the next tick interrupt occurs. I’m afraid I
don’t know which clock you are using to generate the tick or what
PCM_LPM0_LDO_VCORE0 does so suggest having a look at the following for
more info: https://www.freertos.org/low-power-tickless-rtos.html

guilionzo wrote on Sunday, June 23, 2019:

Hi Richard,

I set the interrupt on INT_PORT1, as shown in the code below. Even I specified what source will generate the interrupt, Do I have to disable the Systick Clock?

If it was a dumb question, my apologies. I don’t have much experience with this kind of application.

Thank you for the quick reply.

hibernate code:

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

rtel wrote on Sunday, June 23, 2019:

Where are you putting the MCU into low power mode? Are you using the FreeRTOS tickless idle mode as described on the link in my previous post? If so, are you using the default tickless mode on an msp432 specific one. Apologies but replying on my cell/mobile/handy phone so can’t see all links.

guilionzo wrote on Sunday, June 23, 2019:

Don’t worry my friend, you are really helping me in the issue, even if I do not see the links.

I was putting the MCU in low power mode using the PCM_setPowerState(). Now I understand the situation better :D. The xMaximumPossibleSuppressedTicks is very low, 349 ticks. Instead of put MCU in low power mode I used vPortSuppressTicksAndSleep() in a wrapper function [CODE1]. It is working, but I’d like to put the microcontroller in a non-working state.

I saw the link that you sent and the Low Power RTOS For ARM Cortex-M MCUs material, but I’m bit confused whether I can configure two SysTick sources. Is it possible to use two SysTick sources? One used when the MCU needs more power and another when the hibernate mode is required.

I appreciate your help.


void hibernate(uint8_t time_ms)

    int clockFrequency = 48000000;  //48MHz
    int tickRateHZ = 1000;           //1KHz

    int timerCountsForOneTick = (clockFrequency / tickRateHZ); // 48000 - timer for one tick 20,8ms
    int maximumPossibleSuppressedTicks = portMAX_24_BIT_NUMBER
            / timerCountsForOneTick 349 ticks;
    int iterations = time_ms / maximumPossibleSuppressedTicks;
    int i = 0;

    for (i = 0; i < iterations; i++)
        vPortSuppressTicksAndSleep(maximumPossibleSuppressedTicks); // loop to complete the time

rtel wrote on Sunday, June 23, 2019:

The default tickless idle operation does not use tick sources, but if
you provide your own ‘suspend and sleep’ function as per the link I
posted then you can just stop SysTick all together and configure
whichever clock you want to bring the MCU out of low power mode at the
appropriate time.

I’m still not clear where you are placing the MCU into low power mode
as if you are using the ‘suspend and sleep’ function it should be called
by the kernel, not you, and it won’t call PCM_setPowerState() unless you
have already customised the sleep functions for your particular MCU.