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

Whitelisting with pc-ble-driver 2.0, S132, API v3

Hello,

I develop a BLE central device based on nRF52 (with the newest connectivity firmware and SoftDevice with API v3) and the pc-ble-driver in version 2.0.

Since my device has to connect only known peripherals (previously bonded) I would like to set the whitelist before starting the scanning. Unfortunately, I encountered a problem while trying to set a whitelist which has more then one device.

This is my whitelist:

ble_gap_addr_t whitelist[2];    

// Print of whitelist (after proper bonding 2 devices)
// addresses shown as uint64_t instead of uint8_t array
whitelist[0].addr_id_peer = 0
whitelist[0].addr_type    = 1
whitelist[0].addr         = C4ACA49FC99C     
whitelist[1].addr_id_peer = 0
whitelist[1].addr_type    = 1
whitelist[1].addr         = F63A11DDD999

If I set a whitelist with only one device everything works great:

 // Set the whitelist with device 0 only
 ble_gap_addr_t const * p_whitelist = &whitelist[0];
 err_code = sd_ble_gap_whitelist_set(ble_adapter, &p_whitelist, 1); 
 if (err_code == NRF_SUCCESS)
   printf("Whitelist with device 0 only set successfully.\n");
 else
   printf("Whitelist with device 0 only can not be set. Error 0x%X.\n", err_code);
 // This works fine, returns NRF_SUCCESS

 // Set the whitelist with device 1 only
 ble_gap_addr_t const * p_whitelist = &whitelist[1];
 err_code = sd_ble_gap_whitelist_set(ble_adapter, &p_whitelist, 1); 
 if (err_code == NRF_SUCCESS)
   printf("Whitelist with device 1 only set successfully.\n");
 else
   printf("Whitelist with device 1 only can not be set. Error 0x%X.\n", err_code);
 // This also works fine, returns NRF_SUCCESS

If I try to set the whitelist with both devices I get the error 0x3202 BLE_ERROR_GAP_INVALID_BLE_ADDR

 // Set the whitelist with both devices
 ble_gap_addr_t const * p_whitelist = whitelist;
 err_code = sd_ble_gap_whitelist_set(ble_adapter, &p_whitelist, 2); 
 if (err_code == NRF_SUCCESS)
   printf("Whitelist with device 1 only set successfully.\n");
 else
   printf("Whitelist with device 1 only can not be set. Error 0x%X.\n", err_code);
 // This doesn't work, returns error 0x3202

Do you have any idea, what's going on?

Best regards,

Mike

Related