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

Pairing/bonding with ble_app_template example not working for me

Hi,

I just recently got into designing Bluetooth devices and I am experimenting with NRF51822 and BLE400 board. I managed to compile and upload the examples from SDK 11.0.0 to the device with SEGGER Embedded Studio and I can advertise and connect to the device with nRF Connect app on my Android phone.

When I try to bond with nRF Connect it just hangs up after a couple of seconds. A similar thing happens if I try to pair with the phone directly.

Is there something I have to implement in the code of the example app?

Parents
  • Hi,

    I dug a little bit deeper and I get the PM_EVT_ERROR_UNEXPECTED error pm_evt_handler (I also switched to example from 12.2.0 now but the problem is still there)

    This is what happens:

    • I upload the code to device
    • Device starts advertising (led is blinking)
    • I scan with nRF Connect
    • I connect with nRF Connect (led is off)
    • I start bonding with nRF Connect (led is off)
    • Bonding fails (led is still off)
    • Device automatically disconnects (led is off)
    • Device automatically disconnects (led is off)
    • If I run scan again device isn't found anymore

    I managed to make it work but with this setup: #define SEC_PARAM_BOND 0
    #define SEC_PARAM_MITM 0
    #define SEC_PARAM_LESC 0
    #define SEC_PARAM_KEYPRESS 0
    #define SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_NONE
    #define SEC_PARAM_OOB 0
    #define SEC_PARAM_MIN_KEY_SIZE 7
    #define SEC_PARAM_MAX_KEY_SIZE 16

    and

    sec_param.kdist_own.enc = 0; sec_param.kdist_own.id = 0; sec_param.kdist_peer.enc = 0; sec_param.kdist_peer.id = 0;

    If I want to do any other combination with #define SEC_PARAM_BOND 1 it fails

Reply
  • Hi,

    I dug a little bit deeper and I get the PM_EVT_ERROR_UNEXPECTED error pm_evt_handler (I also switched to example from 12.2.0 now but the problem is still there)

    This is what happens:

    • I upload the code to device
    • Device starts advertising (led is blinking)
    • I scan with nRF Connect
    • I connect with nRF Connect (led is off)
    • I start bonding with nRF Connect (led is off)
    • Bonding fails (led is still off)
    • Device automatically disconnects (led is off)
    • Device automatically disconnects (led is off)
    • If I run scan again device isn't found anymore

    I managed to make it work but with this setup: #define SEC_PARAM_BOND 0
    #define SEC_PARAM_MITM 0
    #define SEC_PARAM_LESC 0
    #define SEC_PARAM_KEYPRESS 0
    #define SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_NONE
    #define SEC_PARAM_OOB 0
    #define SEC_PARAM_MIN_KEY_SIZE 7
    #define SEC_PARAM_MAX_KEY_SIZE 16

    and

    sec_param.kdist_own.enc = 0; sec_param.kdist_own.id = 0; sec_param.kdist_peer.enc = 0; sec_param.kdist_peer.id = 0;

    If I want to do any other combination with #define SEC_PARAM_BOND 1 it fails

Children
No Data
Related