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 <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada
2025-08-29 22:56:27 +02:00
committed by Benjamin Cabé
parent 53835e9524
commit eba31282e8
5 changed files with 98 additions and 3 deletions

View File

@@ -16,6 +16,23 @@ If the used Bluetooth Low Energy Controller supports Extended Scanning, you may
enable :kconfig:option:`CONFIG_BT_EXT_ADV` in the project configuration file. Refer to the
project configuration file for further details.
Building Extended Scanning support for BBC Micro Bit board
**********************************************************
.. code-block:: console
west build -b bbc_microbit . -- -DCONF_FILE='prj_extended.conf' -DEXTRA_CONF_FILE='overlay_bbc_microbit-bt_ll_sw_split.conf'
Thread Analysis for BBC Micro Bit board
***************************************
Due to resource constraints on the BBC Micro Bit board, thread analysis can be enabled to profile
the RAM usage and thread stack sizes be updated to successfully build and run the sample.
.. code-block:: console
west build -b bbc_microbit . -- -DCONF_FILE='prj_extended.conf' -DEXTRA_CONF_FILE='debug.conf;overlay_bbc_microbit-bt_ll_sw_split.conf'
Requirements
************

View File

@@ -0,0 +1,5 @@
# Enable thread analysis
CONFIG_THREAD_ANALYZER=y
CONFIG_THREAD_ANALYZER_AUTO=y
CONFIG_THREAD_ANALYZER_AUTO_INTERVAL=5
CONFIG_THREAD_NAME=y

View File

@@ -0,0 +1,7 @@
/* Keep default IRQ priority low for peripherals to reduce Radio ISR latency.
* ARM Cortex-M4 lowest priority value of 5, i.e. considering Zephyr reserved 2
* levels for Exceptions and ZLI (if enabled).
* ARM Cortex-M0 lowest priority value of 3, i.e. we use it as Zephyr has no
* support for ZLI on Cortex-M0.
*/
#define NRF_DEFAULT_IRQ_PRIORITY 3

View File

@@ -0,0 +1,53 @@
# Adjust Stack Sizes for reduce RAM usage
CONFIG_MAIN_STACK_SIZE=1024
CONFIG_IDLE_STACK_SIZE=128
CONFIG_ISR_STACK_SIZE=1024
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=1024
# Enable Extended Scanning
# CONFIG_BT_EXT_ADV=y
# Set maximum scan data length for Extended Scanning
CONFIG_BT_EXT_SCAN_BUF_SIZE=192
# Zephyr Bluetooth LE Controller needs 16 event buffers to generate Extended
# Advertising Report for receiving the complete 1650 bytes of data.
# Use 4 to be able to receive a minimal extended advertising with chains.
CONFIG_BT_BUF_EVT_RX_COUNT=4
# Use Zephyr Bluetooth Low Energy Controller implementation
CONFIG_BT_LL_SW_SPLIT=y
# Set maximum scan data length for Extended Scanning in Bluetooth LE Controller.
CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=192
# Increase Zephyr Bluetooth LE Controller Rx buffer to receive complete chain
# of PDUs. Need 9 for maximum of 1650 bytes, but we use 3 as minimum to receive
# at least a primary PDU, an auxiliary PDU and a chain PDU.
CONFIG_BT_CTLR_RX_BUFFERS=3
# Enable advanced features
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
# Adjust execution context priorities to achieve lower Radio ISR latencies
CONFIG_BT_CTLR_LLL_PRIO=0
CONFIG_BT_CTLR_ULL_HIGH_PRIO=1
CONFIG_BT_CTLR_ULL_LOW_PRIO=1
# Use just-in-time collision resolution in ticker and LLL pipeline
CONFIG_BT_CTLR_LOW_LAT=n
CONFIG_BT_CTLR_LOW_LAT_ULL_DONE=n
CONFIG_BT_TICKER_LOW_LAT=n
# Increase the below to receive interleaved advertising chains
CONFIG_BT_CTLR_SCAN_AUX_SET=3
CONFIG_BT_CTLR_LOW_LAT_ULL=y
# CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS=y
# CONFIG_BT_CTLR_SCAN_AUX_CHAIN_COUNT=3
# Use unreserved timespace scanning
CONFIG_BT_CTLR_SCAN_UNRESERVED=y
# Code size reduction
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
CONFIG_LTO=y

View File

@@ -3,20 +3,33 @@ sample:
tests:
sample.bluetooth.observer:
harness: bluetooth
tags: bluetooth
platform_allow:
- qemu_cortex_m3
- qemu_x86
- nrf52840dk/nrf52840
integration_platforms:
- qemu_cortex_m3
tags: bluetooth
- nrf52840dk/nrf52840
sample.bluetooth.observer.extended:
harness: bluetooth
extra_args: CONF_FILE="prj_extended.conf"
tags: bluetooth
extra_args:
- CONF_FILE="prj_extended.conf"
platform_allow:
- qemu_cortex_m3
- qemu_x86
- nrf52840dk/nrf52840
tags: bluetooth
integration_platforms:
- qemu_cortex_m3
- nrf52840dk/nrf52840
sample.bluetooth.observer.extended.bbc_microbit.bt_ll_sw_split:
harness: bluetooth
tags: bluetooth
extra_args:
- CONF_FILE="prj_extended.conf"
- EXTRA_CONF_FILE="debug.conf;overlay_bbc_microbit-bt_ll_sw_split.conf"
platform_allow:
- bbc_microbit
integration_platforms:
- bbc_microbit