cancel
Showing results for 
Search instead for 
Did you mean: 

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

JMara.5
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Remy ISSALYS
ST Employee

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

View solution in original post

4 REPLIES 4
Remy ISSALYS
ST Employee

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

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.

Hey Remy!

Do you have an example how to achieve this?

I'm facing somewhat the same situation.

Have you managed to do it ?
I am facing the same problem, I want to relaunch the advertising with a button push. I saw in my code that adv_cancel() does exist but not APP_BLE_StartAdv()