Use Peripheral and Central UART (NUS service) example with pairing

In both examples have the callback functions that It does the pairing process.

The nRF52840 doesn't have the security support enabled,. In this case Initiator / Responder of pairing were called No Imput / No Output, in this case Just Works and a connection works without authentication.

I try to define passkey_entry (Responder) and passkey_display (Initiator), but pairing doesn't work yet.

i don't understand what happendee. Please, can someonr help me?

Parents
  • Hi,

    Our Bluetooth: Continuous Glucose Monitoring Service (CGMS) sample shows you how you can pair devices.

    Does this show you what you need?

    Regards,
    Sigurd Hellesvik

  • Sigurd,

    It needs to work change the GATT permitions fo NUS service.

    Now the implemeted SMP callback funtions work.

    I will send the changed code:

    diff --git a/nus.c b/nus.c
    index dc36b4c..a1d2dd3 100644
    --- a/nus.c
    +++ b/nus.c
    @@ -60,13 +60,13 @@ BT_GATT_SERVICE_DEFINE(nus_svc,
    BT_GATT_PRIMARY_SERVICE(BT_UUID_NUS_SERVICE),
    BT_GATT_CHARACTERISTIC(BT_UUID_NUS_TX,
    BT_GATT_CHRC_NOTIFY,
    - BT_GATT_PERM_READ,
    + BT_GATT_PERM_READ_AUTHEN | BT_GATT_PERM_READ_ENCRYPT,
    NULL, NULL, NULL),
    - BT_GATT_CCC(nus_ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),
    + BT_GATT_CCC(nus_ccc_cfg_changed, BT_GATT_PERM_READ_AUTHEN | BT_GATT_PERM_WRITE_AUTHEN | BT_GATT_PERM_READ_ENCRYPT | BT_GATT_PERM_WRITE_ENCRYPT),
    BT_GATT_CHARACTERISTIC(BT_UUID_NUS_RX,
    BT_GATT_CHRC_WRITE |
    BT_GATT_CHRC_WRITE_WITHOUT_RESP,
    - BT_GATT_PERM_READ | BT_GATT_PERM_WRITE,
    + BT_GATT_PERM_READ_AUTHEN | BT_GATT_PERM_WRITE_AUTHEN | BT_GATT_PERM_READ_ENCRYPT | BT_GATT_PERM_WRITE_ENCRYPT,
    NULL, on_receive, NULL),
    );


    Thanks for sharing the link with me! I will see and read your recommendation!

Reply
  • Sigurd,

    It needs to work change the GATT permitions fo NUS service.

    Now the implemeted SMP callback funtions work.

    I will send the changed code:

    diff --git a/nus.c b/nus.c
    index dc36b4c..a1d2dd3 100644
    --- a/nus.c
    +++ b/nus.c
    @@ -60,13 +60,13 @@ BT_GATT_SERVICE_DEFINE(nus_svc,
    BT_GATT_PRIMARY_SERVICE(BT_UUID_NUS_SERVICE),
    BT_GATT_CHARACTERISTIC(BT_UUID_NUS_TX,
    BT_GATT_CHRC_NOTIFY,
    - BT_GATT_PERM_READ,
    + BT_GATT_PERM_READ_AUTHEN | BT_GATT_PERM_READ_ENCRYPT,
    NULL, NULL, NULL),
    - BT_GATT_CCC(nus_ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),
    + BT_GATT_CCC(nus_ccc_cfg_changed, BT_GATT_PERM_READ_AUTHEN | BT_GATT_PERM_WRITE_AUTHEN | BT_GATT_PERM_READ_ENCRYPT | BT_GATT_PERM_WRITE_ENCRYPT),
    BT_GATT_CHARACTERISTIC(BT_UUID_NUS_RX,
    BT_GATT_CHRC_WRITE |
    BT_GATT_CHRC_WRITE_WITHOUT_RESP,
    - BT_GATT_PERM_READ | BT_GATT_PERM_WRITE,
    + BT_GATT_PERM_READ_AUTHEN | BT_GATT_PERM_WRITE_AUTHEN | BT_GATT_PERM_READ_ENCRYPT | BT_GATT_PERM_WRITE_ENCRYPT,
    NULL, on_receive, NULL),
    );


    Thanks for sharing the link with me! I will see and read your recommendation!

Children
No Data
Related