cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB set CPU sleep for low power consumption

sarveshdhar
Associate

Hi,

I use an STM32WB chipset for my device and my application reads sensor data and sends over the BLE when the device is connected. When the device gets disconnected then after 30 seconds it should STOP BLE advertisement and RF also, go to CPU sleep and wait for GPIO interrupt to wake. I have tested a development for CPU sleep when BLE is not enabled and it is working fine, The CPU goes to sleep and wakes on GPIO interrupt, but after enabling the BLE, it is not going to sleep.

 

 

 

void cpu_sleep(){
	if(cpu_running_status == BA_ENABLE){
		cpu_running_status = BA_DISABLE;
		HAL_SuspendTick();
		LL_PWR_SetPowerMode( LL_PWR_MODE_STOP2 );
  		LL_LPM_EnableDeepSleep( ); /**< Set SLEEPDEEP bit of Cortex System Control Register */
  		__WFI();
	}
}
void cpu_wakeup(){
	if(cpu_running_status == BA_DISABLE){
		cpu_running_status = BA_ENABLE;
		HAL_ResumeTick();
		HAL_Delay(10);
	}
}

 

 

Here I have added the snippet of code which is working fine without BLE 

1 REPLY 1
Lubos KOUDELKA
ST Employee

Hello,
from your description I would suspect, that BLE is not properly deactivated and CPU2 is blocking entering low power mode.
Please check example STM32WB-BLE-standby. In this example after short advertising period BLE is disabled and MCU is put into standby mode. I believe part of the setting from this example could be applicable in your case.

Best regards,
Lubos