2019-04-11 01:43 AM
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.
Solved! Go to Solution.
2019-04-11 03:49 AM
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.
2019-04-11 03:49 AM
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.
2019-04-11 04:07 AM
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.
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.
Anyway, you are a great help man. Thanks so much.
Regards.
2019-04-11 10:07 AM
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.
2019-06-19 12:01 AM
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.
2019-06-20 04:57 AM
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
2019-09-18 03:53 AM
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.
2020-11-17 03:46 AM
@Christophe Arnal
According to the "Building wireless applications with STM32WB Series microcontrollers" document, "When the user application has to enter Standby mode, it must first stop all RF activities". Even if I use "LL_C2_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN)" the system doesn't enter Standby mode. I've also tried disabling the EXTI lines associated with CPU2:
LL_EXTI_DisableEvent_32_63( LL_EXTI_LINE_41 );
LL_C2_EXTI_DisableEvent_32_63( LL_EXTI_LINE_41 );
LL_EXTI_DisableRisingTrig_32_63( LL_EXTI_LINE_41 );
How could I de-initialize completely the RF activity & enter Standby Mode?
I mean, how can I "stop all advertising, scanning activity you may have started and disconnect all link"?
Thanks.
2020-11-18 02:33 AM
Hello,
There are two ways to stop all RF activities
1/ You use the provided API to stop any activity you started ( eg ACI_GAP_SET_NON_DISCOVERABLE() to stop the advertising you may have started upfront, ACI_GAP_TERMINATE() to disconnect a link if you have been connected, etc...)
With this mehtode, you may restart BLE operation in case for any reason you finally did not enter standby mode
2/ You may send the command ACI_HAL_STACK_RESET(). However, if you finally dont enter standby and decide to use again the BLE, you will need to restart a full initialization of the BLE Stack ( eg SHCI_C2_BLE_Init(), aci_gatt_init(), etc ... so basically everything which has been done in APP_BLE_Init() except Ble_Tl_Init()
Regards.
2020-11-18 04:13 AM
Hi @Christophe Arnal , thank you for your fast answer. The thing is that I am not using Bluetooh. I am just using the MAC IEEE Std 802.15.4-2011 layer to send/receive messages. Is there any similar function to stop the RF activity?