ncs 3.3.0: Achieve non-concurrent switching between ESB/BLE

Hi:

I use ncs3.3.0 and nrf54l15dk.

PC BLE pairing nrf54l15dk failed log:

I: Connected to: 28:D0:43:BB:9F:43 (public)

E: SMP Timeout (flags:0x000023a8 allowed_cmds:0x00000020)
I: Security failed: 28:D0:43:BB:9F:43 (public) level 1 err 9

Pairing failed: 28:D0:43:BB:9F:43 (public) (reason 9)
I: Disconnected (reason 19)

I: Disconnected from channel 1

I: Connection object available from previous conn. Disconnect is complete!

I: Channel 1 is empty, open advertising

I: Advertising started on channel 1

prj.conf


CONFIG_NCS_SAMPLES_DEFAULTS=y
CONFIG_ESB=y
CONFIG_ESB_RADIO_IRQ_PRIORITY=0
CONFIG_ESB_EVENT_IRQ_PRIORITY=1
CONFIG_CLOCK_CONTROL=y
CONFIG_ESB_CLOCK_INIT=y

CONFIG_ESB_FAST_SWITCHING=y
CONFIG_ESB_FAST_CHANNEL_SWITCHING=y

CONFIG_DK_LIBRARY=y

CONFIG_SPIN_VALIDATE=n
CONFIG_PM=n
CONFIG_TIMESLICING=n

CONFIG_NRFX_GPPI=y
CONFIG_NRFX_TIMER=y
CONFIG_NRFX_SPIM=y
CONFIG_NRFX_GPIOTE=y

CONFIG_SPI=n

CONFIG_MAIN_STACK_SIZE=8192
CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

CONFIG_GPIO=n
CONFIG_NRFX_GPIOTE_NUM_OF_EVT_HANDLERS=3
#CONFIG_CODE_DATA_RELOCATION=y

CONFIG_CLOCK_CONTROL=y
CONFIG_CLOCK_CONTROL_NRF=y

# nrfx power
CONFIG_NRFX_POWER=y

# 启用时间戳显示
CONFIG_LOG_BACKEND_SHOW_TIMESTAMP=y

# 将时间戳格式化为 hh:mm:ss.ms,us(推荐)
CONFIG_LOG_BACKEND_FORMAT_TIMESTAMP=y

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Nordic_HIDS_mouse"
CONFIG_BT_DEVICE_APPEARANCE=962
CONFIG_BT_L2CAP_TX_BUF_COUNT=5

CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=4
CONFIG_BT_ID_MAX=4 
CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT=1

CONFIG_BT_EXT_ADV=y
CONFIG_BT_EXT_ADV_MAX_ADV_SET=4

# HID Service
CONFIG_BT_HIDS=y
CONFIG_BT_HIDS_MAX_CLIENT_COUNT=1
CONFIG_BT_CONN_CTX=y
CONFIG_BT_HIDS_INPUT_REP_MAX=1
CONFIG_BT_HIDS_OUTPUT_REP_MAX=0
CONFIG_BT_HIDS_FEATURE_REP_MAX=0
CONFIG_BT_ATT_PREPARE_COUNT=2
CONFIG_BT_GATT_SERVICE_CHANGED=y


# Battery Service
CONFIG_BT_BAS=y

# Device Information Service
CONFIG_BT_DIS=y
CONFIG_BT_DIS_PNP=y
CONFIG_BT_DIS_MANUF_NAME_STR="NordicSemiconductor"
CONFIG_BT_DIS_PNP_VID_SRC=2
CONFIG_BT_DIS_PNP_VID=0x1915
CONFIG_BT_DIS_PNP_PID=0xEEEE
CONFIG_BT_DIS_PNP_VER=0x0100

CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

CONFIG_APP_EVENT_MANAGER=y
CONFIG_CAF=y

# SMP(Security Management Protocol)
CONFIG_BT_SMP=y

# 安全配置
CONFIG_BT_HIDS_DEFAULT_PERM_RW_ENCRYPT=y

# 启用 bond 持久化存储
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
#CONFIG_NVS=y # nRF54L 系列请改用 CONFIG_ZMS=y
CONFIG_ZMS=y
CONFIG_SETTINGS=y  

# 白名单 + 隐私特性
CONFIG_BT_FILTER_ACCEPT_LIST=y
#CONFIG_BT_PRIVACY=y

# CONFIG_MPSL=y                                                                                                      
CONFIG_ESB_DYNAMIC_INTERRUPTS=y                                                                                    
CONFIG_BT_UNINIT_MPSL_ON_DISABLE=y                                                                                 
CONFIG_MPSL_DYNAMIC_INTERRUPTS=y                                                                                   
CONFIG_DYNAMIC_INTERRUPTS=y                                                                                        
CONFIG_DYNAMIC_DIRECT_INTERRUPTS=y 

But with BT configuration, turning off ESB related content, it can be paired successfully.

Then no non ESB and BLE concurrent routines were found in ncs3.3.0.

Parents
  • ESB Fast Switching on the nRF54L15 isn't supported yet in the SDK. So, ESB and BLE cannot run concurrently on the same radio. ESB requires exclusive use of the radio (NRF_RADIO), while BLE is managed by the SoftDevice Controller via MPSL.

    The dynamic-interrupt options in your config (CONFIG_ESB_DYNAMIC_INTERRUPTS, CONFIG_MPSL_DYNAMIC_INTERRUPTS, etc.) allow runtime IRQ handover, but they do not enable true simultaneous operation. That is why pairing works when ESB is disabled, and fails when ESB is enabled.

    Some configuration notes:

    • Remove CONFIG_ESB_FAST_SWITCHING and CONFIG_ESB_FAST_CHANNEL_SWITCHING — these are for nRF54H20 only, not nRF54L15.
    • CONFIG_ESB_CLOCK_INIT — not a valid nCS Kconfig option?
    • Avoid forcing CONFIG_ESB_RADIO_IRQ_PRIORITY=0 unless strictly needed; default values are recommended.

    If you want to use both ESB and BLE in the same product, the radio must be time-sliced in application code. You can switch between BLE and ESB by disable/re-init the two:

    1. bt_disable() — this calls mpsl_lib_uninit() and cleans up MPSL/BLE radio usage
    2. esb_init() — ESB takes over the radio interrupts
    3. When ESB is finished: esb_disable()
    4. To return to BLE: bt_enable() — MPSL/BLE reclaim the radio

    esb_init() installs ESB’s radio (and related) interrupt handlers. If MPSL has not been properly cleaned up/uninitialized first, ESB can receive unexpected radio interrupts because both stacks may contend for the same IRQ path.

    Stine

Reply
  • ESB Fast Switching on the nRF54L15 isn't supported yet in the SDK. So, ESB and BLE cannot run concurrently on the same radio. ESB requires exclusive use of the radio (NRF_RADIO), while BLE is managed by the SoftDevice Controller via MPSL.

    The dynamic-interrupt options in your config (CONFIG_ESB_DYNAMIC_INTERRUPTS, CONFIG_MPSL_DYNAMIC_INTERRUPTS, etc.) allow runtime IRQ handover, but they do not enable true simultaneous operation. That is why pairing works when ESB is disabled, and fails when ESB is enabled.

    Some configuration notes:

    • Remove CONFIG_ESB_FAST_SWITCHING and CONFIG_ESB_FAST_CHANNEL_SWITCHING — these are for nRF54H20 only, not nRF54L15.
    • CONFIG_ESB_CLOCK_INIT — not a valid nCS Kconfig option?
    • Avoid forcing CONFIG_ESB_RADIO_IRQ_PRIORITY=0 unless strictly needed; default values are recommended.

    If you want to use both ESB and BLE in the same product, the radio must be time-sliced in application code. You can switch between BLE and ESB by disable/re-init the two:

    1. bt_disable() — this calls mpsl_lib_uninit() and cleans up MPSL/BLE radio usage
    2. esb_init() — ESB takes over the radio interrupts
    3. When ESB is finished: esb_disable()
    4. To return to BLE: bt_enable() — MPSL/BLE reclaim the radio

    esb_init() installs ESB’s radio (and related) interrupt handlers. If MPSL has not been properly cleaned up/uninitialized first, ESB can receive unexpected radio interrupts because both stacks may contend for the same IRQ path.

    Stine

Children
No Data
Related