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: cc2642 multiple advertising sets with different intervals - problem

Part Number: CC2642R


Hi,

Using SDK cc13x2_26x2_sdk_3_30_00_03

Objective:

Have two legacy advertising sets both advertising with same interval 1 - sec

Case 1

- both advertising packets go out every sec. I have a debug print inside ADV_EVT_END callback from both advertisements and it prints every second

Case 2

- Stop both  advertising sets while some wifi activity takes place by a co-processor

- enable Adv Set 1 with 100msec interval for 20 frames

- enable  Adv Set 2 with the regular interval of 1 set

Observations:

Case 1 works okay.

My debug lines look right:

-------one second

Adv 1

Adv 2

------ next second

Adv 1

Adv 2

------ and so forth

Case 2:

- Disable Adv works - both stop

- wifi activity for about 2-3 seconds

- update Adv Set 1 with 100 msec interval

- re-enable Adv Set 1

- re-enable Adv Set 2 with 1 sec inter

when I look at the prints from the ADV_END_EVENT i get

------ WIFI activity (no advertising takes place)

------ one second

Adv 1 HF (HF - meaning the avd data for the  high frequency frames that should be 100 msec apart

Adv 2

------ one second

Adv 1 HF

Adv 2

------ one second

Adv 1 HF

Adv 2

------ one secon

and so forth for 20 seconds ( I detect this in the ADV_EVT_END, and stop Adv Set1, update to regular 1 sec interval, and start it again

Above behavior is incorrect, i expect it to be:

------ WIFI activity (no advertising takes place)

------ one second

Adv 1 HF (HF - meaning the avd data for the  high frequency frames that should be 100 msec apart

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 2

------ one second

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 2

------ one second

inside ADV_EVT_END handler, detect that the packets are send, and stop Adv Set1, update to regular 1 sec interval, and start it again

Adv 1

Adv 2

------ one second

Adv 1

Adv 2

------ one second

NOTE: when I only have one Advertising Set - Adv 1 (and comment out code related  to second Adv Set), it works as expected:

------ WIFI activity (no advertising takes place)

------ one second

Adv 1 HF (High Frequency)  - data for the  high frequency frames that should be 100 msec apart

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

------ one second

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

Adv 1 HF

------ one second

inside ADV_EVT_END handler, detect that the packets are send, and stop Adv Set1, update to regular 1 sec interval, and start it again

Adv 1

------ one second

Adv 1

------ one second

I did check my code to make sure parameters are not cross referenced.

======================================================================================================

Here are relevant snippets of code

Create Adv 1:

status = GapAdv_create(&SimplePeripheral_advCallback, &advParams1, &advHandleLegacy);

GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_SCAN_RSP, scanResData1Size, scanResData1);

status = GapAdv_setEventMask(advHandleLegacy,
                                 //GAP_ADV_EVT_MASK_START_AFTER_ENABLE |
                                 //GAP_ADV_EVT_MASK_END_AFTER_DISABLE |
                                 GAP_ADV_EVT_MASK_END |
                                 //GAP_ADV_EVT_MASK_START |
                                 GAP_ADV_EVT_MASK_SET_TERMINATED);//subscribe for events

GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_ADV, advertDataSize, advertData);//set Adv 1 data

Create Adv 2:

status = GapAdv_create(&SimplePeripheral_advCallbackSDS, &advParams_SDS, &advHandleLegacy_SDS);

GapAdv_loadByHandle(advHandleLegacy_SDS, GAP_ADV_DATA_TYPE_SCAN_RSP, scanResData1Size, scanResData2);//set scan response

status = GapAdv_setEventMask(advHandleLegacy_SDS,
         //GAP_ADV_EVT_MASK_START_AFTER_ENABLE |
         //GAP_ADV_EVT_MASK_END_AFTER_DISABLE |
         GAP_ADV_EVT_MASK_END |
         //GAP_ADV_EVT_MASK_START |
         GAP_ADV_EVT_MASK_SET_TERMINATED);//subscribe to Adv End Evt

GapAdv_loadByHandle(advHandleLegacy_SDS, GAP_ADV_DATA_TYPE_ADV, advertDataSize_SDS, advertData_SDS);//set Adv 2 data

This is how Adv is being re-enabled:

Adv Set 1

uint32_t advInt = (uint32_t)(ble_adv_interval_msec * 1.6);//here the ble_adv_interval_msec is sometimes 1000 (1 sec) and sometimes 100 when we need to go into high frequency after wifi activity

GapAdv_setParam(advHandleLegacy, GAP_ADV_PARAM_PRIMARY_INTERVAL_MIN, &advInt);
GapAdv_setParam(advHandleLegacy, GAP_ADV_PARAM_PRIMARY_INTERVAL_MAX, &advInt);
GapAdv_enable(advHandleLegacy, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);   

Adv Set 2

   uint32_t advInt = (uint32_t)(ble_adv_interval_msec * 1.6); // this is always 1 sec = 1000 * 1.6 = 1600

   GapAdv_setParam(advHandleLegacy_SDS, GAP_ADV_PARAM_PRIMARY_INTERVAL_MIN, &advInt);
    GapAdv_setParam(advHandleLegacy_SDS, GAP_ADV_PARAM_PRIMARY_INTERVAL_MAX, &advInt);
    GapAdv_enable(advHandleLegacy_SDS, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);

I decided to post including the code snippets, I have checked code for typo kind of errors by using wrong adv handle betweed the calls for Adv 1 vs Adv 2, etc, and it did not see issues.

Are there any limitations of the  types of the multiple adv sets? - can you have two legacy type adv?

these are the params for the Adv Sets:

// Advertisement Params 1
GapAdv_params_t advParams1 = {
  .eventProps =   GAP_ADV_PROP_CONNECTABLE | GAP_ADV_PROP_LEGACY | GAP_ADV_PROP_SCANNABLE,
  .primIntMin =   160,//will be overwritten later
  .primIntMax =   160,//will be overwritten later
  .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 =          0
};
uint8 advertData[BLE_ADV_MAX_ADV_DATA_SIZE /*+ 1*/] = {0};
uint8 advertDataSize = 0;

//======================================================================
// Advertisement Params 2 / SDS
GapAdv_params_t advParams_SDS = {
    .eventProps =   GAP_ADV_PROP_CONNECTABLE | GAP_ADV_PROP_LEGACY | GAP_ADV_PROP_SCANNABLE,
    .primIntMin =   160,//will be overwritten later
    .primIntMax =   160,//will be overwritten later
    .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
};

or, is there any other limitation in terms of multiple adv sets?

Thank you for your help in advance!

Ivan Slavov

PS: I basically followed the recommended best practices from here:

 

  • Hi Ivan,

    Advertising sets with different advertisement intervals are not supported in cc13x2_26x2_sdk_3_30_00_03. However we have added this feature in the new SimpleLink CC13x2/CC26x2 4.10 SDK. Can you please download this version and retry?

  • Marie H said:

    Hi Ivan,

    Advertising sets with different advertisement intervals are not supported in cc13x2_26x2_sdk_3_30_00_03. However we have added this feature in the new SimpleLink CC13x2/CC26x2 4.10 SDK. Can you please download this version and retry?

    Marie, thanks for your response! I wish I knew this somehow sooner. I got mislead by the fact that the API  functions were left in the 3_30_00_03 SDK.

    I will try migrating the 4.10 SDK, hopefully it will easy and code will be compatible.

    Will update this thread with the outcome.

    Thanks,

    Ivan S