Skip to main content
Associate
February 12, 2025
Solved

STM32WB09 deepstop mode

  • February 12, 2025
  • 2 replies
  • 973 views

Hello,

I am working with a STM32WB09KE mcu on a custom pcb. I am trying to write a softwareloop that measures something every x min and afterwards goes into deepstop mode. I was following some online documentation, but it seems like the wb09-series is not represented alot. Currently I have configured the RTC to generate an alarm at every 5 minutes (at 12:05:00, 12:10:00, etc exact). This interrupt is confirmed to be working.

Now I am writing a function to enter deepstop mode in the main loop based on some examples online. Currently I have this:

void Enter_DeepStopMode(void)
{
 __HAL_PWR_CLEAR_FLAG(PWR_WU_FLAG_ALL);

 HAL_SuspendTick();

 __HAL_RCC_LSI_ENABLE();

 HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);

 HAL_ResumeTick(); 

 SystemClock_Config();
}

 The problem is that the compiler (using STM32CubeIDE) does not find this function and argument 'HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);'
I'm not sure if the wb09 can use this function. I have looked through the examples in the wb09 firmware repository and there the following is used:

 HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0xFFFF, RTC_WAKEUPCLOCK_RTCCLK_DIV16);
 sConfigDEEPSTOP.deepStopMode = PWR_DEEPSTOP_WITH_SLOW_CLOCK_ON;
 /* Enter the Deepstop mode */
 HAL_PWR_ConfigDEEPSTOP(&sConfigDEEPSTOP);
 HAL_PWR_EnterDEEPSTOPMode();

 Is this the correct way to enter deepstop mode and if so, will this work with my rtc alarm if i remove the 'HAL_RTCEx_setwakeuptimer line or do I need to configure something else if I want to use the alarm interrupt?

best regards

Best answer by STTwo-32

Hello @jens0501 

the functions HAL_PWREx_EnterSTOP0Mode(), HAL_PWREx_EnterSTOP1Mode() and HAL_PWREx_EnterSTOP2Mode() are not implemented on the STM32CubeWB0. So, I suggest you use the same method as the PWR_DEEPSTOP and the PWR_DEEPSTOP_RTC. Also, I've escalated this to the concerned team to updated the UM3363. (Under internal ticket number 205073). For adding the UM3363 to the STM32CubeWB0 web page, I've sent this request to the concerned team. 

Best Regards.

STTwo-32

2 replies

Andrew Neil
Super User
February 12, 2025

@jens0501 wrote:

I'm not sure if the wb09 can use this function. rds


That should be answered by looking in the HAL User Manual for the STM32CubeWB0 software package.

But there is no full User Manual listed - just a Getting Started guide:

AndrewNeil_0-1739358646406.png

https://www.st.com/en/embedded-software/stm32cubewb0.html#documentation

@STTwo-32 - where is the full User Manual?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
jens0501Author
Associate
February 12, 2025

Hi Andrew,

I found the HAL user manual here: https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://www.st.com/resource/en/user_manual/DM01082059.pdf&ved=2ahUKEwjYpozfgL6LAxVcR6QEHTXbOIMQFnoECBkQAQ&usg=AOvVaw1jR9shtM4pG7LTVwDupZdS

HAL_PWREx_EnterSTOP2Mode() is mentioned there under the following section:
STM32WB0 low-power management features:
– HAL_PWREx_EnterSTOP0Mode()
– HAL_PWREx_EnterSTOP1Mode()
– HAL_PWREx_EnterSTOP2Mode()
– HAL_PWREx_EnterSHUTDOWNMode()

But this is the only occurrence of this function in the whole document. So I think it should work on the wb09 according to the document, however I (and the compiler) cannot find this function in the firmware.

 

Andrew Neil
Super User
February 12, 2025

Good find.

Link without the Google tracking stuff: https://www.st.com/resource/en/user_manual/DM01082059.pdf 

You're right: Section 24, HAL PWR Extension Driver, just lists a load of defines - it has no function documentation.

So another one for @STTwo-32:

  1. Why is this manual not listed on the Product Page?
  2. Why is it incomplete?

 

If you use the IDE's 'Go To Definition' feature, there should be comments in the source documenting the function ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
STTwo-32
STTwo-32Best answer
Technical Moderator
March 11, 2025

Hello @jens0501 

the functions HAL_PWREx_EnterSTOP0Mode(), HAL_PWREx_EnterSTOP1Mode() and HAL_PWREx_EnterSTOP2Mode() are not implemented on the STM32CubeWB0. So, I suggest you use the same method as the PWR_DEEPSTOP and the PWR_DEEPSTOP_RTC. Also, I've escalated this to the concerned team to updated the UM3363. (Under internal ticket number 205073). For adding the UM3363 to the STM32CubeWB0 web page, I've sent this request to the concerned team. 

Best Regards.

STTwo-32