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

NFC BLE pairing connection issue

Hi all,

I'm testing the ble_nfc_pairing_reference example from SDK 15.2.0

I have installed microECC and then run succesfully the application using Segger Embedded Studio on Windows.

At the first pairing, my Samsung g6 Android Smartphone can connect with the nrf52832 board, but they disconnect almost immediately (about 1 or 2 seconds). The RTT log captured from Debug interface are:

"<info> app: NFC Connection Handover BLE peripheral device example started.
<info> BUTTONS_M: LESC OOB MODE!
<info> BLE_M: Fast advertising.
<info> BLE_M: Connected.
<info> nrf_ble_lesc: Calling sd_ble_gap_lesc_dhkey_reply on conn_handle: 0
<info> BLE_M: BLE_GAP_EVT_CONN_SEC_UPDATE
<info> BLE_M: Security mode: 2
<info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 0, procedure: Bonding
<info> BLE_M: BLE_GAP_EVT_AUTH_STATUS
<info> BLE_M: Authorization succeeded!
<info> BLE_M: Disonnected"

And then, at the next pairing, they can not connect:

"<info> BLE_M: Connected.
<info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Bonding, error: 133
<info> BLE_M: BLE_GAP_EVT_AUTH_STATUS
<info> BLE_M: Authorization failed with code: 133!
<info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Bonding, error: 133
<info> BLE_M: BLE_GAP_EVT_AUTH_STATUS
<info> BLE_M: Authorization failed with code: 133!
<info> BLE_M: Disonnected "

I have tried also with Nexus 7 and found the same problem. So, I have 2 questions:

1. At the first pairing, why they disconnect almost immediately after a successful pairing? How we can do to keep the connection

2. Why they can not reconnect after losing the connection ? Do you have any ideas what could cause these errors? I wonder if I have missed an important step in configuration and coding.

Can you help me?
Many thanks in advance.

Parents
  • Hi,

    It sounds like you have forgotten to erase the bond information in your phone. If you delete the bonding information on the nRF side but not on the phone, the nRF will not allow the phone to bond again as it is a known bonded peer, but lacks the bonding information.

    Best Regards,

    Marjeris

  • Hi msromero,

    I have done "erase all" before each debugging, but I always have the same problem.

    If I try to print the reason when it gets the disconnect event, it shows ¨Disconnect reason: 19¨.
    This 19 (0x13) error code relates to BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION.

    It seems to have a problem during the encryption process. The android device can't understand and then cancel the newly established connection.

    I have tested also the Heart Rate Application with BLE Pairing Using NFC Pairing and the HID Keyboard Application with BLE pairing using NFC. I found the same problem. I clicked the "button 2" to erase bonds and delete all peers but nothing new.

    I don't know how to do now.

    Has anyone run correctly these example with a perfect connection between an android device and nrf52 board. Can you help me, thanks.

  • I think you are erasing the bond information on the nRF side, but have you done the same on the phone side? In the nRF Connect app click the nordic device in the scanner menu, then in the dropdown menu besides the "CONNECT" button up to the right, there is an option to delete bond information on the phone side. Can you try this?

Reply Children
  • Hi msromero,

    I have deleted all bonds on the phone side, close the app and reopen every time, but nothing change.

    Today, I have just tested the BLE Heart Rate Collector Example with NFC Pairing with 2 nrf52832 boards: one attached with Adafruit PN532 NFC Shield and the other attached with NFC antenna. It works very well with a correctly pairing. I can disconnect by clicking the button and reconnect again easily.

    So, this issue is obviously related to the Android device side. I still have no idea what I must change in the code.

  • Hi,

    I am thinking maybe there is a possibility that the phones you are trying to pair to do not support pairing through "LE secure". Which phones are you using? Nexus 7 and Samsung galaxy S6? From the log output you can see the phone try to connect using security mode 2, they should use security mode 4 (LE Secure).

    LE secure pairing was introduce with Bluetooth 4.2, and from what I found on the internet Samsung S6 only supports Bluetooth 4.1. You can try pairing through Legacy OOB (Button 3) and see if you get the same problem.

    And to find more information while debugging you can change the debug level in the sdk_config.h file to "Debug"

    // <o> NRF_LOG_DEFAULT_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef NRF_LOG_DEFAULT_LEVEL
    #define NRF_LOG_DEFAULT_LEVEL 4
    #endif

    And set the Build configuration to the "Debug".

    Best Regards,

    Marjeris

  • Hello I have the same exact problem that HDuc has, and I am using a samsung galaxy s7, which supports Bluetooth 4.2 LE, so the problem is in Nordic MCU Dk side of development. There has to be an issue in the C code, or MCU design.

  • Hi msromero,

    Thank you for your reply.

    I have tested all 3 options: LESC OOB MODE, LEGACY OOB MODE, LEGACY JUST WORKS MODE, but I found the same problem. So, this issue maybe not related to the pairing support through "LE secure". I think almost due to bonding problems.

    When debugging, it asks me about the "nfc_t2t_lib.c" file; I can not find it in the sdk folder, I do not know it's important or not.

  • Hei Nguyen,

    The debugging message about "nfc_t2t_lib.c" is normal. NFC lib is delivered as a linkable library, so we don't have any source files available, just ignore the message.

    Ok so I think I found the problem now. Did you touch the kit with the phone two times? Android erase the bonds the second time the NFC touch the kit, while the LTK is still stored in the DK. So you need to run a "erase all" on the kit before trying again.

    Best Regards,

    Marjeris

Related