BLE doesn't work.

Bluetooth connection cache processing - Nordic Q&A - Nordic DevZone - Nordic DevZone

Continuing from last time. After some optimization, the program was able to work. However, after verification, the program could only operate normally for a few hours and then failed to run properly. The phenomenon was manifested as: the USB-related connection was directly disconnected and could not be restored by itself.

After verification, I found that the main reason is that this issue is triggered when multiple connections are in progress simultaneously.
Here is my code.

An error indicates insufficient memory, but even though I set a larger memory, this error still occurs.

I modified some code to disable the previous BLE restart function, and at the same time, I turned off the CODED and 2M PHY switching functions.

Here is my log:

[15:41:36.081]收←◆*** Booting nRF Connect SDK v2.9.0-7787b2649840 ***
*** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
[00:00:00.002,593] <inf> littlefs: LittleFS version 2.9, disk version 2.1
[00:00:00.002,868] <inf> littlefs: FS at w25q64jvs@0:0x0 is 256 0x1000-byte blocks with 512 cycle
[00:00:00.002,868] <inf> littlefs: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
[USB]: status: 5.

[15:41:36.293]收←◆[USB]: status: 1.
[USB]: status: 6.
[USB]: status: 1.
[00:00:00.209,228] <inf> fs_nvs: 2 Sectors of 4096 bytes
[00:00:00.209,228] <inf> fs_nvs: alloc wra: 0, fd0
[00:00:00.209,259] <inf> fs_nvs: data wra: 0, 1c
[00:00:00.209,381] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision: 
                                            2d 79 a1 c8 6a 40 b7 3c  f6 74 f9 0b 22 d3 c4 80 |-y..j@.< .t.."...
                                            74 72 82 ba               
[15:41:36.355]收←◆                       |tr..             
[00:00:00.212,188] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.212,219] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
[00:00:00.212,249] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 45.41337 Build 3074452168
[00:00:00.212,707] <inf> bt_hci_core: No ID address. App must call settings_load()
[00:00:00.213,287] <inf> bt_hci_core: Identity: EF:E6:40:48:0B:0F (random)
[00:00:00.213,317] <inf> bt_hci_core: HCI: version 6.0 (0x0e) revision 0x106b, manufacturer 0x0059
[00:00:00.213,348] <inf> bt_hci_core: LMP: version 6.0 (0x0e) subver 0x106b
start scan.

[15:41:37.453]收←◆[USB]: status: 5.
[USB]: status: 1.
[USB]: status: 6.
[USB]: status: 1.
[00:00:00.545,562] <inf> usb_cdc_acm: Device configured

[15:41:40.293]收←◆scan stop.
start scan.

[15:41:43.297]收←◆scan stop.
start scan.

[15:41:46.303]收←◆scan stop.
start scan.
scan stop.
connect [6C], rssi: -63 phy: 1.

[15:41:47.555]收←◆connect [6C], ret: 1.
start scan.
scan stop.
connect [8F], rssi: -71 phy: 1.
[00:00:11.121,246] <wrn> bt_hci_core: opcode 0x2043 status 0x0d 
[bt_conn_le_create]: ERROR -12.
connect [95], ret: 0.
start scan.
scan stop.
connect [46], rssi: -54 phy: 1.
[00:00:11.477,233] <wrn> bt_hci_core: opcode 0x2043 status 0x0d 
[bt_conn_le_create]: ERROR -12.
connect [95], ret: 0.
start scan.

[15:41:48.257]收←◆scan stop.
connect [9C], rssi: -59 phy: 1.
[00:00:11.817,626] <wrn> bt_hci_core: opcode 0x2043 status 0x0d 
[bt_conn_le_create]: ERROR -12.
connect [95], ret: 0.
start scan.
scan stop.
connect [3A], rssi: -67 phy: 1.
[00:00:12.179,290] <wrn> bt_hci_core: opcode 0x2043 status 0x0d 
[bt_conn_le_create]: ERROR -12.
connect [95], ret: 0.
start scan.

8203.Downloads.zip

Parents
  • I have found out the reason why the system stopped working. It is because after adding the failed connection device to the timeout, due to the large number of unconnected devices, it may not be possible to add additional devices, so a second attempt to connect will be made. At this time, there will be a task_wdt error.

    if(dev_count_connect == CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT || dev_count_timeout == CONFIG_SERVER_CLIENT_WAITING_COUNT)
        {
            printk("[FULL DEVICES].\n");
            return;
        }

    Therefore, the crux of the matter still lies in:
    1. Why can't multiple connections be made simultaneously? I tried to shut down my main communication process, which doesn't perform any device communication lifecycle management, data communication, or upper computer communication, but still couldn't connect at the same time.
    2. Why does a second attempt to reconnect cause the system to crash?

Reply
  • I have found out the reason why the system stopped working. It is because after adding the failed connection device to the timeout, due to the large number of unconnected devices, it may not be possible to add additional devices, so a second attempt to connect will be made. At this time, there will be a task_wdt error.

    if(dev_count_connect == CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT || dev_count_timeout == CONFIG_SERVER_CLIENT_WAITING_COUNT)
        {
            printk("[FULL DEVICES].\n");
            return;
        }

    Therefore, the crux of the matter still lies in:
    1. Why can't multiple connections be made simultaneously? I tried to shut down my main communication process, which doesn't perform any device communication lifecycle management, data communication, or upper computer communication, but still couldn't connect at the same time.
    2. Why does a second attempt to reconnect cause the system to crash?

Children
No Data
Related