nRF5340-DK - BLE multiple connection

Hello,

I'm trying to make the nrf5340-DK capable of connecting to BLE from multiple devices.

The program is based on: Bluetooth: Bluetooth: Peripheral UART.

I found the following discussions on this:

BLE multiple connections support - Nordic Q&A - Nordic DevZone - Nordic DevZone

Mutli role in NRF connect, Advertising while connected - Nordic Q&A - Nordic DevZone - Nordic DevZone

However the order only let me connect to one device and then it prints an advertising error:

[00:00:42.735,412] <wrn> bt_hci_core: opcode 0x200a status 0x0d
[00:00:42.735,443] <err> bt_adv: Failed to start advertiser
[00:00:42.735,473] <err> uart_debug: Advertising failed: -12


and thus nrf5340 stops being connectable for other devices.

in /proj.conf I have:

# UART async
CONFIG_UART_ASYNC_API=y

# Console/logging
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_LOG=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_BACKEND_RTT=n

# BLE
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="UART_Debug"
CONFIG_BT_MAX_CONN=4
CONFIG_BT_MAX_PAIRED=4

# NUS service
CONFIG_BT_NUS=y

# BLE settings
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

# DK library pro LEDs
CONFIG_DK_LIBRARY=y

# Memory 
CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Assert for debug
CONFIG_ASSERT=y

in src/sysbuild/ipc_radio/prj.conf I have:

CONFIG_SERIAL=n
CONFIG_UART_CONSOLE=n
CONFIG_LOG=n

and in src/sysbuild/ipc_radio/prj_bt_rpc.conf:

CONFIG_SERIAL=n
CONFIG_UART_CONSOLE=n
CONFIG_LOG=n

CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CENTRAL=n
CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT=4
CONFIG_BT_MAX_CONN=4
CONFIG_BT_MAX_PAIRED=4
CONFIG_BT_DEVICE_NAME="Nordic_UART_Service"

Can you advise me how to ensure multiple connections (from multiple devices) to nRF5340-DK possible at the same time, please?

Thank you

Parents
  • Hello,

    Are you able to upload a minimal version of your project so I can have a look it here? I'm not sure why you would get this no memory error when your project configuration is confiugured to support up to 4 peripheral connections.

    Best regards,

    Vidar

  • Hello,

    yes, definitely, I'm attaching my full project here:

    BLE_multiple_question.zip

    - main_orig.c is the original peripheral_uart samle main

    - UART_to_BT.c is the different approach

    - UART_BT_multi_test.c attempt for multiple connections

    but there are no multiple connections working on any of them.

    Please find out what is causing advertising to stop working after the first device is connected and find a solution to allow multiple connections to the nRF5340-DK at once. I would appreciate an example allowing multiple BLE connections.

    Thank you

  • Hello,

    Thanks. I noticed now after building your project that your Kconfig fragment (src/sysbuild/ipc_radio/prj_bt_rpc.conf) is incorrectly named. To overlay the default configurations, you should name the file "ipc_radio.conf" and place it directly under sysbuild : <project dir>/sysbuild/ipc_radio.conf. Remember to do a pristine build after adding new files in the sysbuild folder to allow the build system to detect the change.

Reply
  • Hello,

    Thanks. I noticed now after building your project that your Kconfig fragment (src/sysbuild/ipc_radio/prj_bt_rpc.conf) is incorrectly named. To overlay the default configurations, you should name the file "ipc_radio.conf" and place it directly under sysbuild : <project dir>/sysbuild/ipc_radio.conf. Remember to do a pristine build after adding new files in the sysbuild folder to allow the build system to detect the change.

Children
Related