This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf51 as central iOS as peripheral: bounding to a known device

Hello

This question is relevant to nrf51 as central iOS as peripheral pairing question.

We analyzed attached test project and have had some success: now we can do bounding with iOS device, but only once. Here is a description of new problem:

If we use "clear" chip without any information about bounded devices:

  1. We receive DM_EVT_CONNECTION event
  2. We call dm_security_setup_req function in DM_EVT_CONNECTION event handler
  3. Everything works fine and we receive DM_EVT_LINK_SECURED event

if we reset chip after first time bounding and chip has information about previously bounded devices:

  1. We receive DM_EVT_CONNECTION event
  2. We call dm_security_setup_req function in DM_EVT_CONNECTION event handler
  3. Error occurs in dm_security_setup_req function and system goes to HardFault, DM_EVT_LINK_SECURED event not occurs

The pseudo-code looks like this:

case DM_EVT_CONNECTION: {

m_dm_device_handle = (*p_handle);
err_code = dm_security_setup_req(&m_dm_device_handle);
APP_ERROR_CHECK(err_code);

}

Best regards, Vitaliy

EDIT 05.08.2015

Thanks, Petter.

HardFault problem was related to ble_db_discovery_start() call missing. We added it and now it works properly.

Now bounding request occurs on every connection and "Make pair" message appears on iPhone every time, even if bounging has been done yet. We set brakepoint on sd_ble_gap_encrypt() function call in device_manager_central.c - this function is never called.

We also set brakepoint on line 1747 of device_manager_central.c There are some results:

p_handle->device_id == 0xFF

bonded_dev_id == 0xFF

if ((p_handle->device_id != DM_INVALID_ID) || (m_connection_table[p_handle->connection_id].bonded_dev_id != DM_INVALID_ID)) condition never works

It looks like I need explain what we are trying to achieve. We want to implement one time authorization during the first time bounding with password request and work without any password requests on the next time sessions.

EDIT 07.08.2015

This problem occurs on central (nrf device) side. We use our own iOS application whith acts as peripheral, but it can be any other application witch implemets this role, for example you can download LightBlue application on AppStore and add virtual HeartRate peripheral. Every time we try to make bounding "Make pairing" message appears on iPhone.

The first time we take clean iPhone without paired devices everything is ok. The text time we try to make bounding, iOS recognizes nRF central device: we can see it in bluetooth settings and every time it is the same device (only one in the list). On the nRF side it looks like iPhone is recognized as new device every time.

We've done experiment you can reproduce:

  1. We took your project and chage development board in settings to PCA10000.
  2. Download LightBlue application on AppStore.
  3. Reset all bounding devices on both sides
  4. Start LightBlue application and add virtual Heart Rate peripheral
  5. Start nRF application
  6. We started and stopped virtual Heart Rate peripheral for a three times. Every time we can see "Make pairing" message on iPhone
  7. Then we reset nRF - on fourth connection we also saw "Make pairing" message on iPhone

There is attached file with your project, wireshark sniffer trace and some screenshots (0x3F800 after these operations).

We use IPhone 4S/5 with iOS 7.1/8.4

Related