5340, Zephyr failure to connect to Polar Heart rate strap; ble wireshark trace

Hi ,

I have compiled in Heart rat relay into my app; can scan and connect to simulator and garmin HR straps; but fail to connect to polar.
My debug log shows...



So security is encryption, no auth and I get an "unspecified" error.

I have done a BLE wireshark trace; but cannot see anything in the trace to indicate the issue.

Would be grateful if someon could look and give me a clue to whats going wrong.

Here is wireshark trace....

polarHrmActiveScanConnectFail.pcapng

Regards,

Owain

Parents Reply Children
  • Here more debug but with CONFIG_BT_DEBUG_SMP=y

    033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.016,998] \033[0m<inf> app: connected: Central: connected to F0:C9:75:7D:CB:FF (random)
    \033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.017,059] \033[0m<inf> app: connected: security is currently 1
    \033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.017,150] \033[0m<dbg> bt_smp: smp_send_pairing_req: \033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.018,615] \033[0m<dbg> bt_smp: smp_init: prnd 2ec0d9a9193c2b1b54b14f14734e4279\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.018,768] \033[0m<inf> app: connected: security set to BT_SECURITY_L2
    \033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.020,782] \033[0m<inf> app: systemProcessThread: System got EVENT_BLE_PERIPHERAL_CONNECTED\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.517,974] \033[0m<dbg> bt_smp: bt_smp_recv: Received SMP code 0x02 len 6\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.518,035] \033[0m<dbg> bt_smp: smp_pairing_rsp: \033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.518,127] \033[0m<dbg> bt_smp: legacy_pairing_rsp: \033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.518,280] \033[0m<dbg> bt_smp: smp_c1: k 00000000000000000000000000000000\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.518,371] \033[0m<dbg> bt_smp: smp_c1: r 2ec0d9a9193c2b1b54b14f14734e4279\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.518,554] \033[0m<dbg> bt_smp: smp_c1: ia 40:68:15:E7:B9:37 (random)\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.518,737] \033[0m<dbg> bt_smp: smp_c1: ra F0:C9:75:7D:CB:FF (random)\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.518,829] \033[0m<dbg> bt_smp: smp_c1: preq 0100000d100707\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.518,890] \033[0m<dbg> bt_smp: smp_c1: pres 02030001100303\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.518,981] \033[0m<dbg> bt_smp: smp_c1: p1 01010100000d10070702030001100303\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:12.519,256] \033[0m<dbg> bt_smp: smp_c1: p2 ffcb7d75c9f037b9e715684000000000\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.018,035] \033[0m<dbg> bt_smp: bt_smp_recv: Received SMP code 0x03 len 16\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.018,127] \033[0m<dbg> bt_smp: smp_pairing_confirm: \033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.518,066] \033[0m<dbg> bt_smp: bt_smp_recv: Received SMP code 0x04 len 16\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.518,127] \033[0m<dbg> bt_smp: smp_pairing_random: \033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.518,188] \033[0m<dbg> bt_smp: legacy_pairing_random: \033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.518,280] \033[0m<dbg> bt_smp: smp_c1: k 00000000000000000000000000000000\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.518,371] \033[0m<dbg> bt_smp: smp_c1: r d316e0f3d51aaefd4c0a38df9f5ec1cb\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.518,554] \033[0m<dbg> bt_smp: smp_c1: ia 40:68:15:E7:B9:37 (random)\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.518,737] \033[0m<dbg> bt_smp: smp_c1: ra F0:C9:75:7D:CB:FF (random)\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.518,829] \033[0m<dbg> bt_smp: smp_c1: preq 0100000d100707\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.518,890] \033[0m<dbg> bt_smp: smp_c1: pres 02030001100303\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.519,012] \033[0m<dbg> bt_smp: smp_c1: p1 01010100000d10070702030001100303\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.519,287] \033[0m<dbg> bt_smp: smp_c1: p2 ffcb7d75c9f037b9e715684000000000\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.519,531] \033[0m<dbg> bt_smp: legacy_pairing_random: pcnf 2e7254e2fc169911f174a35f9f321152\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:13.519,622] \033[0m<dbg> bt_smp: legacy_pairing_random: cfm 2e7254e2fc169911f174a35f9f321152\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:28.018,096] \033[0m<dbg> bt_smp: bt_smp_disconnected: chan 0x20009bec cid 0x0006\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:28.018,188] \033[0m<dbg> bt_smp: smp_pairing_complete: status 0x8\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:28.024,200] \033[0m<dbg> bt_smp: bt_smp_encrypt_change: chan 0x20009bec conn 0x20009790 handle 0 encrypt 0x00 hci status 0x1f\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:28.024,261] \033[0m<dbg> bt_smp: smp_pairing_complete: status 0x8\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:28.024,444] \033[0m<inf> app: authPairingFailed: Pairing failed: F0:C9:75:7D:CB:FF (random) reason: 9
    \033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:28.024,719] \033[0m<inf> app: securityChanged: Security failed: F0:C9:75:7D:CB:FF (random) level 1 err 9
    \033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:28.024,780] \033[1;31m<err> bt_gatt_dm: bt_gatt_dm_start: Discover failed, error: -128.\033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:28.024,841] \033[0m<inf> app: gatt_discover: Could not start the discovery procedure, error code: -128
    \033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:28.030,883] \033[0m<inf> app: disconnected: Peripheral disconnected (reason 0x08)
    \033[0m
    \033[1;32mnovaPro>\033[m\033[8D\033[J\033[1;32mnovaPro>\033[m\033[8D\033[J[00:01:28.031,372] \033[0m<inf> app: systemProcessThread: System got EVENT_BLE_PERIPHERAL_DISCONNECTED\033[0m
    \

  • Hi Owain,

    Have you tried to test using the central_uart example to connect to the Polar ? 

  • Hi Hung,

    central uart or central heart rate example?

    Our device is both a central and a peripheral. One can connect from a mobile to manage our device; but it can connect to peripherals. 

    Looking at the central heartrate example it works quite differntly to the uart example; it also does not change the security level. Note the Garmin strap works fine changing level to 2.

    Regards,
    Owain

  • Hi Owain, 
    Sorry my mistake. My idea is to use central_uart because it has similar behavior as your application to require L2 when connected. But I forgot that it won't connect to the polar HR because it's different UUID.


    What you can do is to change the scan_init() to filter the HRS UUID instead of the NUS UUID. The goal is to make it connect and pair to the Polar HR. You can remove any code related to NUS client. 

    I just want to have a very simple application that connect and pair and do nothing else. The prj.conf should be kept the same as in the sample.  If it works we can try to compare it with your application to see what cause the issue. 

  • Hi Hung,

    I have taken the uart example as you suggest; I have had to make some small changes to ensure HCI RPMSG is used rather than HCI H4.

    This the outpu from the test on the console;  looks that same as my own project; fails on the security change.

    *** Booting Zephyr OS build v3.2.99-ncs1 ***
    [00:00:00.259,552] \033[0m<inf> fs_nvs: 2 Sectors of 4096 bytes\033[0m
    [00:00:00.259,552] \033[0m<inf> fs_nvs: alloc wra: 0, ec0\033[0m
    [00:00:00.259,552] \033[0m<inf> fs_nvs: data wra: 0, 154\033[0m
    [00:00:00.284,606] \033[0m<inf> bt_hci_core: No ID address. App must call settings_load()\033[0m
    [00:00:00.284,637] \033[0m<inf> central_hr: Bluetooth initialized\033[0m
    [00:00:00.286,254] \033[1;31m<err> settings: set-value failure. key: bt/name error(-2)\033[0m
    [00:00:00.287,139] \033[0m<inf> central_hr: Scan module initialized\033[0m
    Starting Bluetooth Central HR example
    [00:00:00.289,978] \033[0m<inf> central_hr: Scanning successfully started\033[0m
    [00:00:01.612,976] \033[0m<inf> central_hr: Filters matched. Address: E0:EF:E7:CA:6A:68 (random) connectable: 1\033[0m
    [00:00:02.115,417] \033[0m<inf> central_hr: Connected: E0:EF:E7:CA:6A:68 (random)\033[0m
    [00:00:02.167,572] \033[0m<inf> central_hr: MTU exchange done\033[0m
    [00:00:17.817,810] \033[1;33m<wrn> central_hr: Pairing failed conn: E0:EF:E7:CA:6A:68 (random), rea[00:01:05.502,258] \033[1;33m<wrn> central_hr: Pairing failed conn: E0:EF:E7:CA:6A:68 (random), reason 9\033[0m
    [00:01:05.502,410] \033[1;33m<wrn> central_hr: Security failed: E0:EF:E7:CA:6A:68 (random) level 1 err 9\033[0m
    [00:01:05.502,441] \033[1;31m<err> bt_gatt_dm: Discover failed, error: -128.\033[0m
    [00:01:05.502,441] \033[1;31m<err> central_hr: could not start the discovery procedure, error code: -128\033[0m
    [00:01:05.503,570] \033[0m<inf> central_hr: Disconnected: E0:EF:E7:CA:6A:68 (random) (reason 8)\033[0m
    


    This was built using ncs 2.2.0.

    6305.central_uart.zip

Related