Skip to main content
JMara.5
Associate
May 13, 2022
Solved

How to periodically turn on and off the BLE advertising on the STM32WB?

  • May 13, 2022
  • 1 reply
  • 2122 views

I want to be able to run on battery and turn on the BLE to advertise for 5 minutes then stop. After some time, I want to be able to turn on advertising again. I'm able to initially start the advertising and start the timer to stop advertising. However, I can't seem to find a way to wakeup CPU2 to start advertising again.

I'm using the function to start a 5 minute timer to stop the advertising:

HW_TS_Start(BleApplicationContext.Advertising_mgr_timer_Id, gAdvertisingConnectionTimeout);

Once the timer expires it calls Adv_Cancel() which stops the advertising, aci_gap_set_non_discoverable(). Since the Sequencer is IDLE, it sends the CPU2 into Stop2 mode.

What are the steps to get it out of the Stop2 mode and start advertising again?

Best answer by Remy ISSALYS

Hello,

You can start a timer when you stop the advertising in order to be able to restart advertising after a timeout. You can also use a button or other event to get out of Stop2.

Best Regards

1 reply

Remy ISSALYS
Remy ISSALYSBest answer
Technical Moderator
May 18, 2022

Hello,

You can start a timer when you stop the advertising in order to be able to restart advertising after a timeout. You can also use a button or other event to get out of Stop2.

Best Regards

JMara.5
JMara.5Author
Associate
May 19, 2022

Thank you! This worked after calling HW_TS_Start() to start a timer. In this timer callback function I have it starting up the advertising again by calling APP_BLE_StartAdv(). At first I was trying to wakeup Core2 by calling LL_C2_PWR_WakeUp_BLE() but it wasn't working.