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.

[CC2640] How to control advertising time?

Other Parts Discussed in Thread: CC2640

Hello,

I'm using CC2640 and now I meet some problem.

I want GAP layer to do 30 seconds advertising and stop until I set gapRole_AdvEnabled = TRUE. Following is my setting: 

// Limited discoverable mode advertises for 30.72s, and then stops
// General discoverable mode advertises indefinitely
#define DEFAULT_DISCOVERABLE_MODE             GAP_ADTYPE_FLAGS_LIMITED

uint16_t advertOffTime = 30000;
 
GAPRole_SetParameter(GAPROLE_ADVERT_OFF_TIME, sizeof(uint16_t),
                         &advertOffTime);

But I find it couldn't advertising for 30 seconds and stop. On the contrary, it will stop when default 180 seconds timeout, and then resume to advertising after count to 10 seconds. (this is another question to me, I can’t search that where is the trigger point (gapRole_AdvEnabled = TRUE) of make the advertising re-start?)

  • typo: uint16_t advertOffTime = 30000;
  • Hello. The advertOffTime is the time that advertising will remain off until it turns back on...used in periperal.c here:

              else // GAP_END_DISCOVERABLE_DONE_EVENT
              {
                if (gapRole_AdvertOffTime != 0)
                {
                  if ((gapRole_AdvEnabled) || (gapRole_AdvNonConnEnabled))
                  {
                    Util_restartClock(&startAdvClock, gapRole_AdvertOffTime);
                  }

    The parameter you wan to set to control how long the device advertises for is the TGAP_LIM_ADV_TIMEOUT or TGAP_GEN_DISC_ADV_MIN depending on what type of advertising you are doign (general by default). Note that these parameters are GAP parameters; not GAPRole parameters like advertOffTime. See the SDG for a more information on the distinction between these two and an API.

  • Hello Tim,

    Thank you. I totally understand the usage now.