HCI Controller Multiple Connection Support


SDK: NCS 3.0.2 

Part: NRF52840

I am running the NRF52840 as an HCI controller over SPI.  I can advertise and connect.  However, I need to advertise while connected and support multiple peripheral connections. 

I also need two advertising data sets, one advertising on 1Mbps PHY and a secondary advertising channel using Coded PHY.

However, any subsequent call to advertise while connected or to run a second extended advertising set while advertising a legacy advertising set, I get this HCI error:

bt_hci_core: opcode 0x2039 status 0x0d which I read is a "BT_HCI_ERR_INSUFFICIENT_RESOURCES" error.

I believe this is an issue on the controller side.  Can you see anything in my prj file below that is causing this issue?

I assume that setting BT_MAX_CONN to 4 would allow multiple connections and thus multiple advertising sets.  

CONFIG_GPIO=y
CONFIG_SPI=y
CONFIG_SPI_SLAVE=y
CONFIG_BT=y
CONFIG_BT_HCI_RAW=y
CONFIG_BT_MAX_CONN=4
CONFIG_BT_CENTRAL=y

# Settings subsystem (for storing MAC address)
CONFIG_SETTINGS=y
#CONFIG_SETTINGS_NVS=y
# CONFIG_FLASH=y
# CONFIG_FLASH_PAGE_LAYOUT=y
# CONFIG_FLASH_MAP=y
# CONFIG_NVS=y
CONFIG_BT_SETTINGS=y
CONFIG_BT_CTLR_SETTINGS=y
CONFIG_BT_ID_MAX=1

#CONFIG_BT_MAX_PAIRED=5

#CONFIG_BT_L2CAP_TX_MTU=498
CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_BUF_ACL_TX_SIZE=502
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_PHY_CODED=y
CONFIG_BT_CTLR_CONN_RSSI=y
CONFIG_BT_CTLR_ADV_EXT=y

CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
   
# Ensure adequate memory for extended advertising
CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=1650
CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=1650

CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y
#CONFIG_BT_LLL_VENDOR_NORDIC=y
#CCONFIG_BT_LL_SW_SPLIT=y

# Enable extended advertising support in controller
#CONFIG_BT_CTLR_ADV_EXT_PDU_EXTRA_DATA_MEMORY=y
CONFIG_BT_CTLR_ADV_DATA_BUF_MAX=8
CONFIG_BT_EXT_ADV_MAX_ADV_SET=2
CONFIG_BT_CTLR_ADV_SET=2
#CONFIG_BT_CTLR_ADV_AUX_SET=2

CONFIG_MAIN_STACK_SIZE=16384
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=16384
CONFIG_HEAP_MEM_POOL_SIZE=16384


CONFIG_LOG=y
CONFIG_BT_LOG_LEVEL_INF=n
CONFIG_BT_LOG_LEVEL_DBG=y
CONFIG_BT_LOG_LEVEL_WRN=y
CONFIG_BT_HCI_CORE_LOG_LEVEL_DBG=n
CONFIG_BT_HCI_CORE_LOG_LEVEL_WRN=y
CONFIG_BT_HCI_DRIVER_LOG_LEVEL_DBG=n
CONFIG_BT_HCI_DRIVER_LOG_LEVEL_WRN=y
CONFIG_SPI_LOG_LEVEL_DBG=y
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n

CONFIG_LOG_BACKEND_RTT=ya
CONFIG_LOG_BACKEND_UART=n
CONFIG_USE_SEGGER_RTT=y

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y

# Workaround: Unable to allocate command buffer when using K_NO_WAIT since
# Host number of completed commands does not follow normal flow control.
CONFIG_BT_BUF_CMD_TX_COUNT=64

Parents
  • Hi,

    I see you have set CONFIG_BT_CTLR_ADV_SET to 2, and depending on your requiermetns you can set it higher. However, you should also set CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT=4 (or some other sensible number).

  • That worked, thanks!


    I have one further issue I am working through on this HCI build.

    I cannot get the HCI controller to read the settings and restore the MAC address. It seems to be random each time.

    From the warning message in the conf file, it looks like the CONFIG_BT_SETTINGS has a dependency incompatible with HCI_RAW.  Is there another way I can read the MAC so it is persistent?

  • Hi,

    The controller itself has a default address from FICR, so if you are advertisign or scaning using the identity address, this should always be used. Likely you are using a random resolvable address or similar? Alternatively, if you need to set the address you can do that from the host side using the BT_HCI_OP_VS_WRITE_BD_ADDR HCI command. You can see an example of that here (this is for the nRF53 where the host and controller runs on separate cores, which is much the same as running them on different devices).

Reply
  • Hi,

    The controller itself has a default address from FICR, so if you are advertisign or scaning using the identity address, this should always be used. Likely you are using a random resolvable address or similar? Alternatively, if you need to set the address you can do that from the host side using the BT_HCI_OP_VS_WRITE_BD_ADDR HCI command. You can see an example of that here (this is for the nRF53 where the host and controller runs on separate cores, which is much the same as running them on different devices).

Children
No Data
Related