cancel
Showing results for 
Search instead for 
Did you mean: 

Stand-By mode when RFWakeupCLK is LSE

Exeu
Associate II

Hi there,

if i try to set my stm32wb55cg into standby, it seems to only work if the RFWakeupCLK is HSE-DIV1024

void PeriphCommonClock_Config(void)
{
  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SMPS|RCC_PERIPHCLK_RFWAKEUP;
  PeriphClkInitStruct.RFWakeUpClockSelection = RCC_RFWKPCLKSOURCE_HSE_DIV1024;
  PeriphClkInitStruct.SmpsClockSelection = RCC_SMPSCLKSOURCE_HSE;
  PeriphClkInitStruct.SmpsDivSelection = RCC_SMPSCLKDIV_RANGE1;
  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
  {
    Error_Handler();
  }
}

If i set the RF-WakeupClock to LSE it gives me:

void PeriphCommonClock_Config(void)
{
  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SMPS|RCC_PERIPHCLK_RFWAKEUP;
  PeriphClkInitStruct.RFWakeUpClockSelection = RCC_RFWKPCLKSOURCE_LSE;
  PeriphClkInitStruct.SmpsClockSelection = RCC_SMPSCLKSOURCE_HSE;
  PeriphClkInitStruct.SmpsDivSelection = RCC_SMPSCLKDIV_RANGE1;

  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
  {
    Error_Handler();
  }
}

 

So if i now try to enter Standby, it seems like the minimum it is now doing something else but no STANDBY :(

So whenever i finish my BLE-Activity the IC should enter standby and stay there for 10 minutes.

My Code to enter the low power mode:

static void Adv_Mgr(void) {
  aci_gap_set_non_discoverable();

  HAL_ADC_MspDeInit(&hadc1);
  HAL_I2C_DeInit(&hi2c1);
  HAL_IPCC_MspDeInit(&hipcc);

  __HAL_RCC_GPIOC_CLK_DISABLE();
  __HAL_RCC_GPIOH_CLK_DISABLE();
  __HAL_RCC_GPIOB_CLK_DISABLE();
  __HAL_RCC_GPIOA_CLK_DISABLE();
  __HAL_RCC_GPIOE_CLK_DISABLE();

  UTIL_LPM_SetStopMode(1 << CFG_LPM_APP_BLE, UTIL_LPM_ENABLE);
  UTIL_LPM_SetOffMode(1 << CFG_LPM_APP_BLE, UTIL_LPM_ENABLE);

  HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
  if (HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 1000, RTC_WAKEUPCLOCK_CK_SPRE_16BITS) != HAL_OK) {
    Error_Handler();
  }
}

So this is working when the RFWakeupClock is HSE-DIV1024 but not with LSE.

I currently have no real clue why, i tried already so many different things -> regenerating the setup again and again with CubeMX but no success.

As soon as i set the rfwakeup clk to lse it somehow immediatly gets out of standby.

As attachment i provide a power graph:

Exeu_0-1718519769580.png

At around 4.7 sec you see the drop to standby (maybe), but then some wakeup happens and it goes up to RUN, and there it stays now forever.

 

3 REPLIES 3
Lubos KOUDELKA
ST Employee

Hi,
What are you trying to achieve in your application? Do you want to use RF as well while you're in LP mode? Have you checked STM32WB repository package for available examples, if some of those examples could fit for initial setting in your project?
In general, power modes where HSE is available are very limited - as showed in Table 23. Functionalities depending on the working mode of STM32WB reference manual, HSE is available only down to low power sleep mode (not available in stop, standby or shutdown mode, where LSE is still possible to use).
Power consumption you observe at ~4.7s cannot be standby, it's still too high - depending on the configuration you shall be able to reach <1 uA, you get for a while ~360 uA!

Best regards,
Lubos

Hi @Lubos KOUDELKA ,

Thanks for the answer. 

I try to achieve to set the device into standby fully. There should be no activity on BLE at this point. I only have a rtc running which should wake the board up after 10 minutes.

Hse I don't need therfor. 

If you have a look on my first snippet in line 5 you see the rfwakeup section set to hse_div_1024.

Only with that it is working an the controller is going to standby. I measured the consumption and it is around 0.7 uA.

But as soon as I change the RF wakeup clock to LSE the result is like shown in the last picture of my post. The controller then does not stay anymore in standby sadly.

I am a bit lost why this is happening. With RF wakeup clock hse it works, with LSE not.

In theory I would like to switch the RF wakeup clock to LSE because I think maybe this could reduce the power consumption even more.

So I saw one example on stm hotspot where the RF wakeup clock was set to LSE. I also tried taking over the code of this example where the entering of standby is prepared, but without success.

 

Lubos KOUDELKA
ST Employee

Hi,
thank you for details. Please check PWR examples for STM32WB55 nucleo board. There is also example PWR_STANDBY_RTC, which could directly fit your need.

In this example RF wakeup clock is not set at all, because CPU2 is not used/started at all in this example. As you mentioned, hotspot example STM32WB-BLE-standby is showing bit more complex scenario - first CPU2 is active and BLE is advertising, after some time CPU2 is deactivated and MCU is put into standby. Please try to compare those examples with your project, also in other configuration.
In your project without RF, HSE is not needed, there need to be some configuration missing, I believe examples will help you to find the difference.