BLE Just Works on nrf52832 and NRF Connect

Hi, I am working on something that requires me to use Just Works on nrf52832 custom board. Here is the work sccenario. under normal conditions, my module has a bonding PIN and the user is supposed to enter the PIN on his application to get data. My NRF module is a peripheral and i have enabled following in the prj.conf.


CONFIG_BT_NUS_SECURITY_ENABLED

CONFIG_BT_FIXED_PASSKEY

I have registered the necessary callbacks too.

What I now need to implement is a functionality which allows user to bond without a PIN temporarily after a button press. I assume BLE Just Works is what I need for this purpose. But I am open to any other suggestions or new perspectives to get this done.Thanks in advance.

  • Hi Midhunjac, 

    Pairing failed reason 4 means: 

        /** The requested security level could not be reached. */
        BT_SECURITY_ERR_AUTH_REQUIREMENT,

    Could you give some more information on how you tested ? 

    - Which central device did you use ? 

    - How did you do the test, have you tried to remove the previous bond  ? I suspect that it may have something to do with that. You may need to call bt_unpair() or can simply do a chip erase and then reflash for testing. 

    - Please try to capture a sniffer trace of the bonding process.  We would need to see exactly what exchanged between the peers. 

  • Hi,

    my central device is my phone running the nrf connect android application. In the scanner page of the application, instead of clicking on the 'Connect' button, I click on the kebab icon on the connect button and it shows me an option to bond. I use that to check the bonding.
    Additionally, i just tried with the nrf52 dongle and the NRF Connect for desktop to bond. But when i try to bond with the device, this is what I get on the desktop app.

    Before I test, I erase and reflash the chip.
    Is my method of testing wrong? If so, how should I test ?

    16:23:22.682
    Connecting to device
    16:23:22.742
    Connected to device CD:DB:D6:42:56:FE: interval: 7.5ms, timeout: 4000ms, latency: 0
    16:23:22.826
    Phy updated for device CD:DB:D6:42:56:FE, tx: 2 Mb/s, rx: 2 Mb/s
    16:23:23.028
    Attribute value read, handle: 0x0B, value (0x): 4E-6F-72-64-69-63-5F-55-41-52-54-5F-53-65-72-76-69-63-65
    16:23:27.794
    Connection parameters updated for device CD:DB:D6:42:56:FE: interval 30ms, timeout 420ms, latency: 0
    16:23:40.674
    Authentication failed with status BLE_GAP_SEC_STATUS_UNSPECIFIED
  • Hi Midhunjac, 

    Please try capturing a sniffer trace of the process. 

    I attached here a quick example that I modified from the peripheral_uart sample, SDK v2.1.2. 

    If you press button 3 it will erase all bond. If you press button 4 it will switch the pairing response from supporting MITM to not supporting MITM ( no display , no keyboard, just work). If you want to have display capability again you would need to modify the code to have another button to enable that or just reset the board. 

    peripheral_uart_changebond.zip

  • Hi, i am working on the sniffer API. But I just wanted to let you know that the source code you provided did not work as expected. I tried in the v2.1.0 SDK as well as the 2.1.2. It behaved the same in both cases. When I press button 4, in you code, the device connects and then suddenly disconnects on its own.

    Is there any explanation for this behavior ?

    Also, can you please confirm if the code that you provided worked in the SDKv2.1.2. Are there any changes in this general area in the SDK V2.1.1 and above ?

  • Hi Midhunjac, 
    I'm not sure if you need to do anything with the sniffer API. To run the sniffer you just need to copy it to wireshark folder and use Wireshark to capture. You don't need to work with the API directly. 
    Please make sure you erase bonding on the phone's side before testing. 

Related