Communicate two microcontrollers via BLE

Hello,

I'm using a nRF52 DK to test BLE communication with another microcontroller. What I need to test is the nRF52 pairing with another brand microcontroller, send a data stream and close the connection.

Could you please tell me which example from the Bluetooth samples list I can use for starting?

Thanks for your attention.

Regards,

Parents
  • Hello ,

    Thank you very much. I've reviewed this example and it is supposed to connect with the first device with an strong signal. Is there a way to force the board to connect with the device with a given MAC address?

  • Hello,

    It's difficult to troubleshoot this without having the ESP to test against. But it looks like it worked better before you made the changes I suggested. Can you revert back to when the discovery worked? Then swap the TX and RX UUID (BT_UUID_NUS_TX_VAL & BT_UUID_NUS_RX_VAL) and see if that improves anything. Doing this should fix the warning you got here: 

    [00:00:30.978,515] <err> nus_c: bt_nus_handles_assign: Missing NUS TX CCC in characteristic

  • Hello,

    I've rolled-back to the previous version and I don't have the warning you've mentioned. Nevertheless, the discovery service is not found:

    *** Booting Zephyr OS build v3.2.99-ncs2 ***
    bt_conn_auth_cb_register
    bt_conn_auth_info_cb_register err: 0
    bt_enable err: 0
    Bluetooth initialized
    uart_init
    scan_init
    Address filter added 60:55:F9:F5:29:D2 (public)
    Scan module initialized
    bt_nus_client_init
    NUS Client module initialized
    
    Starting Bluetooth Central UART example
    scan err: 0
    Scanning
    Scanning successfully started
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:00.017,425] <inf> fs_nvs: nvs_mount: 6 Sectors of 4096 bytes
    [00:00:00.017,456] <inf> fs_nvs: nvs_mount: alloc wra: 0, fe8
    [00:00:00.017,486] <inf> fs_nvs: nvs_mount: data wra: 0, 0
    [00:00:00.017,639] <inf> bt_sdc_hci_driver: hci_driver_open: SoftDevice Controller build revision: 
                                                d8 0c 2d 2f 36 ae e2 5c  80 26 80 4c 3f 4d 16 53 |..-/6..\ .&.L?M.S
                                                50 96 c7 73                                      |P..s             
    [00:00:00.020,965] <inf> bt_hci_core: hci_vs_init: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.021,026] <inf> bt_hci_core: hci_vs_init: HW Variant: nRF52x (0x0002)
    [00:00:00.021,057] <inf> connected conn_err: 0
    Connected: 60:55:F9:F5:29:D2 (public)
    bt_hci_core: hci_vs_init: Firmware: Standard Bluetooth controller (0x00) Version 216.11532 Build 3803067951
    [00:00:00.021,606] <inf> bt_hci_core: bt_init: No ID address. App must call settings_load()
    [00:00:00.025,115] <inf> central_uart: main: Bluetooth initialized
    [00:00:00.025,756] <inf> bt_hci_core: bt_dev_show_info: Identity: D7:C8:04:2D:97:BA (random)
    [00:00:00.025,787] <inf> bt_hci_core: bt_dev_show_info: HCI: version 5.3 (0x0c) revision 0x124b, manufacturer 0x0059
    [00:00:00.025,848] <inf> bt_hci_core: bt_dev_show_info: LMP: version 5.3 (0x0c) subver 0x124b
    [00:00:00.034,179] <inf> central_uart: scan_init: Scan module initialized
    [00:00:00.039,672] <inf> central_uart: nus_client_init: NUS Client module initialized
    [00:00:00.052,734] <inf> central_uart: main: Scanning successfully started
    [00:00:00.057,098] <inf> central_uart: scan_filter_match: Filters matched. Address: 60:55:F9:F5:29:D2 (public) connectable: 1
    [00:00:00.059,356] <inf> central_uart: scan_filter_match: Filters matched. Address: 60:55:F9:F5:29:D2 (public) connectable: 0
    [00:00:00.059,387] <wrn> central_uart: scan_connecting_error: Connecting failed
    [00:00:00.062,316] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:00.068,603] <wrn> central_uart: main: NUS send timeout
    [00:00:00.223,999] <inf> central_uart: connected: Connected: 60:55:F9:F5:29:D2 (public)
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:00.521,972] <inf> central_uart: exchange_func: MTU exchange done
    [00:00:01.073,120] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:01.079,315] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:02.083,709] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:02.089,935] <wrn> central_uart: main: NUS send timeout
    [00:00:03.094,238] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:03.100,433] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:04.104,827] <wrn> central_uart: main: Failed to sreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    end data over BLE connection(err -128)
    [00:00:04.111,022] <wrn> central_uart: main: NUS send timeout
    [00:00:05.115,325] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:05.121,887] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:06.126,220] <wrn> central_uart: main: Failed to sendreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
     data over BLE connection(err -128)
    [00:00:06.132,446] <wrn> central_uart: main: NUS send timeout
    [00:00:07.136,779] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:07.143,005] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:08.147,338] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:08.153,564] <wrn> central_uart: main: NUS send timeout
    [00:00:09.157,775] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:09.164,001] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:10.168,273] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:10.174,835] <wrn> central_uart: main: NUS send timeout
    [00:00:11.179,107] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:11.185,333] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:12.189,727] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:12.195,953] <wrn> central_uart: main: NUS send timeout
    [00:00:13.200,225] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:13.206,451] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:14.210,723] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:14.216,949] <wrn> central_uart: main: NUS send timeout
    [00:00:15.221,466] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:15.227,722] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:16.232,025] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:16.238,250] <wrn> central_uart: main: NUS send timeout
    [00:00:17.242,462] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:17.248,687] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:18.253,021] <wrn> central_uart: main: Failed to senreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    d data over BLE connection(err -128)
    [00:00:18.259,216] <wrn> central_uart: main: NUS send timeout
    [00:00:19.263,427] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:19.269,653] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:20.274,200] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:20.280,395] <wrn> central_uart: main: NUS send timeout
    [00:00:21.284,698] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:21.290,924] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:22.295,196] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:22.301,422] <wrn> central_uart: main: NUS send timeout
    [00:00:23.305,694] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:23.311,889] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:24.316,192] <wrn> central_uart: main: Failed to sendreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
     data over BLE connection(err -128)
    [00:00:24.322,723] <wrn> central_uart: main: NUS send timeout
    [00:00:25.327,117] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:25.333,343] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:26.337,677] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:26.343,902] <wrn> central_uart: main: NUS send timeout
    [00:00:27.348,175] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:27.354,400] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:28.358,734] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:28.364,929] <wrn> central_uart: main: NUS send timeout
    [00:00:29.369,171] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:29.375,518] <wrn> central_uart: main: NUS send timeout
    Pairing failed conn: 60:55:F9:F5:29:D2 (public), reason 9
    Service not found
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:30.229,705] <err> bt_smp: smp_timeout: SMP Timeout
    [00:00:30.230,316] <wrn> central_uart: security_changed: Security failed: 60:55:F9:F5:29:D2 (public) level 1 err 9
    [00:00:30.230,682] <wrn> central_uart: pairing_failed: Pairing failed conn: 60:55:F9:F5:29:D2 (public), reason 9
    [00:00:30.321,960] <inf> central_uart: discovery_service_not_found: Service not found
    [00:00:30.379,913] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:30.386,138] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:31.390,441] <wrn> central_uart: main: Failed to sreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    end data over BLE connection(err -128)
    [00:00:31.396,636] <wrn> central_uart: main: NUS send timeout
    [00:00:32.400,909] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:32.407,165] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:33.411,437] <wrn> central_uart: main: Failed to sreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    end data over BLE connection(err -128)
    [00:00:33.417,663] <wrn> central_uart: main: NUS send timeout
    [00:00:34.422,332] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:34.428,527] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:35.432,922] <wrn> central_uart: main: Failed to sreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    end data over BLE connection(err -128)
    [00:00:35.439,147] <wrn> central_uart: main: NUS send timeout
    [00:00:36.443,389] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:36.449,615] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:37.453,918] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:37.460,113] <wrn> central_uart: main: NUS send timeout
    [00:00:38.464,416] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:38.470,642] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:39.475,036] <wrn> central_uart: main: Failed to senreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    d data over BLE connection(err -128)
    [00:00:39.481,231] <wrn> central_uart: main: NUS send timeout
    [00:00:40.485,595] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:40.491,821] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:41.496,124] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:41.502,349] <wrn> central_uart: main: NUS send timeout
    [00:00:42.506,622] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:42.512,817] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:43.517,089] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:43.523,437] <wrn> central_uart: main: NUS send timeout
    [00:00:44.527,709] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:44.533,935] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:45.538,299] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:45.544,494] <wrn> central_uart: main: NUS send timeout
    [00:00:46.548,797] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:46.554,992] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:47.559,295] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:47.565,490] <wrn> central_uart: main: NUS send timeout
    [00:00:48.569,793] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:48.576,110] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:49.580,413] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:49.586,639] <wrn> central_uart: main: NUS send timeout
    [00:00:50.590,972] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:50.597,198] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:51.601,531] <wrn> central_uart: main: Failed to sreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    end data over BLE connection(err -128)
    [00:00:51.607,727] <wrn> central_uart: main: NUS send timeout
    [00:00:52.611,999] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:52.618,225] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:53.622,711] <wrn> central_uart: main: Failed to senreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    d data over BLE connection(err -128)
    [00:00:53.628,967] <wrn> central_uart: main: NUS send timeout
    [00:00:54.633,300] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:54.639,526] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:55.643,829] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:55.650,054] <wrn> central_uart: main: NUS send timeout
    [00:00:56.654,357] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:56.660,552] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:57.664,825] <wrn> central_uart: main: Failed to senreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    d data over BLE connection(err -128)
    [00:00:57.671,234] <wrn> central_uart: main: NUS send timeout
    [00:00:58.675,659] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:58.681,884] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:59.686,187] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:59.692,413] <wrn> central_uart: main: NUS send timeout
    [00:01:00.696,716] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:00.702,941] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:01.707,305] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:01:01.713,500] <wrn> central_uart: main: NUS send timeout
    [00:01:02.717,864] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:02.724,151] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:03.728,454] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:01:03.734,649] <wrn> central_uart: main: NUS send timeout
    [00:01:04.738,922] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:04.745,117] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:05.749,481] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:01:05.755,706] <wrn> central_uart: main: NUS send timeout
    [00:01:06.759,918] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:06.766,113] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:07.770,416] <wrn> central_uart: main: Failed to return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    send data over BLE connection(err -128)
    [00:01:07.776,885] <wrn> central_uart: main: NUS send timeout
    [00:01:08.781,158] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:08.787,353] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:09.791,717] <wrn> central_uart: main: Failed to senreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    d data over BLE connection(err -128)
    [00:01:09.797,943] <wrn> central_uart: main: NUS send timeout
    [00:01:10.802,246] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:10.808,471] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:11.812,835] <wrn> central_uart: main: Failed to sendreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
     data over BLE connection(err -128)
    [00:01:11.819,061] <wrn> central_uart: main: NUS send timeout
    [00:01:12.823,730] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:12.829,956] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:13.834,320] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:01:13.840,515] <wrn> central_uart: main: NUS send timeout
    [00:01:14.844,909] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:14.851,104] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:15.855,438] <wrn> central_uart: main: Failed to sreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    end data over BLE connection(err -128)
    [00:01:15.861,663] <wrn> central_uart: main: NUS send timeout
    [00:01:16.865,936] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:16.872,222] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:17.876,617] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:01:17.882,843] <wrn> central_uart: main: NUS send timeout
    [00:01:18.887,145] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:18.893,341] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:19.897,735] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:01:19.903,961] <wrn> central_uart: main: NUS send timeout
    [00:01:20.908,264] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:20.914,489] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:21.918,762] <wrn> central_uart: main: Failed to sreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    end data over BLE connection(err -128)
    [00:01:21.925,292] <wrn> central_uart: main: NUS send timeout
    [00:01:22.929,626] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:22.935,821] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:23.940,124] <wrn> central_uart: main: Failed to sreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    end data over BLE connection(err -128)
    [00:01:23.946,350] <wrn> central_uart: main: NUS send timeout
    [00:01:24.950,622] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:24.956,817] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:25.961,212] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:01:25.967,407] <wrn> central_uart: main: NUS send timeout
    [00:01:26.972,015] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:26.978,210] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:27.982,604] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:01:27.988,830] <wrn> central_uart: main: NUS send timeout
    [00:01:28.993,072] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:28.999,267] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:30.003,570] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:01:30.009,796] <wrn> central_uart: main: NUS send timeout
    [00:01:31.014,068] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:31.020,294] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:32.024,627] <wrn> central_uart: main: Failed to senreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    d data over BLE connection(err -128)
    [00:01:32.030,853] <wrn> central_uart: main: NUS send timeout
    [00:01:33.035,186] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:33.041,381] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:01:34.045,745] <wrn> central_uart: main: Failed to senreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    d data over BLE connection(err -128)
    [00:01:34.051,971] <wrn> central_uart: main: NUS send timeout
    [00:01:35.056,304] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:01:35.062,500] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    

    On the ESP32 side I see that both terminals are connected but there is no data transmission.

  • ilHello,

    I have declared the UUID as follows:

    #define BT_UUID_NUS_VAL \
    	BT_UUID_128_ENCODE(0x0000FFFF, 0x0000, 0x1000, 0x8000, 0x00805F9B34FB)
    
    /** @brief UUID of the TX Characteristic. **/
    #define BT_UUID_NUS_TX_VAL \
    	BT_UUID_128_ENCODE(0x0000FF02, 0x0000, 0x1000, 0x8000, 0x00805F9B34FB)
    
    /** @brief UUID of the RX Characteristic. **/
    #define BT_UUID_NUS_RX_VAL \
    	BT_UUID_128_ENCODE(0x0000FF01, 0x0000, 0x1000, 0x8000, 0x00805F9B34FB)

    Now the discovery service seems to work better:

    *** Booting Zephyr OS build v3.2.99-ncs2 ***
    bt_conn_auth_cb_register
    bt_conn_auth_info_cb_register err: 0
    bt_enable err: 0
    Bluetooth initialized
    uart_init
    scan_init
    Address filter added 60:55:F9:F5:29:D2 (public)
    Scan module initialized
    bt_nus_client_init
    NUS Client module initialized
    
    Starting Bluetooth Central UART example
    scan err: 0
    Scanning
    Scanning successfully started
    [00:00:00.017,059] <inf> fs_nvs: nvs_mount: 6 Sectors of 4096 bytes
    [00:00:00.017,089] <inf> fs_nvs: nvs_mount: alloc wra: 0, fe8
    [00:00:00.017,120] <inf> fs_nvs: nvs_mount: data wra: 0, 0
    [00:00:00.017,272] <inf> bt_sdc_hci_driver: hci_driver_open: SoftDevice Controller build revision: 
                                                d8 0c 2d 2f 36 ae e2 5c  80 26 80 4c 3f 4d 16 53 |..-/6..\ .&.L?M.S
                                                50 96 c7 73                                      |P..s             
    [00:00:00.020,629] <inf> bt_hci_core: hci_vs_init: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.020,660] <inf> bt_hci_core: hci_vs_init: HW Variant: nRF52x (0x0002)
    [00:00:00.020,690] <inf> bt_hci_core: hci_vs_init: Firmware: Standard Bluetooth controller (0x00) Version 216.11532 Build 3803067951
    [00:00:00.021,270] <inf> bt_hci_core: bt_init: No ID address. App must call settings_load()
    [00:00:00.024,719] <inf> central_uart: main: Bluetooth initialized
    [00:00:00.025,390] <inf> bt_hci_core: bt_dev_show_info: Identity: D7:C8:04:2D:97:BA (random)
    [00:00:00.025,421] <inf> bt_hci_core: bt_dev_show_info: HCI: version 5.3 (0x0c) revision 0x124b, manufacturer 0x0059
    [00:00:00.025,482] <inf> bt_hci_core: bt_dev_show_info: LMP: version 5.3 (0x0c) subver 0x124b
    [00:00:00.033,905] <inf> central_uart: scan_init: Scan module initialized
    [00:00:00.039,428] <inf> central_uart: nus_client_init: NUS Client module initialized
    [00:00:00.052,368] <inf> central_uart: main: Scanning successfully started
    [00:00:00.308,563] <inf> central_uart: scan_filter_match: Filters matched. Address: 60:55:F9:F5:29:D2 (public) connectable: 1
    [00:00:00.310,913] <inf> central_uart: scan_filter_match: Filters matched. Address: 60:55:F9:F5:29:D2 (public) connectable: 0
    [00:00:00.310,913] <wrn> central_uart: scan_connecting_error: Connecting failed
    connected conn_err: 0
    Connected: 60:55:F9:F5:29:D2 (public)
    [00:00:00.476,348] <inf> central_uart: connected: Connected: 60:55:F9:F5:29:D2 (public)
    [00:00:00.774,749] <inf> central_uart: exchange_func: MTU exchange done
    Pairing failed conn: 60:55:F9:F5:29:D2 (public), reason 9
    Service discovery completed
    ATT[1]:         UUID: 0x2803    Handle: 0x0029  Value:
            Characteristic: 0xff01  Properties: 0x0008
    ATT[2]:         UUID: 0xff01    Handle: 0x002A  Value:
    ATT[3]:         UUID: 0x2803    Handle: 0x002B  Value:
            Characteristic: 0xff02  Properties: 0x0012
    ATT[4]:         UUID: 0xff02    Handle: 0x002C  Value:
    ATT[5]:         UUID: 0x2902    Handle: 0x002D  Value:
            CCCD
    [00:00:30.482,025] <err> bt_smp: smp_timeout: SMP Timeout
    [00:00:30.482,666] <wrn> central_uart: security_changed: Security failed: 60:55:F9:F5:29:D2 (public) level 1 err 9
    [00:00:30.483,032] <wrn> central_uart: pairing_failed: Pairing failed conn: 60:55:F9:F5:29:D2 (public), reason 9
    [00:00:31.124,694] <inf> central_uart: discovery_complete: Service discovery completed
    

    If I reactivate the 'bt_nus_client_send' function in the main loop I still have connection errors:

    *** Booting Zephyr OS build v3.2.99-ncs2 ***
    bt_conn_auth_cb_register
    bt_conn_auth_info_cb_register err: 0
    bt_enable err: 0
    Bluetooth initialized
    uart_init
    scan_init
    Address filter added 60:55:F9:F5:29:D2 (public)
    Scan module initialized
    bt_nus_client_init
    NUS Client module initialized
    
    Starting Bluetooth Central UART example
    scan err: 0
    Scanning
    Scanning successfully started
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:00.017,456] <inf> fs_nvs: nvs_mount: 6 Sectors of 4096 bytes
    [00:00:00.017,486] <inf> fs_nvs: nvs_mount: alloc wra: 0, fe8
    [00:00:00.017,517] <inf> fs_nvs: nvs_mount: data wra: 0, 0
    [00:00:00.017,669] <inf> bt_sdc_hci_driver: hci_driver_open: SoftDevice Controller build revision: 
                                                d8 0c 2d 2f 36 ae e2 5c  80 26 80 4c 3f 4d 16 53 |..-/6..\ .&.L?M.S
                                                50 96 c7 73                                      |P..s             
    [00:00:00.021,026] <inf> bt_hci_core: hci_vs_init: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.021,057] <inf> bt_hci_core: hci_vs_init: HW Variant: nRF52x (0x0002)
    [00:00:00.021,087] <inf> bt_hci_core: hci_vs_init: Firmware: Standard Bluetooth controller (0x00) Version 216.11532 Build 3803067951
    [00:00:00.021,667] <inf> bt_hci_core: bt_init: No ID address. App must call settings_load()
    [00:00:00.025,146] <inf> central_uart: main: Bluetooth initialized
    [00:00:00.025,817] <inf> bt_hci_core: bt_dev_show_info: Identity: D7:C8:04:2D:97:BA (random)
    [00:00:00.025,848] <inf> bt_hci_core: bt_dev_show_info: HCI: version 5.3 (0x0c) revision 0x124b, manufacturer 0x0059
    [00:00:00.025,909] <inf> bt_hci_core: bt_dev_show_info: LMP: version 5.3 (0x0c) subver 0x124b
    [00:00:00.034,332] <inf> central_uart: scan_init: Scan module initialized
    [00:00:00.039,825] <inf> central_uart: nus_client_init: NUS Client module initialized
    [00:00:00.052,764] <inf> central_uart: main: Scanning successfully started
    [00:00:00.059,143] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:00.065,917] <wrn> central_uart: main: NUS send timeout
    [00:00:00.077,301] <inf> central_uart: scan_filter_match: Filters matched. Address: 60:55:F9:F5:29:D2 (public) cconnected conn_err: 0
    Connected: 60:55:F9:F5:29:D2 (public)
    onnectable: 1
    [00:00:00.080,139] <inf> central_uart: scan_filter_match: Filters matched. Address: 60:55:F9:F5:29:D2 (public) connectable: 0
    [00:00:00.080,169] <wrn> central_uart: scan_connecting_error: Connecting failed
    [00:00:00.408,966] <inf> central_uart: connected: Connected: 60:55:F9:F5:29:D2 (public)
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:00.706,970] <inf> central_uart: exchange_func: MTU exchange done
    [00:00:01.070,251] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:01.076,446] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:02.080,841] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:02.087,036] <wrn> central_uart: main: NUS send timeout
    [00:00:03.091,369] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:03.097,564] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:04.101,959] <wrn> central_uart: main: Failed to senreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    d data over BLE connection(err -128)
    [00:00:04.108,428] <wrn> central_uart: main: NUS send timeout
    [00:00:05.112,701] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:05.118,927] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:06.123,260] <wrn> central_uart: main: Failed to sreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    end data over BLE connection(err -128)
    [00:00:06.129,486] <wrn> central_uart: main: NUS send timeout
    [00:00:07.133,758] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:07.139,984] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:08.144,256] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:08.150,482] <wrn> central_uart: main: NUS send timeout
    [00:00:09.154,693] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:09.161,041] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:10.165,313] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:10.171,539] <wrn> central_uart: main: NUS send timeout
    [00:00:11.175,781] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:11.182,006] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:12.186,370] <wrn> central_uart: main: Failed to sreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    end data over BLE connection(err -128)
    [00:00:12.192,565] <wrn> central_uart: main: NUS send timeout
    [00:00:13.196,868] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:13.203,094] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:14.207,702] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:14.213,928] <wrn> central_uart: main: NUS send timeout
    [00:00:15.218,170] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:15.224,365] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:16.228,668] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:16.234,893] <wrn> central_uart: main: NUS send timeout
    [00:00:17.239,166] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:17.245,391] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:18.249,725] <wrn> central_uart: main: Failed to senreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    d data over BLE connection(err -128)
    [00:00:18.256,042] <wrn> central_uart: main: NUS send timeout
    [00:00:19.260,528] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:19.266,723] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:20.271,026] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:20.277,252] <wrn> central_uart: main: NUS send timeout
    [00:00:21.281,524] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:21.287,750] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:22.292,144] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:22.298,370] <wrn> central_uart: main: NUS send timeout
    [00:00:23.302,703] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:23.309,204] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:24.313,507] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:24.319,702] <wrn> central_uart: main: NUS send timeout
    [00:00:25.324,005] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:25.330,200] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:26.334,503] <wrn> central_uart: main: Failed to sereturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    nd data over BLE connection(err -128)
    [00:00:26.340,728] <wrn> central_uart: main: NUS send timeout
    [00:00:27.345,031] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:27.351,226] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    [00:00:28.355,621] <wrn> central_uart: main: Failed toreturn ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
     send data over BLE connection(err -128)
    [00:00:28.361,846] <wrn> central_uart: main: NUS send timeout
    [00:00:29.366,149] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:29.372,375] <wrn> central_uart: main: NUS send timeout
    return ENOTCONN
    Failed to send data over BLE connection(err -128)
    NUS send timeout
    Pairing failed conn: 60:55:F9:F5:29:D2 (public), reason 9
    Service discovery completed
    ATT[1]:         UUID: 0x2803    Handle: 0x0029  Value:
            Characteristic: 0xff01  Properties: 0x0008
    ATT[2]:         UUID: 0xff01    Handle: 0x002A  Value:
    ATT[3]:         UUID: 0x2803    Handle: 0x002B  Value:
            Characteristic: 0xff02  Properties: 0x0012
    ATT[4]:         UUID: 0xff02    Handle: 0x002C  Value:
    ATT[5]:         UUID: 0x2902    Handle: 0x002D  Value:
            CCCD
    [00:00:30.376,678] <wrn> central_uart: main: Failed to send data over BLE connection(err -128)
    [00:00:30.382,904] <wrn> central_uart: main: NUS send timeout
    [00:00:30.414,733] <err> bt_smp: smp_timeout: SMP Timeout
    [00:00:30.415,283] <wrn> central_uart: security_changed: Security failed: 60:55:F9:F5:29:D2 (public) level 1 err 9
    [00:00:30.415,710] <wrn> central_uart: pairing_failed: Pairing failed conn: 60:55:F9:F5:29:D2 (public), reason 9
    [00:00:30.907,012] <inf> central_uart: discovery_complete: Service discovery completed
    IIIIIIIII       I
                     I
                      I
    IIIIIIIIIIIIIIIIII I!I"I#I$I%I&I'I(

    On the ESP32 I have the following log:

    [2023-05-22_10:13:43:43.938840] E (3093673) BT_BTC: btc_blufi_recv_handler seq 2 is not expect 1
    [2023-05-22_10:13:43:43.938933] 
    [2023-05-22_10:13:43:43.974327] E (3093673) BLUFI_EXAMPLE: BLUFI report error, error code 0
    [2023-05-22_10:13:43:43.974445] 
    [2023-05-22_10:13:44:44.937501] E (3094673) BT_BTC: btc_blufi_recv_handler seq 2 is not expect 1
    [2023-05-22_10:13:44:44.937590] 
    [2023-05-22_10:13:44:44.941589] E (3094673) BLUFI_EXAMPLE: BLUFI report error, error code 0
    [2023-05-22_10:13:44:44.941669] 
    [2023-05-22_10:13:45:45.937614] E (3095673) BT_BTC: btc_blufi_recv_handler seq 2 is not expect 1
    [2023-05-22_10:13:45:45.937711] 
    [2023-05-22_10:13:45:45.941526] E (3095673) BLUFI_EXAMPLE: BLUFI report error, error code 0
    

    It seems like some data is being transmitted but in a format not supported by the ESP32. Nevertheless, I'd like to understand why I still have errors when establishing the connection:

    [00:00:30.414,733] <err> bt_smp: smp_timeout: SMP Timeout
    [00:00:30.415,283] <wrn> central_uart: security_changed: Security failed: 60:55:F9:F5:29:D2 (public) level 1 err 9
    [00:00:30.415,710] <wrn> central_uart: pairing_failed: Pairing failed conn: 60:55:F9:F5:29:D2 (public), reason 9
    [00:00:30.907,012] <inf> central_uart: discovery_complete: Service discovery completed

  • Hello,

    Can you please capture a sniffer trace of when you are pairing with the phone and when you are attempting to pair with the nRF. This should give us a better idea of where the problem is. 

    https://www.nordicsemi.com/Products/Development-tools/nrf-sniffer-for-bluetooth-le 

  • Hello,

    I've followed the guide to install the sniffer tracer in both the computer and the nRF52. Nevertheless, I can't see the interface in Wireshark:

    In View --> Interface Toolbars I have the 'nRF Sniffer for BlueTooth LE' option enabled but the nRF52DK doesn't seem to be detected even if I was able to flash it with the programming tool. Is there any step I'm missing?

Reply
  • Hello,

    I've followed the guide to install the sniffer tracer in both the computer and the nRF52. Nevertheless, I can't see the interface in Wireshark:

    In View --> Interface Toolbars I have the 'nRF Sniffer for BlueTooth LE' option enabled but the nRF52DK doesn't seem to be detected even if I was able to flash it with the programming tool. Is there any step I'm missing?

Children
  • Did you get the expected output at step 3 here:

    ?

  • Yes, I got this:

    @anep:~/.config/wireshark/extcap$  ./nrf_sniffer_ble.sh --extcap-interfaces
    extcap {version=4.1.1}{display=nRF Sniffer for Bluetooth LE}{help=https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Sniffer-for-Bluetooth-LE}
    control {number=0}{type=selector}{display=Device}{tooltip=Device list}
    control {number=1}{type=selector}{display=Key}{tooltip=}
    control {number=2}{type=string}{display=Value}{tooltip=6 digit passkey or 16 or 32 bytes encryption key in hexadecimal starting with '0x', big endian format.If the entered key is shorter than 16 or 32 bytes, it will be zero-padded in front'}{validation=\b^(([0-9]{6})|(0x[0-9a-fA-F]{1,64})|([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2}) (public|random))$\b}
    control {number=3}{type=string}{display=Adv Hop}{default=37,38,39}{tooltip=Advertising channel hop sequence. Change the order in which the sniffer switches advertising channels. Valid channels are 37, 38 and 39 separated by comma.}{validation=^\s*((37|38|39)\s*,\s*){0,2}(37|38|39){1}\s*$}{required=true}
    control {number=7}{type=button}{display=Clear}{tooltop=Clear or remove device from Device list}
    control {number=4}{type=button}{role=help}{display=Help}{tooltip=Access user guide (launches browser)}
    control {number=5}{type=button}{role=restore}{display=Defaults}{tooltip=Resets the user interface and clears the log file}
    control {number=6}{type=button}{role=logger}{display=Log}{tooltip=Log per interface}
    value {control=0}{value= }{display=All advertising devices}{default=true}
    value {control=0}{value=[00,00,00,00,00,00,0]}{display=Follow IRK}
    value {control=1}{value=0}{display=Legacy Passkey}{default=true}
    value {control=1}{value=1}{display=Legacy OOB data}
    value {control=1}{value=2}{display=Legacy LTK}
    value {control=1}{value=3}{display=SC LTK}
    value {control=1}{value=4}{display=SC Private Key}
    value {control=1}{value=5}{display=IRK}
    value {control=1}{value=6}{display=Add LE address}
    value {control=1}{value=7}{display=Follow LE address}
    

    I have also ran the 'chmod +x nrf_sniffer_ble.sh' command.

  • Thanks. This shows that the DK is programmed correctly and that the communication works.

    Please check the WS log files for errors as suggested in the Troubleshooting chapter.

  • The DK is supposed to be the ports /dev/ttyACM0 and /dev/ttyACM1

    24-May-2023 12:26:33 (+0200) INFO: --------------------------------------------------------
    24-May-2023 12:26:33 (+0200) INFO: Software version: 4.1.1
    24-May-2023 12:26:33 (+0200) INFO: Started PID 10113
    24-May-2023 12:26:33 (+0200) INFO: Namespace(capture=False, extcap_interfaces=True, extcap_interface=None, extcap_dlts=False, extcap_config=False, extcap_capture_filter=None, fifo=None, extcap_control_in=None, extcap_control_out=None, extcap_version='3.4', device='', baudrate=None, only_advertising=False, only_legacy_advertising=False, scan_follow_rsp=False, scan_follow_aux=False, coded=False)
    24-May-2023 12:26:33 (+0200) INFO: Opening serial port /dev/ttyUSB0
    24-May-2023 12:26:33 (+0200) ERROR: Error opening UART [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
    Traceback (most recent call last):
      File "/home/msurca/.local/lib/python3.9/site-packages/serial/serialposix.py", line 322, in open
        self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
    PermissionError: [Errno 13] Permission denied: '/dev/ttyUSB0'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/msurca/.config/wireshark/extcap/SnifferAPI/Packet.py", line 74, in __init__
        self.uart = UART.Uart(portnum, baudrate)
      File "/home/msurca/.config/wireshark/extcap/SnifferAPI/UART.py", line 124, in __init__
        self.ser = serial.Serial(
      File "/home/msurca/.local/lib/python3.9/site-packages/serial/serialutil.py", line 244, in __init__
        self.open()
      File "/home/msurca/.local/lib/python3.9/site-packages/serial/serialposix.py", line 325, in open
        raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
    serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
    24-May-2023 12:26:33 (+0200) INFO: Opening serial port None
    24-May-2023 12:26:33 (+0200) INFO: Opening serial port /dev/ttyUSB0
    24-May-2023 12:26:33 (+0200) ERROR: Error opening UART [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
    Traceback (most recent call last):
      File "/home/msurca/.local/lib/python3.9/site-packages/serial/serialposix.py", line 322, in open
        self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
    PermissionError: [Errno 13] Permission denied: '/dev/ttyUSB0'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/msurca/.config/wireshark/extcap/SnifferAPI/Packet.py", line 74, in __init__
        self.uart = UART.Uart(portnum, baudrate)
      File "/home/msurca/.config/wireshark/extcap/SnifferAPI/UART.py", line 124, in __init__
        self.ser = serial.Serial(
      File "/home/msurca/.local/lib/python3.9/site-packages/serial/serialutil.py", line 244, in __init__
        self.open()
      File "/home/msurca/.local/lib/python3.9/site-packages/serial/serialposix.py", line 325, in open
        raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
    serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
    24-May-2023 12:26:33 (+0200) INFO: Opening serial port None
    24-May-2023 12:26:33 (+0200) INFO: Opening serial port /dev/ttyACM1
    24-May-2023 12:26:33 (+0200) INFO: closing UART
    24-May-2023 12:26:34 (+0200) INFO: Opening serial port /dev/ttyACM1
    24-May-2023 12:26:34 (+0200) INFO: closing UART
    24-May-2023 12:26:34 (+0200) INFO: Opening serial port /dev/ttyACM0
    24-May-2023 12:26:34 (+0200) INFO: closing UART
    24-May-2023 12:26:34 (+0200) INFO: Opening serial port /dev/ttyACM0
    24-May-2023 12:26:34 (+0200) INFO: closing UART
    24-May-2023 12:26:35 (+0200) INFO: Exiting PID 10113

    When I ran the ' ./nrf_sniffer_ble.sh --extcap-interfaces' command I see that the interfaces are not shown after 'extcap':

    @anep:~/.config/wireshark/extcap$  ./nrf_sniffer_ble.sh --extcap-interfaces
    extcap {version=4.1.1}{display=nRF Sniffer for Bluetooth LE}{help=https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Sniffer-for-Bluetooth-LE}
    control {number=0}{type=selector}{display=Device}{tooltip=Device list}
    control {number=1}{type=selector}{display=Key}{tooltip=}
    control {number=2}{type=string}{display=Value}{tooltip=6 digit passkey or 16 or 32 bytes encryption key in hexadecimal starting with '0x', big endian format.If the entered key is shorter than 16 or 32 bytes, it will be zero-padded in front'}{validation=\b^(([0-9]{6})|(0x[0-9a-fA-F]{1,64})|([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2}) (public|random))$\b}
    control {number=3}{type=string}{display=Adv Hop}{default=37,38,39}{tooltip=Advertising channel hop sequence. Change the order in which the sniffer switches advertising channels. Valid channels are 37, 38 and 39 separated by comma.}{validation=^\s*((37|38|39)\s*,\s*){0,2}(37|38|39){1}\s*$}{required=true}
    control {number=7}{type=button}{display=Clear}{tooltop=Clear or remove device from Device list}
    control {number=4}{type=button}{role=help}{display=Help}{tooltip=Access user guide (launches browser)}
    control {number=5}{type=button}{role=restore}{display=Defaults}{tooltip=Resets the user interface and clears the log file}
    control {number=6}{type=button}{role=logger}{display=Log}{tooltip=Log per interface}
    value {control=0}{value= }{display=All advertising devices}{default=true}
    value {control=0}{value=[00,00,00,00,00,00,0]}{display=Follow IRK}
    value {control=1}{value=0}{display=Legacy Passkey}{default=true}
    value {control=1}{value=1}{display=Legacy OOB data}
    value {control=1}{value=2}{display=Legacy LTK}
    value {control=1}{value=3}{display=SC LTK}
    value {control=1}{value=4}{display=SC Private Key}
    value {control=1}{value=5}{display=IRK}
    value {control=1}{value=6}{display=Add LE address}
    value {control=1}{value=7}{display=Follow LE address}

  • Do you have the new 52 DK with the nRF5340 interface MCU (board version 3.0.0)?If so, do you have another Nordic Dongle or DK you can use?

    The nRF5340 interface MCU has bug in the VCOM bridge implementation that prevents the WS plugin from communicating with it.

Related