I have Thingy:91 dev board. I have flashed hci_lpuart sample to nrf52840 and successfully ran lte_ble_gateway sample. Now in my application I want to connect to the same hard-coded peripheral, address of which I know. I try to use bt_le_set_auto_conn to establish connection, but connection always fails with the message:
[00:07:24.113,311] <dbg> bt_hci_core: hci_event: event 0x3e
[00:07:24.113,342] <dbg> bt_hci_core: hci_le_meta_event: subevent 0x02
[00:07:24.113,342] <dbg> bt_scan: bt_hci_le_adv_report: Adv number of reports 1
[00:07:24.113,464] <dbg> bt_scan: le_adv_recv: D3:6F:83:29:A1:91 (random) event 0, len 26, rssi -47 dBm
[00:07:24.113,464] <dbg> bt_hci_core: bt_hci_cmd_create: opcode 0x200c param_len 2
[00:07:24.113,494] <dbg> bt_hci_core: bt_hci_cmd_create: buf 0x20018974
[00:07:24.113,525] <dbg> bt_hci_core: bt_hci_cmd_send_sync: buf 0x20018974 opcode 0x200c len 5
[00:07:24.113,616] <dbg> bt_hci_core: process_events: count 2
[00:07:24.113,616] <dbg> bt_hci_core: process_events: ev->state 4
[00:07:24.113,647] <dbg> bt_hci_core: send_cmd: calling net_buf_get
[00:07:24.113,647] <dbg> bt_hci_core: send_cmd: calling sem_take_wait
[00:07:24.113,677] <dbg> bt_hci_core: send_cmd: Sending command 0x200c (buf 0x20018974) to driver
[00:07:24.113,708] <dbg> bt_hci_core: bt_send: buf 0x20018974 len 5 type 0
[00:07:24.113,769] <dbg> bt_hci_core: process_events: ev->state 0
[00:07:24.113,800] <dbg> bt_hci_core: hci_tx_thread: Calling k_poll with 2 events
[00:07:24.115,447] <dbg> bt_hci_core: bt_recv_unsafe: buf 0x20018560 len 6
[00:07:24.115,478] <dbg> bt_hci_core: hci_cmd_complete: opcode 0x200c
[00:07:24.115,509] <dbg> bt_hci_core: hci_cmd_done: opcode 0x200c status 0x00 buf 0x20018560
[00:07:24.115,570] <dbg> bt_hci_core: bt_hci_cmd_send_sync: rsp 0x20018974 opcode 0x200c len 1
[00:07:24.115,661] <dbg> bt_id: set_random_address: F7:0B:12:8F:37:44
[00:07:24.115,692] <dbg> bt_hci_core: bt_hci_cmd_create: opcode 0x2005 param_len 6
[00:07:24.115,722] <dbg> bt_hci_core: bt_hci_cmd_create: buf 0x20018974
[00:07:24.115,753] <dbg> bt_hci_core: bt_hci_cmd_send_sync: buf 0x20018974 opcode 0x2005 len 9
[00:07:24.115,814] <dbg> bt_hci_core: process_events: count 2
[00:07:24.115,844] <dbg> bt_hci_core: process_events: ev->state 4
[00:07:24.115,844] <dbg> bt_hci_core: send_cmd: calling net_buf_get
[00:07:24.115,875] <dbg> bt_hci_core: send_cmd: calling sem_take_wait
[00:07:24.115,905] <dbg> bt_hci_core: send_cmd: Sending command 0x2005 (buf 0x20018974) to driver
[00:07:24.115,905] <dbg> bt_hci_core: bt_send: buf 0x20018974 len 9 type 0
[00:07:24.115,966] <dbg> bt_hci_core: process_events: ev->state 0
[00:07:24.115,997] <dbg> bt_hci_core: hci_tx_thread: Calling k_poll with 2 events
[00:07:24.117,675] <dbg> bt_hci_core: bt_recv_unsafe: buf 0x20018560 len 6
[00:07:24.117,706] <dbg> bt_hci_core: hci_cmd_complete: opcode 0x2005
[00:07:24.117,706] <dbg> bt_hci_core: hci_cmd_done: opcode 0x2005 status 0x00 buf 0x20018560
[00:07:24.117,797] <dbg> bt_hci_core: bt_hci_cmd_send_sync: rsp 0x20018974 opcode 0x2005 len 1
[00:07:24.117,828] <dbg> bt_hci_core: bt_hci_cmd_create: opcode 0x200d param_len 25
[00:07:24.117,858] <dbg> bt_hci_core: bt_hci_cmd_create: buf 0x20018974
[00:07:24.117,889] <dbg> bt_hci_core: bt_hci_cmd_send_sync: buf 0x20018974 opcode 0x200d len 28
[00:07:24.117,950] <dbg> bt_hci_core: process_events: count 2
[00:07:24.117,980] <dbg> bt_hci_core: process_events: ev->state 4
[00:07:24.117,980] <dbg> bt_hci_core: send_cmd: calling net_buf_get
[00:07:24.118,011] <dbg> bt_hci_core: send_cmd: calling sem_take_wait
[00:07:24.118,041] <dbg> bt_hci_core: send_cmd: Sending command 0x200d (buf 0x20018974) to driver
[00:07:24.118,041] <dbg> bt_hci_core: bt_send: buf 0x20018974 len 28 type 0
[00:07:24.118,133] <dbg> bt_hci_core: process_events: ev->state 0
[00:07:24.118,164] <dbg> bt_hci_core: hci_tx_thread: Calling k_poll with 2 events
[00:07:24.119,995] <dbg> bt_hci_core: bt_recv_unsafe: buf 0x20018560 len 6
[00:07:24.120,025] <dbg> bt_hci_core: hci_cmd_status: opcode 0x200d
[00:07:24.120,056] <dbg> bt_hci_core: hci_cmd_done: opcode 0x200d status 0x30 buf 0x20018560
[00:07:24.120,117] <wrn> bt_hci_core: opcode 0x200d status 0x30
[00:07:24.120,239] <err> https_client: Failed to connect to D3:6F:83:29:A1:91 (random) (31)
My code looks like this:
My proj.conf has the same Bluetooth settings as in lte_ble_gateway sample:
I can connect to device If I specify service UUID in scan filters and perform a scan. Also I can connect if I add address to scan filters and perform a scan, but bt_le_set_auto_conn does not work. Please help!