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

bonding issue

i was trying to implement bonding in ble_app_hrs example(SDK V6.1.0 and soft device v7.0.0) i have given params

#define SEC_PARAM_TIMEOUT                    30                                   
#define SEC_PARAM_BOND                         1                                          
#define SEC_PARAM_MITM                          1                                      
#define SEC_PARAM_IO_CAPABILITIES           BLE_GAP_IO_CAPS_DISPLAY_YESNO       
#define SEC_PARAM_OOB                            0                                          
#define SEC_PARAM_MIN_KEY_SIZE              7                                    
#define SEC_PARAM_MAX_KEY_SIZE             16   

when i tried to bond in master control panel it asks for 6 digit number with any number it shows bonded:true.... but could not get connected.

  1. i have given io_capabilities as BLE_GAP_IO_CAPS_DISPLAY_YESNO , then why it asks for 6 digit number rather than yes/no.
  2. why device get bonded for every number. 3.i tried in debug mode also... it shows an error .. error code 132.. what it means
  • Hi Sruthiraj,

    What is the IO Capability of your Master Control Panel? If you have not changed it, then it will be the default 'Keyboard And Display'. So you will be in a situation where the initiator (Master) has a 'Keyboard And Display' and the responder (Slave) has 'DisplayYesNo'. In this case, as per spec, the responder will have to display and the initiator will have to input. And this is probably what is happening for you.

    There are two things you can do now.

    1 . On the slave side, check if you are getting a BLE_GAP_EVT_PASSKEY_DISPLAY event. When you do, you will have to get the passkey contained in p_ble_evt->evt.gap_evt.params.passkey_display.passkey and enter it when the Master Control Panel prompts you for the key.

    OR

    2 . On the Master Control Panel, change the IO Capabilities to 'No Keyboard or display'. (You can do it in File -> Options -> Security) and then do 'Bond' from Master Control Panel. If Master Control Panel log says 'Bond already exists with the device', then please restart Master Control Panel, and try again (you will need to set the IO capabilities again). Please note that in this case, the generated key will be 'unauthenticated no MITM protection' key. If you want MITM, then please use the 1st approach.

    See Table 2.5 (Mapping of IO Capabilities to STK Generation Method) of Bluetooth Specification Vol 3, Part H Section 2.3.5.1 for more information.

    Cheers, Balaji

  • when i tried to bond from master control panel,which part of the code checking the i/o capabilities and displaying pairing code... actually am working on nrf51822 eveluation board with no lcd no keyboard,

  • The i/o capabilities are checked by the stack. You can either use display the passkey on a terminal window on your PC (you need to send the passkey over UART) or set your SEC_PARAM_IO_CAPABILITIES to BLE_GAP_IO_CAPS_NONE (no keyboard/no display).

  • p_ble_evt->evt.gap_evt.params.passkey_display.passkey..... dis is the passkey i have to enter while bonding ryt? in dm_ble_evt_handler i have assingned array passkey[6] as {1,2,3,4,5,6}... nd try to bond by entering dis key... mcp shows bonded true.. but connection is getting lost

  • @ dis is the passkey i have to enter while bonding ryt? :

    Yes.

    @ in dm_ble_evt_handler i have assingned array passkey[6] as {1,2,3,4,5,6}.

    It looks to me that you want to have a static pass key (i.e you want both the devices to use a preconfigured passkey). Is this correct? In this case, you will need to use the options API (sd_ble_opt_set with opt_id = BLE_GAP_OPT_PASSKEY) to set the passkey before you start advertising.

    A typical use case of this is defined as an MSC here -> developer.nordicsemi.com/.../a00861.html

    Refer here for documentation of this option -> developer.nordicsemi.com/.../a00228.html

Related