2024-07-01 07:19 AM
hello every one
I'm still struggling with BLE and LPM
with your help I have a working stop2 project that goes correctly into stop mode
as I'm very low on current budget I'm planning to stop every thing for few sec and come back from stop mode by RTC do my stuff send few advertising packets and go back to stop
stop2 mode in datasheet is announced for around 2µA current
if I'm going into stop2 mode directly at startup in main without starting clock and peripheral
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Config code for STM32_WPAN (HSE Tuning must be done before system clock configuration) */
MX_APPE_Config();
/* Configure the system clock */
SystemClock_Config();
/* Configure the peripherals common clocks */
PeriphCommonClock_Config();
/* IPCC initialisation */
// MX_IPCC_Init();
/* Initialize all configured peripherals */
MX_GPIO_Init();
// MX_DMA_Init();
// MX_RTC_Init();
// MX_I2C1_Init();
MX_SPI1_Init();
// MX_LPUART1_UART_Init();
// MX_CRC_Init();
// MX_RF_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Init code for STM32_WPAN */
// MX_APPE_Init();
LL_RCC_MSI_Enable();
__HAL_FLASH_SET_LATENCY(FLASH_LATENCY_1);
while(__HAL_FLASH_GET_LATENCY() != FLASH_LATENCY_1);
while(!LL_RCC_MSI_IsReady());
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_MSI);
while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_MSI);
LL_RCC_HSE_Disable();
while(LL_RCC_HSE_IsReady());
LL_RCC_HSI_Disable();
while(LL_RCC_HSI_IsReady());
LL_PWR_SetPowerMode(LL_PWR_MODE_STOP2);
LL_LPM_EnableDeepSleep(); /**< Set SLEEPDEEP bit of Cortex System Control Register */
__WFI();
while(1);
if I'm' doing this I can achieve around 180µA of current consumption that mean's other part of PCB is using most of this.
so in a std simple app BLE if I'm canceling advertisement killing all connection and scans and when going into stop mode shutting down lpuart and other peripherals I should expect around 180µA too
unfortunately even if I'm calling aci_gap_set_non_discoverable(); before enable stop mode
my current draw is around 1.3mA
calling HAL_UART_MspDeInit(&hlpuart1); in PWR_EnterStopMode() (and it's init counter part when exiting stop mode obviously) make it fall just around 950µA that looks coherent with my direct to stop mode first test but it looks that I should cut something else that is powered on in MX_APPE_Init(); and can't cut off just by stopping advertising (when doing my first test shutting off all other peripherals looks not to change a lot on current and when shutting off SPI I get inconstant current consumption that get saw tooth profile and higher that not cutting it)
how can i just turn off all RF activity ??and all CPU2 activity by the same way ?? (I'm conscientious that I will no more wake-able by RF but ok).
thanks for any help or ideas
2024-07-11 09:01 AM
Hello @oga
If you want to disable the RF sub-system and CPU2, you have to use this function:
LL_PWR_DisableBootC2() and never call the LL_PWR_EnableBootC2(). Also, it is recommended to have the VDDRF connected to the VDD.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.