[nRF Connect SDK]Force to make pairing(bonding)

Target nRF52832(nrf52dk_nrf52832)
SDK NCS v2.0.0

I'm testing NCS 2.0 with Android 12.

Making pairing with Android, I call two API when connected.

bt_set_bondable(true);
bt_conn_set_security(conn, BT_SECURITY_L4);

It worked well so far (under Android 11)

BTW Android 12 make trouble security level 1 error.


[log]
00> HS connected
00> HS Connected 4A:B4:CA:22:85:2D (random)
00> Connection parameters updated.
00> interval: 6, latency: 0, timeout: 500
00> Conn params updated: interval 7 ms, latency 0, timeout: 5000 ms
00> Security failed: 4A:B4:CA:22:85:2D (random) level 1 err 2
00> Disconnected: 4A:B4:CA:22:85:2D (random) (reason 34)

Can I have another option to make pairing automatically?

Parents
  • Thanks for updating.

    1) Don't call bt_conn_set_security() on connected() callback, but start it for instance after 100ms after connected() callback or (for test) just use a button to call bt_conn_set_security() after connection is established.

    -> I test it but 1000ms delay was not effective. Please see source code attached
    main.c
    k_work_reschedule(&auth_work, K_MSEC(1000));

    8081.peripheral_uart.7z


    2) Additional test

    13Sep2022_B.zip


    You can find full text in readme.txt and snoop log in attached 

    I also made same case in MTK. and I am going to make case Qualcomm within a few days.
    We don't have another BLE sample that initiate (pairing) bonding so that I cannot tell who made this issue.

    *Failure case
    #3157: Android send pairing request
    -> But Nordic BLE did not send pairing response.

    *Success case
    #3255: Android send pairing request
    #3257: Nordic BLE send pairing response.

    It seems that there are no differences between #3255 and #3257 packet.
    We can reproduce this issue once when Bluetooth turned on in Android 12.
    Once pairing is made, Android can connect to BLE with security level 4.

    Please give me your opinion.

Reply
  • Thanks for updating.

    1) Don't call bt_conn_set_security() on connected() callback, but start it for instance after 100ms after connected() callback or (for test) just use a button to call bt_conn_set_security() after connection is established.

    -> I test it but 1000ms delay was not effective. Please see source code attached
    main.c
    k_work_reschedule(&auth_work, K_MSEC(1000));

    8081.peripheral_uart.7z


    2) Additional test

    13Sep2022_B.zip


    You can find full text in readme.txt and snoop log in attached 

    I also made same case in MTK. and I am going to make case Qualcomm within a few days.
    We don't have another BLE sample that initiate (pairing) bonding so that I cannot tell who made this issue.

    *Failure case
    #3157: Android send pairing request
    -> But Nordic BLE did not send pairing response.

    *Success case
    #3255: Android send pairing request
    #3257: Nordic BLE send pairing response.

    It seems that there are no differences between #3255 and #3257 packet.
    We can reproduce this issue once when Bluetooth turned on in Android 12.
    Once pairing is made, Android can connect to BLE with security level 4.

    Please give me your opinion.

Children
Related