[nRF Connect SDK] Pairing failure

Target nRF52832(nrf52dk_nrf52832)
SDK NCS v2.0.0

original case
(+) [nRF Connect SDK]Force to make pairing(bonding) - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com)

Here is my test step. (Nordic: peripheral role)

1) Nordic begins advertising (custom UUID like peripheral_uart sample)
2) Android app gets predefined bt mac (example 00:16:7F:11:22:36).
There were no BLE scan. and connect to Nordic.

3) Nordic connected and initiate pairing
bt_set_bondable(true);
bt_conn_set_security(conn, BT_SECURITY_L4);

Result
Much of case my Android (MTK) failed to make pairing. (Especially right after android rebooted) 

MTK have told me Nordic should provide solution to resolve this issue.

RTT Viewer
00> Connected secmode 4
00> HS connected
00> HS Connected 00:16:7F:40:1E:D0 (public)
00> D:
00> D: 00:16:7F:40:1E:D0 (public)
00> D: prnd 7d93ec3b4828ce3b4210d054f903653a
00> D: chan 0x20001f54 cid 0x0006
00> D: status 0x8
00> D: chan 0x20001f54 conn 0x20001c90 handle 0 encrypt 0x00 hci status 0x1f
00> Security failed: 00:16:7F:40:1E:D0 (public) level 1 err 9
(Android public mac 00:16:7F:40:1E:D0)

2772.sf650_error_03Nov2022.7z



BTW, Nordic required sniff log for analyzing pairing error. However, I hardly get sniff log.
I can get CONNECT_IND then drops next packets. Do you have any idea?






nrf_sniffer_for_bluetooth_le_4.1.1
wireshark 4.0.1
nRF52DK dev borad
J-Link 6.88a


Parents
  • 00> HS:Advertising successfully started
    00> D: 55:A6:42:65:6B:D0 (random)
    00> D: No IRK for 55:A6:42:65:6B:D0 (random)
    00> D: conn 0x20001c88 handle 0
    00> D: chan 0x20001f4c cid 0x0006
    00> D: 55:A6:42:65:6B:D0 (random)
    00> Connected secmode 4
    00> HS connected
    00> HS Connected 55:A6:42:65:6B:D0 (random)
    00> D: 
    00> D: 55:A6:42:65:6B:D0 (random)
    00> D: created 0x200029dc for 55:A6:42:65:6B:D0 (random)
    00> D: prnd 23a14c89ca6eb11b5c0c56610146bb35
    00> Connection parameters updated.
    00>  interval: 6, latency: 0, timeout: 500
    00> Conn params updated: interval 7 ms, latency 0, timeout: 5000 ms
    00> W: Ignoring unexpected request
    00> W: Ignoring unexpected request
    00> D: chan 0x20001f4c cid 0x0006
    00> D: status 0x8
    00> D: 55:A6:42:65:6B:D0 (random) (keys 0x0000)
    00> D: Deleting key bt/keys/55a642656bd01
    00> D: chan 0x20001f4c conn 0x20001c88 handle 0 encrypt 0x00 hci status 0x1f
    00> Security failed: 55:A6:42:65:6B:D0 (random) level 1 err 9 
    00> D: 55:A6:42:65:6B:D0 (random)
    00> D: 00:00:00:00:00:00 (public) (keys 0x0000)
    00> D: Deleting key bt/keys/0000000000000
    00> D: 55:A6:42:65:6B:D0 (random)
    00> D: 55:A6:42:65:6B:D0 (random)
    00> Disconnected: 55:A6:42:65:6B:D0 (random) (reason 19) 
    00> HS:Advertising successfully started

    sniff.7z

    sniff log is uploaded as well as rtt log.
    Your message will be forwarded to MTK HQ again.

    I have no idea what made following error. Can you please find in sniff log?
    00> D: chan 0x20001f4c conn 0x20001c88 handle 0 encrypt 0x00 hci status 0x1f

  • Hi Tim,

    Sorry but I feel confused a bit about your situation here.

    I am not sure how that case is related to this current question. Could you please elaborate?

    Much of case my Android (MTK) failed to make pairing. (Especially right after android rebooted) 

    MTK have told me Nordic should provide solution to resolve this issue.

    Does MTK mean MediaTek?

    What reasoning did they give to believe Nordic should provide the solution to resolve this issue?

    On my end, I attempted to pair using bt_conn_set_security() as you did, and both my Android phone and my Windows PC can bond with the device without any problem.
    Pairing at Security Level 4 like you are trying to do also require an out of band verification method. On your RTT log I don't see signs of this happened. What did you do to achieve this?

    Tim Hwang said:
    I have no idea what made following error. Can you please find in sniff log?
    00> D: chan 0x20001f4c conn 0x20001c88 handle 0 encrypt 0x00 hci status 0x1f

    That is not an error. It is most likely just a log from smp.c. See sdk-zephyr/smp.c.

    Finally, I would like to ask for a few pieces of information to understand the situation better:

    What is your current setup?
    What module did you enable logging to acquire the RTT log you shared?
    Is there a specific sample are you experimenting on?
    What SDK version are you on?
    These pieces of information help making sense out of the logs you provided.

    Best regards,

    Hieu

  • One more question:

    6. If you add CONFIG_BT_SMP_ENFORCE_MITM=n to your app, can pairing consistently work?

  • Thank you for your kind response.

    0. For app log: 
    nRF Connect, 2022-11-14
    Nordic_UART_Service (00:16:7F:11:22:36)
    V 14:27:21.563 Connecting to 00:16:7F:11:22:36...
    D 14:27:21.564 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D 14:27:22.357 [Callback] Connection state changed with status: 133 and new state: DISCONNECTED (0)
    E 14:27:22.357 Error 133 (0x85): GATT ERROR
    I 14:27:22.357 Disconnected

    1. Can your Android app or device consistently successfully pair with any BLE device? A BLE mouse, for example?
    -> Pairing failed at first time after reboot or Bluetooth turned on. I try again, pairing works. 

    2. Can your current nRF52 device consistently successfully pair with any Android/iOS/Windows device?
    -> If nRF52 device means my project, the answer is Yes.

    3. Are you working in an environment with a lot of 2.4GHz signals?
    -> It is noisy somehow. But other Androids work well. Noise does not matter, I guess.

    4. Is there any reason why you push aside my request for sniffer logs with the pairing procedure?
    -> I spent lots of time for taking sniffer log. But I could not get air log well. so I asked logging know-how.

    5. Can you also zip up and send us the modified peripheral_uart project which you are using? You can use west build -t clean to remove all build artifacts to keep the file light.
    -> peripheral_uart_1114_MTK.case.7z

    6. CONFIG_BT_SMP_ENFORCE_MITM=n
    -> It seems that there was no difference.
    ----------------------------------------------------------------------------------

    1. "hci status 0x1f"
    12 days ago, I had no idea about "hci status 0x1f" so I made this case
    D: chan 0x20001f54 conn 0x20001c90 handle 0 encrypt 0x00 hci status 0x1f

    Now I understand where 0x1f is from. And you told me what 0x5 is too.
    And I could get event 0x5 with unexpected Android disconnection (for example I put it shield box)
    00> [00:02:19.647,460] <dbg> sdc_hci_driver: event_packet_process: Event (0x05) len 4

    2. "No pairing reponse"
    1) Nordic sent security request,
    2) MTK send pairing request,
    3) but Nordic did not send pairing response.

    In sf650_error_03Nov2022.pcapng, we could see this symptom in this log.
    (Unfortunately, Sniff logs are different every time with Nordic sniffer, Lots of packets are dropped)
    In this case, RTT log had Event(0x5) but air log shows MTK send packets to Nordic.
    What do you think about that? 

    5466.sf650_error_03Nov2022.pcapng


    3. Work with MTK
    This issue already reported to MTK and I provided Nordic nRF52 DK Ev board with my code
    (peripheral_uart_1114_MTK.7z) They will get it soon. And test it by themselves. 




  • 6. CONFIG_BT_SMP_ENFORCE_MITM=n
    -> It seems that there was no difference.

  • Hi Tim,

    My apology for the long wait with no follow up.

    I am having some health issues and will likely be out of office for a few more days.

    I will let you know when I can reply to your question as soon as possible.

    Hieu

  • I hope you get better. 

    I sent Nordic Evaluation board to my partner in China, and they can reproduce this issue.
    Further analysis is delayed due to covid19 in China. I will ask you again when MTK request is arrived.
    I'll hold this case until then.

    Thank you.

Reply Children
Related