direction_finding_connectionless_rx只会一直打印[DRIVER]信息,在收到合适的蓝牙时,也不会进行CTE解析、捕获 My direction_finding_connectionless_rx keeps printing [DRIVER] messages continuously. Even when it receives a suitable Bluetooth packet, it does not perform CTE parsing or capture

我现在有两块调试板,一块是nRF5340DK,一块是nRF52833DK,我现在在nRF52833DK中烧录了direction_finding_connectionless_rx项目,它的地址是nrf\samples\bluetooth\direction_finding_connectionless_rx。在nRF5340中烧录了direction_finding_connectionless_tx项目。两个项目烧录完毕后,direction_finding_connectionless_rx通过串口打印了以下信息:
Bluetooth initialization...success

Scan callbacks register...success.

Periodic Advertising callbacks register...success.

Start scanning...success

[DEVICE]: 08:5E:C5:87:11:1E (random), AD evt type 3, Tx Pwr: 127, RSSI -86 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 ms), SID: 255

[DEVICE]: 5E:0F:3B:46:29:1C (random), AD evt type 0, Tx Pwr: 127, RSSI -79 C:1 S:1 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 ms), SID: 255

[DEVICE]: 15:4C:30:43:DB:A2 (random), AD evt type 3, Tx Pwr: 127, RSSI -55 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 ms), SID: 255

......

[DEVICE]: 34:A9:42:AA:EE:78 (random), AD evt type 5, Tx Pwr: 127, RSSI -47 DF Connectionless Beacon App C:0 S:0 D:0 SR:0 E:1 Prim: LE 1M, Secn: LE 2M, Interval: 0x0780 (2400 ms), SID: 0

[DEVICE]: 05:25:11:00:0D:00 (random), AD evt type 3, Tx Pwr: 127, RSSI -84 RH_YAA C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 ms), SID: 255

......
[DEVICE]: 75:58:AC:2A:51:E3 (random), AD evt type 4, Tx Pwr: 127, RSSI -73 SJM C:1 S:1 D:0 SR:1 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 ms), SID: 255

[DEVICE]: 25:2D:13:35:CF:93 (random), AD evt type 3, Tx Pwr: 127, RSSI -64 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 ms), SID: 255

[DEVICE]: 34:A9:42:AA:EE:78 (random), AD evt type 5, Tx Pwr: 127, RSSI -45 DF Connectionless Beacon App C:0 S:0 D:0 SR:0 E:1 Prim: LE 1M, Secn: LE 2M, Interval: 0x0780 (2400 ms), SID: 0

......

从调试信息可以看到,它确实监测到了DF Connectionless Beacon设备,但是从未开始进行CTE信息的解析。通过调试,我发现程序已经运行了以下代码:

        sync_create_timeout_ms =
            adv_interval_to_ms(info->interval) * SYNC_CREATE_TIMEOUT_INTERVAL_NUM;
        per_adv_found = true;
        per_sid = info->sid;
        bt_addr_le_copy(&per_addr, info->addr);

        k_sem_give(&sem_per_adv);

那么理论上应该运行以下代码:
err = k_sem_take(&sem_per_adv, K_FOREVER);
if (err) {
            printk("failed (err %d)\n", err);
            return 0;
        }
        printk("success. Found periodic advertising.\n");


但实际并未看到打印消息,似乎是k_sem_take未正确返回。我在 k_sem_give(&sem_per_adv); 函数后添加了休眠函数k_msleep(10000);

发现程序正常运行了以下代码:

err = k_sem_take(&sem_per_advK_FOREVER);
if (err) {
            printk("failed (err %d)\n"err);
            return 0;
        }
        printk("success. Found periodic advertising.\n");

调试信息如下:[2026-05-18T16:19:51.666] *** Booting nRF Connect SDK v3.3.0-ba167d9f3db4 ***

*** Using Zephyr OS v4.3.99-fd9

[2026-05-18T16:19:51.679] 204a02d52 ***

Starting Connectionless Locator Demo

Bluetooth initialization...success

Scan callbacks register...success.

P

[2026-05-18T16:19:51.690] eriodic Advertising callbacks register...success.

Start scanning...success

Waiting for periodic advertising...

[2026-05-18T16:19:51.703] [DEVICE]: 34:A9:42:AA:EE:78 (random), AD evt type 5, Tx Pwr: 127, RSSI -46 DF Connectionless Beac

[2026-05-18T16:19:51.715] on App C:0 S:0 D:0 SR:0 E:1 Prim: LE 1M, Secn: LE 2M, Interval: 0x0780 (2400 ms), SID: 0

success. Found periodic advertisi

[2026-05-18T16:19:51.729] ng.

Creating Periodic Advertising Sync...success.

Waiting for periodic sync...

[2026-05-18T16:20:01.721] [DEVICE]: 00:00:00:04:03:00 (random), AD evt type 3, Tx Pwr: 127, RSSI -79 RH_Y2 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M,

[2026-05-18T16:20:01.731] Secn: No packets, Interval: 0x0000 (0 ms), SID: 255

[DEVICE]: 58:04:A1:04:30:E8 (random), AD evt type

[2026-05-18T16:20:01.741] 3, Tx Pwr: 127, RSSI -87 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 ms), SID: 255

[2026-05-18T16:20:01.753]

[DEVICE]: 19:45:AA:3E:56:54 (random), AD evt type 3, Tx Pwr: 127, RSSI -83 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval

[2026-05-18T16:20:01.765] : 0x0000 (0 ms), SID: 255

[DEVICE]: 29:38:1C:B5:56:9A (random), AD evt type 3, Tx Pwr: 127, RSSI -78 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M,

 

我现在不知道该如何让这个示例项目正常运行。nRF Connect for VS Code版本:2026.4.1766

Translate:

I currently have two debug boards, one is nRF5340DK and the other is nRF52833DK. I have now programmed the direction_finding_connectionless_rx project into the nRF52833DK. Its address is nrf\samples\bluetooth\direction_finding_connectionless_rx. The direction_finding_connectionless_tx project was programmed into the nRF5340. After both projects were programmed, the direction_finding_connectionless_rx printed the following information through the serial port: Bluetooth initialization... success

Scan callbacks register... success.

Periodic Advertising callbacks register... success.

Start scanning... success

[DEVICE]: 08:5E:C5:87:11:1E (random), AD evt type 3, Tx Pwr: 127, RSSI -86 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 ms), SID: 255

[DEVICE]: 5E:0F:3B:46:29:1C (random), AD evt type 0, Tx Pwr: 127, RSSI -79 C:1 S:1 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 ms), SID: 255

[DEVICE]: 15:4C:30:43:DB:A2 (random), AD evt type 3, Tx Pwr: 127, RSSI -55 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 ms), SID: 255

......

[DEVICE]: 34:A9:42:AA:EE:78 (random), AD evt type 5, Tx Pwr: 127, RSSI -47 DF Connectionless Beacon App C:0 S:0 D:0 SR:0 E:1 Prim: LE 1M, Secn: LE 2M, Interval: 0x0780 (2400 ms), SID: 0

[DEVICE]: 05:25:11:00:0D:00 (random), AD evt type 3, Tx Pwr: 127, RSSI -84 RH_YAA C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 ms), SID: 255


......
[DEVICE]: 75:58:AC:2A:51:E3 (random), AD evt type 4, Tx Pwr: 127, RSSI -73 SJM C:1 S:1 D:0 SR:1 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 ms), SID: 255

[DEVICE]: 25:2D:13:35:CF:93 (random), AD evt type 3, Tx Pwr: 127, RSSI -64 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 ms), SID: 255

[DEVICE]: 34:A9:42:AA:EE:78 (random), AD evt type 5, Tx Pwr: 127, RSSI -45 DF Connectionless Beacon App C:0 S:0 D:0 SR:0 E:1 Prim: LE 1M, Secn: LE 2M, Interval: 0x0780 (2400 ms), SID: 0

......

From the debugging information, it can be seen that it did indeed detect the DF Connectionless Beacon device, but it never started to parse the CTE information. Through debugging, I found that the program has run the following code:
sync_create_timeout_ms =
adv_interval_to_ms(info->interval) * SYNC_CREATE_TIMEOUT_INTERVAL_NUM;
per_adv_found = true;
per_sid = info->sid;
bt_addr_le_copy(&per_addr, info->addr);

k_sem_give(&sem_per_adv);

Then, theoretically, the following code should be run: err = k_sem_take(&sem_per_adv, K_FOREVER);
if (err) {
printk("failed (err %d)\n", err);
return 0;
}
printk("success. Found periodic advertising.\n");


However, the print message was not actually seen. It seems that k_sem_take did not return correctly. I added a sleep function k_msleep(10000) after the k_sem_give(&sem_per_adv); function and found that the program ran normally with the following code:
err = k_sem_take(&sem_per_adv, K_FOREVER);
if (err) {
printk("failed (err %d)\n", err);
return 0;
}
printk("success. Found periodic advertising.\n");
Debug information as follows: [2026-05-18T16:19:51.666] *** Booting nRF Connect SDK v3.3.0-ba167d9f3db4 ***
*** Using Zephyr OS v4.3.99-fd9
[2026-05-18T16:19:51.679] 204a02d52 ***

[May 18, 2026, 16:19:51.679] 204a02d52 ***
Starting Connectionless Locator Demo

Bluetooth initialization... success

Scan callbacks register... success.

P

[2026-05-18T16:19:51.690] Periodic advertising callbacks registration... success.

Start scanning... success

Waiting for periodic advertising...

[2026-05-18T16:19:51.703] [DEVICE]: 34:A9:42:AA:EE:78 (random), AD evt type 5, Tx Pwr: 127, RSSI -46, DF Connectionless Beacon
[2026-05-18T16:19:51.715] on App C:0 S:0 D:0 SR:0 E:1 Prim: LE 1M, Secn: LE 2M, Interval: 0x0780 (2400 ms), SID: 0
success. Found periodic advertisi

[2026-05-18T16:19:51.729] ng.

(由于原文中“ng.”没有明确的含义,所以直接保留原样。)
Creating Periodic Advertising Sync... success.

Waiting for periodic sync...

[2026-05-18T16:20:01.721] [DEVICE]: 00:00:00:04:03:00 (random), AD event type 3, Tx Power: 127, RSSI -79 RH_Y2 C:0 S:0 D:0 SR:0 E:0 Primary: LE 1M,
[2026-05-18T16:20:01.731] Secn: No packets, Interval: 0x0000 (0 ms), SID: 255
[DEVICE]: 58:04:A1:04:30:E8 (random), AD evt type

[2026-05-18T16:20:01.741] 3, Tx Pwr: 127, RSSI -87 C:0 S:0 D:0 SR:0 E:0 Primary: LE 1M, Secondary: No packets, Interval: 0x0000 (0 ms), SID: 255


[May 18, 2026 4:20:01 PM]
[DEVICE]: 19:45:AA:3E:56:54 (random), AD evt type 3, Tx Pwr: 127, RSSI -83 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval

[2026-05-18T16:20:01.765] : 0x0000 (0 ms), SID: 255
[DEVICE]: 29:38:1C:B5:56:9A (random), AD evt type 3, Tx Pwr: 127, RSSI -78 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M,

I currently have no idea how to get this sample project running properly. nRF Connect for VS Code version: 2026.4.1766

我希望能够使用中文来进行沟通,不过英文我这里也可以进行翻译来理解。

Related