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.

CC2642R: Changing Periodic Advertising Params

Part Number: CC2642R

I added periodic advertsing to my simple_peripheral like in https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1294888/faq-cc2642r-periodic-advertising-with-cc2642r-cc2652r7.

Everything is running fine!

Additionally, I want to change the periodic advertising params (interval) later during runtime. The new settings can be set by user via GATT Service.

Therefore, I call GapAdv_SetPeriodicAdvParams again:

        
        uint32_t newInterval = getNewInterval();
        
        // Change Periodic Advertising parameters
        GapAdv_periodicAdvParams_t perParams = {newInterval, newInterval, 0x40};
        status = GapAdv_SetPeriodicAdvParams(advHandleNCNS, &perParams);

The status is always 0x18 (bleInvalidRange). The function only succeeds for the very first call after creating the advertising.

I also tried to pause the periodic advertising by calling GapAdv_SetPeriodicAdvEnable(0, advHandleNCNS) and/or GapAdv_disable(advHandleNCNS) before calling GapAdv_SetPeriodicAdvParams again. With no success.

The only way now is doing a reset, but I want to avoid this.

Is it possible to change the initial periodic advertising params to new values during runtime? If yes, I would appreciate any help!

Many thanks in advance!

  • Hi,

    Thank you for reaching out. Can you confirm advHandleNCNS is an extended advertising handle? I expect it is since you have periodic advertising working in the first place, but wanted to double check. Do you have any additional advertising handle running? If so, then could you try disabling all advertisements to see if the behavior is still observed?

    Best Regards,

    Jan

  • Hi Jan,

    thank you for your reply!

    I can confirm that advHandleNCNS is an extended advertising handle.

    See params:

    GapAdv_params_t advParamsNCNS = {
      .eventProps = 0,
      .primIntMin = 160,
      .primIntMax = 160,
      .primChanMap = GAP_ADV_CHAN_ALL,
      .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID,
      .peerAddr = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa },
      .filterPolicy = GAP_ADV_WL_POLICY_ANY_REQ,
      .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE,
      .primPhy = GAP_ADV_PRIM_PHY_1_MBPS,
      .secPhy = GAP_ADV_SEC_PHY_1_MBPS,
      .sid = 1
    };
    
    status = GapAdv_create(advCb, &advParamsNCNS, &advHandleNCNS);

    I additionally create a legacy advertising handle. I need this for being scannable and connectable.

    For the test I disabled the legacy advertising, so that I have only the extended handle.

    Same behavior: second and following calls of GapAdv_SetPeriodicAdvParams fail.

    Thanks, Andreas

  • Hi Andreas,

    Can you try disabling the extended advertisement as well? So both the legacy and extended advertisements are stopped and the device is not advertising at all?

    Best Regards,

    Jan

  • Hi Jan,

    yes, I completely disable all advertisings before calling GapAdv_SetPeriodicAdvParams.

    Same behavior.

    Andreas

     

  • Hi Andreas,

    I have dug into this further and it is not possible to change the configuration once they have been set initially. You would need to potentially destroy the advertising set and recreate it or reset the device. Can you try this?

    Best Regards,

    Jan

  • Hi Jan,

    resetting the device is always an option, this runs.

    Destroying the advertising is also not successful:

    GapAdv_destroy with freeOptions GAP_ADV_FREE_OPTION_DONT_FREE and recreating causes the same status=0x18 at GapAdv_SetPeriodicAdvParams again.  

    GapAdv_destroy with other freeOptions causes status=0x18 on next GapAdv_enable.

     

    I see no other option than reset at the moment, unfortunately.

    Thanks,

    Andreas

  • Hi Andreas,

    Got it. Thank you for testing, I thought it was worth a try. You are correct, it seems after configuring periodic advertising parameters once, they are set until the next reset. I will file a ticket to see if this can get resolved in a future SDK release or if this is intended.

    Best Regards,

    Jan

  • Hi Jan,

    so I have to live with resets for changing the periodic params.

    If there is any news I would appreciate being updated.

    Many thanks for your kind support!

    Andreas