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

How to implement the static PIN type pairing?

Hi, How to implement the static PIN type pairing, when the server device doesn't have keyboard or display? Our requirement is, Master will initiate the pairing process and device should ask for the PIN (6 digit static), when master enters the correct PIN then the connection should be established between the device and the master. Is there any sample application for server with keyboard only IO capability?

Regards, Balaji

  • See this answer, and possibly also the other ones in that thread.

  • Thanks for the reply Morten, As you said, we can go for Numeric Comparison method, but i don't see any sample application with keyboard only IO capabilities, it will be more helpful for us, if we get sample application related to this.

    Regards, Balaji

  • We don't have any sample applications for this, but the sequence of events and function calls needed are given here: Central OOB MSC

    Beware however, that I'm not aware of any Central allowing the kind of low-level control you need to do this.

  • Thanks for the reply Morten, Now i can implement pairing as below, IO capability for both the end is set to keyboard only, then in the server side i hard-coded the passkey value to 123456, and added the below case in on_ble_evt,

    case BLE_GAP_EVT_AUTH_KEY_REQUEST:
    sd_ble_gap_auth_key_reply(m_conn_handle,BLE_GAP_AUTH_KEY_TYPE_PASSKEY, passkey);
    break;
    

    when i click bond in the master control panel it will ask for the passkey, and the passkey i need to enter is 123456. And also checked it is working fine.

    But when i enter wrong key (121212) it is giving receiver link loss as i expected, but, in device info it is showing that Bonded: True and when i press bond button i am getting bond already exists with xxxxxxxx(device address). Please suggest me to overcome this.

    Regards, Balaji

  • With the latest softdevice www.nordicsemi.com/.../S110-SoftDevice-v7.0 you will be able to set a static passkey.

    By using the API call sd_ble_opt_set() with the structure ble_gap_opt_passkey_t, then the passkey display event will come with the passkey you set.

    Code Sample:

    uint8_t passkey[] = "123456";
    ble_opt_t ble_opt;
    ble_opt.gap.passkey.p_passkey = &passkey[0];
    (void) sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &ble_opt);
    

    Use IO capability display in the sec params request.

Related