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.

CC2640R2F: How to enable whitelist in 2.20 SDK

Part Number: CC2640R2F
Other Parts Discussed in Thread: BLE-STACK

Hello,

We had previously used the following code to enable a single device whitelist on the SimpleObserver project from simplelink_cc2640r2_sdk_1_40_00_45:

  static uint8 bdAddressPeer[6] = {0x12,0x34,0x56,0x78,0x9A,0xBC};
  HCI_LE_AddWhiteListCmd(ADDRMODE_PUBLIC, bdAddressPeer);
  VOID GAPObserverRole_StartDevice((gapObserverRoleCB_t *)&simpleBLERoleCB);
  GAPObserverRole_StartDiscovery(DEFAULT_DISCOVERY_MODE,
                                             DEFAULT_DISCOVERY_ACTIVE_SCAN,
                                             DEFAULT_DISCOVERY_WHITE_LIST);

We are now trying to add this code (first 2 lines) to the SimpleCentral example from simplelink_cc2640r2_sdk_2_20_00_49, however it does not seem to be applying the filter as we can still see data from other MAC addresses.

Is this HCI command still applicable in the new stack? If yes, where does it need to go, and if no, what is the replacement command?
Thanks,
Mishca
  • Hi Mishca,

    What is DEFAULT_DISCOVERY_WHITE_LIST set to?

    Can you check whether you get a hciEvt_CmdComplete_t with cmdOpcode HCI_LE_ADD_WHITE_LIST when you send HCI_LE_AddWhiteListCmd()?
  • Hi Marie,

    DEFAULT_DISCOVERY_WHITE_LIST is not defined in our new code, since this only gets passed to GapObserverRole_StartDiscovery which does not exist in the new 2.20 stack. I did a search in the new API documentation and couldn't find anything with the word "white" in it, so I assume there is a different way to enable the whitelist.

    I cannot seem to use most of the ROV features with the new stack. Ex. I added a breakpoint at where I called HCI_LE_AddWhiteListCmd() and then tried to open up Event in ROV and I got the following error:

    Received exception from ROV Server:
    Target memory read failed at address: 0x2000289c, length: 12
    This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    I tried it with an unmodified broadcaster example and I still have the same problem, so something is different about this new stack.

    Please let me know what I should try next, and if I should make a separate post for the ROV issue,

    Thanks,

    Mishca

  • Hi Mishca,

    I'm sorry, the GAPRole API documentation has an issue for the 2.20 SDK.

    If you want to use white list, you have to send TRUE in the GAPCentralRole_StartDiscovery() call.

              GAPCentralRole_StartDiscovery(DEFAULT_DISCOVERY_MODE,
                                            DEFAULT_DISCOVERY_ACTIVE_SCAN,
                                            DEFAULT_DISCOVERY_WHITE_LIST);

    For your ROV problem, please see the Debugging chapter of the BLE-Stack User's Guide.

  • Hi Marie,

    The simple central project uses GapScan_enable() to begin device discovery, so I found a filter policy in GapScan_setParam and attempted the following:

    bool SimpleCentral_doDiscoverDevices(uint8_t index)
    {
    
        static uint8 bdAddressPeer[6] = {0x11,0x11,0x11,0x11,0x11,0x11};  
        HCI_LE_ClearWhiteListCmd();
        HCI_LE_AddWhiteListCmd(ADDRMODE_PUBLIC, bdAddressPeer);
    
        uint8_t whitelistfilter = SCAN_FLT_POLICY_WL;
    
        GapScan_disable();
    
        GapScan_setParam(SCAN_PARAM_FLT_POLICY, whitelistfilter);
    
      // Scan duration in 10 ms
      uint16_t scanDuation = 500; // 500 * 10 ms = 5 s.
      GapScan_enable(0, scanDuation, 0);
    
      return (true);
    }

    The code compiles fine, but the whitelist is not applied. Am I applying the filter in the wrong place?

    Thanks,

    Mishca

  • Hi Mishca,

    I'm sorry, I thought you used the BLE-Stack, not the BLE5-Stack.

    GapScan_setParam() takes a pointer, so you have to call it like this:

    uint8_t whitelistfilter = SCAN_FLT_POLICY_WL;
    GapScan_setParam(SCAN_PARAM_FLT_POLICY, &whitelistfilter);

  • Marie,

    It's working perfectly now, thank you very much,

    Mishca