Skip to content

Commit a994349

Browse files
ppryga-nordicrlubos
authored andcommitted
samples: Bluetooth: df: Enable TX of mutliple CTEs in a per adv event
Since periodic advertising chains are available there is a possibility to send multiple PDUs including CTE in a periodic advertising event. This commit enables such functionality in direction finding transmitter sample. It includes a partial fix of zephyrproject-rtos/zephyr#41407. Signed-off-by: Piotr Pryga <[email protected]> (cherry picked from commit 50a2cdd) Signed-off-by: Ryan Chu <[email protected]>
1 parent cae3836 commit a994349

File tree

5 files changed

+27
-11
lines changed

5 files changed

+27
-11
lines changed

samples/bluetooth/direction_finding_connectionless_tx/boards/nrf52833dk_nrf52820.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ CONFIG_BT_CTLR_DF=y
1616
# Disable Direction Finding RX mode
1717
CONFIG_BT_CTLR_DF_ANT_SWITCH_RX=n
1818
CONFIG_BT_CTLR_DF_SCAN_CTE_RX=n
19+
20+
# Enable chaining of multiple CTEs in periodic advertising
21+
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
22+
CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK=y
23+
CONFIG_BT_CTLR_DF_PER_ADV_CTE_NUM_MAX=16

samples/bluetooth/direction_finding_connectionless_tx/boards/nrf52833dk_nrf52833.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ CONFIG_BT_CTLR_DF=y
1616
# Disable Direction Finding RX mode
1717
CONFIG_BT_CTLR_DF_SCAN_CTE_RX=n
1818
CONFIG_BT_CTLR_DF_ANT_SWITCH_RX=n
19+
20+
# Enable chaining of multiple CTEs in periodic advertising
21+
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
22+
CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK=y
23+
CONFIG_BT_CTLR_DF_PER_ADV_CTE_NUM_MAX=16

samples/bluetooth/direction_finding_connectionless_tx/child_image/hci_rpmsg.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ CONFIG_BT_CTLR_DF_CTE_RX=n
2323

2424
# Limit number of possible connection to decrease memory usage
2525
CONFIG_BT_MAX_CONN=1
26+
27+
# Enable chaining of multiple CTEs in periodic advertising
28+
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
29+
CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK=y
30+
CONFIG_BT_CTLR_DF_PER_ADV_CTE_NUM_MAX=16

samples/bluetooth/direction_finding_connectionless_tx/prj.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CONFIG_BT_DEVICE_NAME="DF Connectionless Beacon App"
99

1010
CONFIG_BT_EXT_ADV=y
1111
CONFIG_BT_PER_ADV=y
12+
CONFIG_BT_BROADCASTER=y
1213

1314
# Enable Direction Finding Feature including AoA and AoD
1415
CONFIG_BT_DF=y

samples/bluetooth/direction_finding_connectionless_tx/src/main.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
#include <sys/printk.h>
1212

1313
#include <bluetooth/bluetooth.h>
14-
#include <bluetooth/hci.h>
1514
#include <bluetooth/direction.h>
1615
#include <sys/byteorder.h>
1716
#include <sys/util.h>
1817

1918
/* Length of CTE in unit of 8[us] */
2019
#define CTE_LEN (0x14U)
20+
/* Number of CTE send in single periodic advertising train */
21+
#define PER_ADV_EVENT_CTE_COUNT 5
2122

2223
static void adv_sent_cb(struct bt_le_ext_adv *adv,
2324
struct bt_le_ext_adv_sent_info *info);
@@ -54,19 +55,18 @@ static uint8_t ant_patterns[] = {0x2, 0x0, 0x5, 0x6, 0x1, 0x4, 0xC, 0x9, 0xE,
5455
0xD, 0x8, 0xA};
5556
#endif /* CONFIG_BT_DF_CTE_TX_AOD */
5657

57-
const struct bt_df_adv_cte_tx_param cte_params = {
58-
.cte_len = CTE_LEN,
59-
.cte_count = 1,
58+
struct bt_df_adv_cte_tx_param cte_params = { .cte_len = CTE_LEN,
59+
.cte_count = PER_ADV_EVENT_CTE_COUNT,
6060
#if defined(CONFIG_BT_DF_CTE_TX_AOD)
61-
.cte_type = BT_DF_CTE_TYPE_AOD_2US,
62-
.num_ant_ids = ARRAY_SIZE(ant_patterns),
63-
.ant_ids = ant_patterns
61+
.cte_type = BT_DF_CTE_TYPE_AOD_2US,
62+
.num_ant_ids = ARRAY_SIZE(ant_patterns),
63+
.ant_ids = ant_patterns
6464
#else
65-
.cte_type = BT_DF_CTE_TYPE_AOA,
66-
.num_ant_ids = 0,
67-
.ant_ids = NULL
65+
.cte_type = BT_DF_CTE_TYPE_AOA,
66+
.num_ant_ids = 0,
67+
.ant_ids = NULL
6868
#endif /* CONFIG_BT_DF_CTE_TX_AOD */
69-
};
69+
};
7070

7171
static void adv_sent_cb(struct bt_le_ext_adv *adv,
7272
struct bt_le_ext_adv_sent_info *info)

0 commit comments

Comments
 (0)