This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Misunderstanding about adertising mode "Whitelist"

Dear Nordic Developer Zone,

I am using nRF51822 with softdevice.

I don't understand very well the advertising mode "whitelist". My target is to be able to connect with only one paired iPhone.

So, the first time I power on the nRF51822, I advertise without restriction and all centrals can be pairing with the device. But when a central has been paired, the nRF51822 advertises using the whitelist mode.

I thought that only the paired iPhone will see the device advertisement due to the whitelist, but I read somewhere on that the whitelist is only used in the LL (link layer) of the nRF51822 to accept or not the connection of the central.

Here is the behaviour I don't understand : When my first iPhone is paired to the nRF51822 and it advertises with whitelist mode, I am able to connect and pair another iPhone to my nRF51822.

I am sure that I don't understand something pretty obvious because I didn't find anything about that on that forum.

Is there someone to help me?

Should I modify MAX_NUM_MASTER_WHITE_LIST and MAX_BONDS_IN_FLASH constants to allow only one central in the whitelist?

Here is the code I am using to choose the advertising mode:


/**@brief Start advertising.
 */
void ble_kernel_advertising_start(void)
{
    uint32_t             err_code;
    ble_gap_adv_params_t adv_params;
    ble_gap_whitelist_t  whitelist;
    ble_gap_addr_t       peer_address;
    
    // Initialise advertising parameters (used when starting advertising)
    memset(&adv_params, 0, sizeof(adv_params));
    
    adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
    adv_params.p_peer_addr = NULL;// Undirected advertisement
    adv_params.p_whitelist = NULL;
    adv_params.fp          = BLE_GAP_ADV_FP_ANY;
    adv_params.interval    = APP_ADV_INTERVAL;
    adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;

    err_code = ble_bondmngr_whitelist_get(&whitelist);
    APP_ERROR_CHECK(err_code);
                
    if (whitelist.irk_count != 0)                
    {
        adv_params.fp          = BLE_GAP_ADV_FP_FILTER_BOTH;
        adv_params.p_whitelist = &whitelist;
        advertising_init(BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED);
    }
    else
    {
        advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
    }

    err_code = sd_ble_gap_adv_start(&adv_params);
    APP_ERROR_CHECK(err_code);    
}

  • Your code looks very reasonable, and I suspect that what you see is a known issue with S110 version 5.2.1. As you can see in its release notes, it says: "On a bonded device using IRK based whitelisting, the white list is not effective until after the first advertising event (NRFFOETT-515, DRGN-3141)"

    There isn't any workaround you can do from your application for this, except to make sure to upgrade to the final 6.0.0 as soon as it's available (should be very soon).

    Apart from this bug, you are correct that even when using whitelisting all Centrals will be able to see the device, the only effect of the whitelist is that the Peripheral will not accept the Connection request from other Centrals than the ones it has in its whitelist.

  • Dear Ole Morten,

    Thanks for your reply. I have just tested to upgrade the Softdevice to version 6.0.0-1 alpha but the problem persists. :(

    After pairing the first iPhone, I am still able to connect to the nRF51822 with the second one and perform a pairing. It seems that the whitelist has no effect with IOS. But unfortunately, I can't test with other kind of central.

    By the way, I am using the very last version of the SDK 4.4.2.

    Can you confirm that you don't have this kind of problem on your side?

    I know that it is another problem and I don't want to interfere with the main purpose of this question, but after pairing the second iPhone, the first one is no longer able to read secure characteristics (no problem with non-secure ones) of the nRF51822. I will open a second question on this topic when the whitelist problem will be fixed.

    Best regards

  • The problem is also there in the alpha, which is why I recommended you to test with the final when it is available, which have fixed this issue. With 5.2.1 and 6.0.0-alpha I can see similar problems to the ones you report, so I'm hopeful that the final 6.0.0 release will fix the problem for you as well.

    If you have a Master Emulator dongle, you should be able to bond your device with the Master Control Panel, and then see that your iPhone is not able to connect.

  • I am glad to read your comment. So I really looking forward to testing the next Softdevice version.

    I have just tested to pair the dongle-"Master emulator" first, but I still have similar problem. I can also connect and pair the second iPhone (it means a third master) and pair it.

  • Hi Ole,

    I confirm that if I pair the dongle-"Matser control panel" first, the iPhone cannot be connected due to whitelist restriction. But, of course, the opposite doesn't work because of IRK whitelist problem you mentionned.

Related