Skip to content

Commit eba3128

Browse files
cvinayakkartben
authored andcommitted
samples: Bluetooth: observer: Extended Scanning on BBC Micro Bit board
Add configuration overlay file to support observer sample with Extended Scanning on BBC Micro Bit board. Due to slow CPU, there will be assertions, and this commit (for now) validates build-only. And the sample may run for a duration until it asserts. Asserts: - ASSERTION FAIL [start_us == (aux_start_us + 1U)] @ WEST_TOPDIR/zephyr/subsys/bluetooth/controller/ll_sw/ nordic/lll/lll_scan_aux.c:359 This will happen for small aux offset value, definitely for the 300 us because CPU usage latency to setup such auxiliary PDU reception on nRF51 is high due to slow CPU. - ASSERTION FAIL [0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/controller/ll_sw/ nordic/lll/lll_scan_aux.c:592 prepare_cb: Actual EVENT_OVERHEAD_START_US = 579 This will happen due to CPU usage latencies scheduling the radio events, due to slow CPU. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 53835e9 commit eba3128

File tree

5 files changed

+98
-3
lines changed

5 files changed

+98
-3
lines changed

samples/bluetooth/observer/README.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,23 @@ If the used Bluetooth Low Energy Controller supports Extended Scanning, you may
1616
enable :kconfig:option:`CONFIG_BT_EXT_ADV` in the project configuration file. Refer to the
1717
project configuration file for further details.
1818

19+
Building Extended Scanning support for BBC Micro Bit board
20+
**********************************************************
21+
22+
.. code-block:: console
23+
24+
west build -b bbc_microbit . -- -DCONF_FILE='prj_extended.conf' -DEXTRA_CONF_FILE='overlay_bbc_microbit-bt_ll_sw_split.conf'
25+
26+
Thread Analysis for BBC Micro Bit board
27+
***************************************
28+
29+
Due to resource constraints on the BBC Micro Bit board, thread analysis can be enabled to profile
30+
the RAM usage and thread stack sizes be updated to successfully build and run the sample.
31+
32+
.. code-block:: console
33+
34+
west build -b bbc_microbit . -- -DCONF_FILE='prj_extended.conf' -DEXTRA_CONF_FILE='debug.conf;overlay_bbc_microbit-bt_ll_sw_split.conf'
35+
1936
Requirements
2037
************
2138

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Enable thread analysis
2+
CONFIG_THREAD_ANALYZER=y
3+
CONFIG_THREAD_ANALYZER_AUTO=y
4+
CONFIG_THREAD_ANALYZER_AUTO_INTERVAL=5
5+
CONFIG_THREAD_NAME=y
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* Keep default IRQ priority low for peripherals to reduce Radio ISR latency.
2+
* ARM Cortex-M4 lowest priority value of 5, i.e. considering Zephyr reserved 2
3+
* levels for Exceptions and ZLI (if enabled).
4+
* ARM Cortex-M0 lowest priority value of 3, i.e. we use it as Zephyr has no
5+
* support for ZLI on Cortex-M0.
6+
*/
7+
#define NRF_DEFAULT_IRQ_PRIORITY 3
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Adjust Stack Sizes for reduce RAM usage
2+
CONFIG_MAIN_STACK_SIZE=1024
3+
CONFIG_IDLE_STACK_SIZE=128
4+
CONFIG_ISR_STACK_SIZE=1024
5+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=1024
6+
7+
# Enable Extended Scanning
8+
# CONFIG_BT_EXT_ADV=y
9+
10+
# Set maximum scan data length for Extended Scanning
11+
CONFIG_BT_EXT_SCAN_BUF_SIZE=192
12+
13+
# Zephyr Bluetooth LE Controller needs 16 event buffers to generate Extended
14+
# Advertising Report for receiving the complete 1650 bytes of data.
15+
# Use 4 to be able to receive a minimal extended advertising with chains.
16+
CONFIG_BT_BUF_EVT_RX_COUNT=4
17+
18+
# Use Zephyr Bluetooth Low Energy Controller implementation
19+
CONFIG_BT_LL_SW_SPLIT=y
20+
21+
# Set maximum scan data length for Extended Scanning in Bluetooth LE Controller.
22+
CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=192
23+
24+
# Increase Zephyr Bluetooth LE Controller Rx buffer to receive complete chain
25+
# of PDUs. Need 9 for maximum of 1650 bytes, but we use 3 as minimum to receive
26+
# at least a primary PDU, an auxiliary PDU and a chain PDU.
27+
CONFIG_BT_CTLR_RX_BUFFERS=3
28+
29+
# Enable advanced features
30+
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
31+
32+
# Adjust execution context priorities to achieve lower Radio ISR latencies
33+
CONFIG_BT_CTLR_LLL_PRIO=0
34+
CONFIG_BT_CTLR_ULL_HIGH_PRIO=1
35+
CONFIG_BT_CTLR_ULL_LOW_PRIO=1
36+
37+
# Use just-in-time collision resolution in ticker and LLL pipeline
38+
CONFIG_BT_CTLR_LOW_LAT=n
39+
CONFIG_BT_CTLR_LOW_LAT_ULL_DONE=n
40+
CONFIG_BT_TICKER_LOW_LAT=n
41+
42+
# Increase the below to receive interleaved advertising chains
43+
CONFIG_BT_CTLR_SCAN_AUX_SET=3
44+
CONFIG_BT_CTLR_LOW_LAT_ULL=y
45+
# CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS=y
46+
# CONFIG_BT_CTLR_SCAN_AUX_CHAIN_COUNT=3
47+
48+
# Use unreserved timespace scanning
49+
CONFIG_BT_CTLR_SCAN_UNRESERVED=y
50+
51+
# Code size reduction
52+
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
53+
CONFIG_LTO=y

samples/bluetooth/observer/sample.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,33 @@ sample:
33
tests:
44
sample.bluetooth.observer:
55
harness: bluetooth
6+
tags: bluetooth
67
platform_allow:
78
- qemu_cortex_m3
89
- qemu_x86
910
- nrf52840dk/nrf52840
1011
integration_platforms:
1112
- qemu_cortex_m3
12-
tags: bluetooth
13+
- nrf52840dk/nrf52840
1314
sample.bluetooth.observer.extended:
1415
harness: bluetooth
15-
extra_args: CONF_FILE="prj_extended.conf"
16+
tags: bluetooth
17+
extra_args:
18+
- CONF_FILE="prj_extended.conf"
1619
platform_allow:
1720
- qemu_cortex_m3
1821
- qemu_x86
1922
- nrf52840dk/nrf52840
20-
tags: bluetooth
2123
integration_platforms:
2224
- qemu_cortex_m3
25+
- nrf52840dk/nrf52840
26+
sample.bluetooth.observer.extended.bbc_microbit.bt_ll_sw_split:
27+
harness: bluetooth
28+
tags: bluetooth
29+
extra_args:
30+
- CONF_FILE="prj_extended.conf"
31+
- EXTRA_CONF_FILE="debug.conf;overlay_bbc_microbit-bt_ll_sw_split.conf"
32+
platform_allow:
33+
- bbc_microbit
34+
integration_platforms:
35+
- bbc_microbit

0 commit comments

Comments
 (0)