Skip to main content
AbidSulaiman
Associate II
April 11, 2019
Solved

STM32WB BLE advertising stops after exiting standby mode.

  • April 11, 2019
  • 6 replies
  • 4558 views

Hello,

I am currently on the (official) example application of BLE_p2pServer from STM32Cube_FW_WB_V1.0.0. I am trying to make it work with standby mode and I disabled the advertising timeout for this particular test.

BLE is still advertising when in standby mode (before waking up). But it stops after waking up.

EDIT: BLE actually stops advertising as soon as it enter standby mode.

if( (__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
 && (__HAL_PWR_GET_FLAG(PWR_FLAG_C2SB) != RESET)
 )
 {
 /* Clear Standby flag */
 __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
 __HAL_PWR_CLEAR_FLAG(PWR_FLAG_C2SB);
 }
 else {
 MX_RTC_Init();
 APPE_Init();
 }

From the code, i didnt reinitialize RTC and BLE after exiting standby mode as i thought the microcontroller starts from RESET after exiting standby mode.

The microcontroller will enter standby mode when the SCH_Idle() function is called.

void SCH_Idle( void )
{
#if ( CFG_LPM_SUPPORTED == 1)
 LL_C2_PWR_SetPowerMode(LL_PWR_MODE_STANDBY);
 HAL_PWREx_EnableSRAMRetention();
 HAL_PWR_EnterSTANDBYMode();
 Error_Handler();
#endif
 return;
}

Where do you think I went wrong? Thanks for the reply and help.

P/s: For now, I just use the NRST pin to wake up from standby. It is because when I use the RTC wakeup, I got some weird event where the microcontroller didnt enter standby mode again after exiting standby mode for the first time and went to the while loop in Error_Handler(). I didnt look deeper for this event yet. will post a question when I think I know where the error come from.

Best answer by Christophe Arnal

Hello,

The CM0+ wireless system does not support to operate in Standby Mode.

As long as you need BLE RF activity, the lowest low power mode that can be used is Stop Mode2.

When you do not have anymore BLE RF activity, You may decide to enter Standby mode.

When going out from Standby Mode, you shall reinitialize the CM0+ wireless system before sending any command ( BLE or System command).

So, Standby mode is not supported dynamically while RF activity is still running.

Standby Mode is supported only when there is no more activity on the CM0+ wireless system and shall be managed as a full reset with regard to the CM0+ wireless system which means that out of Standby Mode, you shall run a full initialization of the CM0+ wireless system before sending any command.

Regards.

6 replies

Christophe ArnalBest answer
ST Employee
April 11, 2019

Hello,

The CM0+ wireless system does not support to operate in Standby Mode.

As long as you need BLE RF activity, the lowest low power mode that can be used is Stop Mode2.

When you do not have anymore BLE RF activity, You may decide to enter Standby mode.

When going out from Standby Mode, you shall reinitialize the CM0+ wireless system before sending any command ( BLE or System command).

So, Standby mode is not supported dynamically while RF activity is still running.

Standby Mode is supported only when there is no more activity on the CM0+ wireless system and shall be managed as a full reset with regard to the CM0+ wireless system which means that out of Standby Mode, you shall run a full initialization of the CM0+ wireless system before sending any command.

Regards.

AbidSulaiman
Associate II
April 11, 2019

Hi @Christophe Arnal​ ,

Yeah I did try the Stop2 mode. Works well. But i thought RF is possible is standby mode based on this slide.

0690X000008ANDNQA4.png

And from this slide, I figured out I need to set the LPMS bit for CM0+ standby mode so that it will go into standby instead of only stop2.

0690X000008ANGvQAO.png

Anyway, you are a great help man. Thanks so much.

Regards.

ST Employee
April 11, 2019

Hello,

The STM32WB being a dual core MCU, it has to be perceived as a standalone MCU (CM4) + Radio(CM0+). Therefore the slides shows all the available power mode of the combo solution. This being said the current wireless firmware delivered on the radio CM0+ subsystem support low-power mode down to stop2 even if the MCU can go to lower power mode. In wireless use cases, the RF and CPUs activities are scheduled periodically so that the ratio between the active time and the idle time shows that the power saving between standby and stop2 is minor vs the benefit at application level to remain in stop2 (full ram retention, fast wake up time …). However we are very eager to learn more about your use case and the need of standby mode.

Regards.

Htzuh
Associate II
June 19, 2019

Excuse me, I tried to let stm32wb go into stop2 mode after BLE stopping advertising.

I add __HAL_PWR_CLEAR_FLAG(PWR_FLAG_STOP);

  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_C2STOP);

LL_PWR_WriteReg(C2CR1, 1UL);

  LL_PWR_WriteReg(CR1, 1UL);

EXTI->PR1 = 0x00000000;

HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);

after BLE stopping advertising , but the mcu didn't go into stop2 mode?

What some setting should I need to add?

Thanks.

chinmaydixit
Associate III
August 6, 2021

Where should I write these lines. Should I write these lines in void UTIL_SEQ_Idle( void ) or somewhere else?

Thanks in advance.

ST Employee
August 13, 2021

Hello,

There is nothing to add to provided example to enter stop mode and get the best low power consumption. Only some configuration are required to be changes in app_conf.h

Regards.

ST Employee
June 20, 2019

Hello,

In order to enter stop mode 2 with the p2p_server, you do not need to add any code. You just need to change some configuration in app_conf.h

You may check the BLE_HeartRate example which enable by defaults the low power mode.

Basically, you need to

Set CFG_DEBUGGER_SUPPORTED  to 0

Set CFG_DEBUG_BLE_TRACE   to 0

Set CFG_DEBUG_APP_TRACE   to 0

Regards

RBara
Visitor II
September 18, 2019

Hello,

im currently trying to do the same as mentioned in this ticket , use advertising while in standby mode and it didnt work for me too. (stop2 works well)

if i try to go to standby while advertising it works until the next advertising interval, then wakes up to some middle stage and gets stuck.

i understand from this corresponding that the current cm0 firmware (as to 5 months ago) does not support it.

is this possibly changed or updated since then? or is it simply not impossible use advertising while in standby mode?

Thanks.

Visitor II
September 10, 2024

what If i wanted to switch off core2 (shutdown) where wireless stack is running for ble and also disable/off all BLE related activity and how to wakeup from shutdown mode of core2? and if i wanted to wake up from button interrupt please if anyone has code sequence for that reply it here.
MCU is stm32wb5mmgh6tr