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.

CCS/CC2650STK: Advertisement period after connection

Part Number: CC2650STK

Tool/software: Code Composer Studio

On the CC2650STK sensortag I would like to reduce the time the sensortag is advertizing (green led blinking) AFTER a connection with a central device is terminated.

On the sensortag firmware this period is about 30s. I would like to reduce it to 2s.

Kind regards.

Frederic

  • Hello Frederic,

    You can for example change the advertising interval in processStateChangeEvt for case GAPROLE_CONNECTED. Refer to the GapRole_setparameter function.

    // Set advertising interval
    {
    uint16_t advInt = DEFAULT_ADVERTISING_INTERVAL;
    
    GAP_SetParamValue(TGAP_LIM_DISC_ADV_INT_MIN, advInt);
    GAP_SetParamValue(TGAP_LIM_DISC_ADV_INT_MAX, advInt);
    GAP_SetParamValue(TGAP_GEN_DISC_ADV_INT_MIN, advInt);
    GAP_SetParamValue(TGAP_GEN_DISC_ADV_INT_MAX, advInt);
    }

  • Hello Eirik,
    Thanks for your answer.
    I have seen that I can change these parameters and some others.
    But my question is what is the exact parameter I have to change to reduce the time during which the green led blinks (and consumption is high) after a connection has ended.
    Kind regards.
    Frederic
  • Hello Frederic,

    To control advertise duration change the GAP parameters TGAP_LIM_ADV_TIMEOUT or TGAP_GEN_DISC_ADV_MIN depending on type of advertising mode (general by default, but the sensortag code use limited discoverable).

    // Set timeout for limited discoverable mode.
    GAP_SetParamValue( TGAP_LIM_ADV_TIMEOUT, 2000);
    // Set timeout for general discoverable mode.
    GAP_SetParamValue( TGAP_GEN_DISC_ADV_MIN, 2000);

    The GAPRole parameters advertOffTime is the time that advertising will remain off until it turns back on. Default is set to 0 which means it will never restart after the timeout. advertOffTime  is handled by the GAP Role in peripheral.c:

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

    The green LED blink in sensortag.c:

    Whenever the state is GAPROLE_ADVERTISING there is a ST_PERIODIC_EVT timer periodically triggered (Util_startClock(&periodicClock);) in the main task function.  For every iteration the green led will blink once (SensorTagIO_blinkLed(IOID_GREEN_LED, 1);)