This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

What is the recommended advertising procedure for ease of use and minimal power usage?

I'm working on a battery powered device that only has a single button and two leds.  I need to make the pairing process as simple as possible.  I have studied several different sample applications and I'm unclear of the recommended method for initiating advertising.

Since this device only has 1 button (and no other switches)  the initial and default state must be not advertising, to conserver power.

When the user presses the button, I think the device should advertise for a certain length of time....

  0) Should I use 30 seconds duration?  Should I make different advertising modes like in the HIDDev profile applicaiton? 

  1) Is the recommended way to start the advertising procedure to use GAP_SetParamValue on attribute GAPROLE_ADVERT_ENABLED  ?

  2) I have also seen suggested in the forums that the app could directly use osal_set_event on peripheral.c event START_ADVERTISING_EVT, however this would require using the peripherals internals.

  3) How does the GAPROLE_ADV_FILTER_POLICY work?  Where can i find documentation on this feature?  Do I need it for non-secured communications?

 

Next upon achieving connected state.

  4) Should I disable the GAPROLE_ADVERT_ENABLED attribute ?

  5) In some apps there is an event that re-enables the advertising called SBP_ADV_IN_CONNECTION_EVT  ,  what is the purpose of this?  Does it improve the connection reliability?  Does it consume power?

 

Second if a connection is not established.

  6) Will the stack automatically disable GAPROLE_ADVERT_ENABLED ? 

  7)  Should I disable GAPROLE_ADVERT_ENABLED?

  8) If I don't disable GAPROLE_ADVERT_ENABLED  and I wish to restart advertising  what is the recommended procedure?

Third if connected and the disconnecting with new state GAPROLE_WAITING_AFTER_TIMEOUT.

  9) Does this most likely mean the device has moved out of range?

  10) Will the stack automatically reconnect with the central device ?

  11) Do I need to enable GAPROLE_ADVERT_ENABLED to reconnect to the central sever ?

If these questions are already well covered could you please provide a URL where I can become more informed?

  • For my first test I am initiating advertising with the following:

    GAP_ADTYPE_FLAGS_LIMITED in the advertising data.

    GAPROLE_ADVERT_OFF_TIME == 0

    GAPROLE_ADVERT_ENABLED == TRUE

    According to the comments this should advertising for 30 seconds. However based on GapRole notficiations from peripheral.c, it seems the GAPROLE_ADVERTISING state lasts for 3 minutes instead of 30 seconds.

    Is this a bug or is the comment wrong?  Is the advertising stopping after 30 seconds?

  • Additional testing...during the extended 3 minutes in the GAPROLE_ADVERTISING  state The radio is advertising the entire time.  So it seems the comment in the code about 30.72 seconds is wrong.  It advertises for 180 seconds.

  • The change from 30 seconds to 180 seconds was brought up in this thread:

    http://e2e.ti.com/support/low_power_rf/f/538/p/236961/830730.aspx#830730

    Also the explanation of TGAP_LIM_ADV_TIMEOUT  (as maximum time for limited advertising) is in this thread:

    http://e2e.ti.com/support/low_power_rf/f/538/p/85623/599426.aspx#599426

    Could these be added to the wiki/faq ?

    Are there any standard definitions for the advertisement interval?  Default is advertise every 100mS...are there any reasons to adjust this value?

  • Good idea. It's been added to the wiki.

    With regards to intervals, see the Bluetooth core spec (link on bottom of wiki), Vol 3, Part C(GAP), Chapter 16. Some updates also exist in the addendums and supplements.

    Best regards,
    Aslak 

  • Hi Aslak! 

    Do you have any information on the ADV_IN_CONNECTION_EVT code that exists in some of the sample projects?  What is the purpose of enabling advertising during the connection?

  • Oh my god Anthony, you are a saviour. Thank you.

    I've spent the day wondering why I can't get the advertising to stop after 30 seconds as the code states that it should.

    I thought i'd broken something.

    1 line of code and it's working.

     

    Thank you.

  • I tested the SBP_ADV_IN_CONNECTION_EVT to try to advertise while in connection, what happening is that :

    Slave loses connection just before starting advertising ... I know that the BLE Spec allow us to do advertising while connected, but with my test, it doesn't work