cancel
Showing results for 
Search instead for 
Did you mean: 

STM32_WPAN BLE Stops advertising after connection

cvlt
Associate II

Hi,

not really an issue here, but I want to understand what goes on in my BLE project.

I'm using the B-WB1M-WPAN board, starting out from the BLE_HR_p2pSensor example.

I see that my device stops advertising after I connect to it, but I can't find in the code where that happens.

I discovered that the functions:

  • Adv_Request (through api_gap_set_discoverable)
  • Adv_Cancel (through api_gap_set_non_discoverable)

Are used to start and stop advertising.

I also noticed that Adv_Cancel is registered as callback for a task here:

 

 

 UTIL_SEQ_RegTask(1<<CFG_TASK_ADV_CANCEL_ID, UTIL_SEQ_RFU, Adv_Cancel);

 

 

But it seems that Adv_Cancel is never called nor CFG_TSK_ADV_CANCEL_ID is used in a UTIL_SEQ_SetTask call...
 
Nonetheless, by sniffing BLE traffic I see that after a connection my peripheral stops advertising.

I tried to look into guides and application notes but I can't find any explanation for this behaviour, can you please help me?
1 ACCEPTED SOLUTION

Accepted Solutions
STTwo-32
ST Employee

Hello @cvlt 

After putting the device in generale discoverable mode using the ACI_GAP_SET_DISCOVERABLE command, the device shall remain in general discoverable mode until a connection is established or the Host terminates the mode (using ACI_GAP_SET_NON_DISCOVERABLE command). So, the advertisement will stop after establishing a connection. More details on the Bluetooth spec V6.0[Vol 3, Part C, 9.2.4].

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
STTwo-32
ST Employee

Hello @cvlt 

After putting the device in generale discoverable mode using the ACI_GAP_SET_DISCOVERABLE command, the device shall remain in general discoverable mode until a connection is established or the Host terminates the mode (using ACI_GAP_SET_NON_DISCOVERABLE command). So, the advertisement will stop after establishing a connection. More details on the Bluetooth spec V6.0[Vol 3, Part C, 9.2.4].

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.