cancel
Showing results for 
Search instead for 
Did you mean: 

Stop modes and low power modes

Mohamed Aly
Associate

Hello,

I'm using the the official example of CubeMX P2P_server and I want to enter stop2 mode during advertising to minimize the current consumption like this:

void SCH_Idle(void) {
LL_C2_PWR_SetPowerMode(LL_PWR_MODE_STOP2);
HAL_PWREx_EnableBLEActivityIT();
HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
return; 
}

However, I have noticed that the processor doesn't enter the stop2 mode and current consumption for the processor only is about 1.25 mA which is High compared with the datasheet values!

2 REPLIES 2
Christophe Arnal
ST Employee

Hello,

In the example, LPM_EnterModeSelected(); is called from SCH_Idle() and the only thing to do to enable the low power mode is to

set CFG_DEBUGGER_SUPPORTED to 0

set CFG_DEBUG_BLE_TRACE to 0

set CFG_DEBUG_APP_TRACEto 0

in app_config.h

You may check the BLE_HeartRate application which is the only one which by default is configured to get the best power consumption ( debugger removed, traces removed, etc...)

Otherwise, here are two feedback on the implementation you made

1/ LL_C2_xx API are accessing CPU2 register and this shall never be done from CPU1. The CPU2 has its own power management. Any change to C2 register from the CPU1 may corrupt the behavior of the CPU2.

2/ The way to implement it would have been to add only

HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);

But in that case, you will enter always Stop Mode 2 when there is no code to be executed on CPU2 and you will be missing all cases when you need to enter only Sleep Mode to keep the clock running ( eg for a DMA transfer ongoing)

I would recommend to get back to the original code to get everything already available.

Of course, it is perfectly possible to change this in case you are running a specific implementation that never needs to use Sleep Mode.

Regards

RPowe.9.306
Associate III

I know this is an old thread but I am trying to get a BLE application with lowest current and found this thread. I am running the BLE_HeartRate project and there isn't a SCH_Idle. I have found UTIL_SEQ_Idle and call HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI) from this. It doesn't appear to drop power at all, it runs at 318uA continually.

Is there a newer version of BLE_HeartRate because I pulled this up in CubeMX.