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.

LAUNCHXL-CC1352P: Simple Peripheral enable white list with GapAdv_setParam() doesn't work

Part Number: LAUNCHXL-CC1352P
Other Parts Discussed in Thread: SYSCONFIG

Hi,

I’m currently trying to develop a sensor which uses DMM to implement a ZigBee Router and Bluetooth Simple Peripheral.
For this, I used the example dmm_zr_light_remote_display.
Now, for Bluetooth, I want to implement a pairing and bonding between peripheral and central based on white list.
The peripheral should accept only central devices from a white list. When a button is pressed, then the device should accept any connection for 20 seconds.
I tried to set the parameter with GapAdv_setParam() to enable white list, which doesn’t work. The function returns a value of 2, which I think is INVALIDPARAMETER.

This is how I tried to implement:

When the GAP_DEVICE_INIT_DONE_EVENT Event is send, I set the Parameter to use only white list before I enable the Advertising:

status = GapAdv_setParam(advHandleLegacy, GAP_ADV_PARAM_FILTER_POLICY, GAP_ADV_WL_POLICY_WL_ALL_REQ);

This doesn’t work and the value of status is 2.
Then I tried to set the value directly:

advParams1.filterPolicy = GAP_ADV_WL_POLICY_WL_ALL_REQ;

This works and the device accepts only devices in the white list.
When I press the button, the device should accept any connection, so I tried:

status = GapAdv_setParam(advHandleLegacy, GAP_ADV_PARAM_FILTER_POLICY, GAP_ADV_WL_POLICY_ANY_REQ);

This works without any problems (status = 0) and the device accepts any connection.
After 20 Seconds the device should fall back to accept only white listed devices:

status = GapAdv_setParam(advHandleLegacy, GAP_ADV_PARAM_FILTER_POLICY, GAP_ADV_WL_POLICY_WL_ALL_REQ);

This doesn’t work and the value of status is 2.

Does anybody know, what I'm doing wrong?
Thanks for any help!

Regards

Thomas

  • I will assigned someone to look into this. In the meantime, please provide information regarding what SDK you are using.

    BR

    Siri

  • I'm using the SDK SimpleLink CC13x2 26x2 Version 5.20.0.52.

    Regards

    Thomas

  • Hi Thomas,

    0x02 is not a valid return for GapAdv_setParam(). Did you mean 0x12 bleIncorrectMode?

    Advertising must be disable to change parameters, this is why the GapAdv_setParam() fails with the incorrect mode fail status.

    Can you try disabling advertising before changing the filter policy? 

    Cheers,

    Marie H.

  • Hi Marie,

    I checked it again with the debugger, the return value is 0x02.

    In all cases, I first call GapAdv_disable().

    Then, after the event GAP_EVT_ADV_END_AFTER_DISABLE is send, I call GapAdv_setPAram().

    Regards

    Thomas

  • Hi Thomas,

    I would like to try to reproduce. Can you post all of the ADV parameters you use?

    Cheers,

    Marie H.

  • Hi Marie,

    This is the code which I use for initial settings of the Adv:


    // All the values for advParams1 are generated from SysConfig
    GapAdv_params_t advParams1 = {
        .eventProps =   GAP_ADV_PROP_CONNECTABLE | GAP_ADV_PROP_LEGACY | GAP_ADV_PROP_SCANNABLE,
        .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 =          0
    };


    //When the GAP_DEVICE_INIT_DONE_EVENT is send, I use this code to create the Adv:

    status = GapAdv_create(&bleDisplay_advCallback, &advParams1, &advHandleLegacy);
    REMOTEDISPLAY_ASSERT(status == SUCCESS);

    status = GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_ADV, sizeof(advData1), advData1);
    REMOTEDISPLAY_ASSERT(status == SUCCESS);

    status = GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_SCAN_RSP, sizeof(scanResData1), scanResData1);
    REMOTEDISPLAY_ASSERT(status == SUCCESS);

    status = GapAdv_setEventMask(advHandleLegacy,
                                         GAP_ADV_EVT_MASK_START_AFTER_ENABLE |
                                         GAP_ADV_EVT_MASK_END_AFTER_DISABLE |
                                         GAP_ADV_EVT_MASK_SET_TERMINATED);
    REMOTEDISPLAY_ASSERT(status == SUCCESS);

    // *******************************
    // ******** This call returns 2 for status
    status = GapAdv_setParam(advHandleLegacy, GAP_ADV_PARAM_FILTER_POLICY, GAP_ADV_WL_POLICY_WL_ALL_REQ);
    REMOTEDISPLAY_ASSERT(status == SUCCESS);

    // *******************************
    // ******** This will not be executed, because status is 2 from previous function call
    status = GapAdv_enable(advHandleLegacy, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
    REMOTEDISPLAY_ASSERT(status == SUCCESS);


    Regards

    Thomas

  • Hi Thomas,

    I am able to reproduce what you are seeing. I have filed a bug ticket.

    It seems you already found a work-around.

    Cheers,

    Marie H.

  • Hi Marie,

    the workaround to set advParams1.filterPolicy directly works only before the GapAdv_create() is called.
    After that call, the changes in advParams1 are ignored.

    When I press my button, I have to change the filterPolicy from GAP_ADV_WL_POLICY_WL_ALL_REQ to GAP_ADV_WL_POLICY_ANY_REQ
    and after 20 seconds change it back to GAP_ADV_WL_POLICY_WL_ALL_REQ.

    How can I do this?

    Regards

    Thomas

  • Hi Thomas,

    I'll let you know when I hear back regarding the bug ticket. In the mean while, I have two suggestions for work around:

    1) Define two different advertising sets, one with WL and one without. Alternate between enabling these two.

    2) Use GapAdv_create and GapAdv_destroy APIs to reset all parameters when you need to change between using WL and not.

    I would recommend 1).

    Cheers,

    Marie H.

  • Hi Marie,

    thanks for the workaround!
    I implemented it with 2 advertising sets and it works.

    Regards

    Thomas