bt_enable() blocks forever when updating from NCS 2.6.0 to NCS 2.9.0

Hi,

I recently updated from NCS 2.6.0 to NCS 2.9.0 which had lots of changes. I believe I ported from child_image to sysbuild with success, as my main application on app core of nrf5340 custom board boots normally over MCUboot, and network core has b0n + hci_ipc and also seems to boot since I see that the controller responds to the first HCI commands sent by the host (versions. manufacturer etc...) I seemed to have adapted to also any HCI device tree changes for both cpuapp and cpunet.dts, as everything compiles, boots, and BLE host seem to be able to communicate with controller over HCI IPC.

The issue I've noticed is that in hci_core.c, there is a net_buf pool of size 10 (CONFIG_BT_BUF_CMD_TX_COUNT)  that gets full and then the next attempt to allocate a net_buf fails. I tracked it down and it seems that there is a net_buf leak issue that the net_buf ref count never reaches 0 when bt_hci_cmd_send_sync() is called to send the commands, so after 10 calls of it in the HCI initialization, it blocks forever since K_FOREVER is used as timeout when not called for sysworkq.

Some details :

- bt_enable() is called with NULL as callback to execute it in synchronous manner (and not from sysworkq)
- I have a sysbuild/hci_ipc.conf file correctly picked by build system with these flags ->

CONFIG_BT_CTLR=y
CONFIG_BT_CTLR_ADV_EXT=n    # Check that CONFIG_BT_EXT_ADV is enabled in Host if this is enabled
CONFIG_BT_CTLR_CONN_RSSI=y

CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_BUF_ACL_TX_SIZE=502

CONFIG_BT_MAX_CONN=1

CONFIG_MBOX_NRFX_IPC=y

And here is BT related flags in my prj.conf file :
CONFIG_BT=y
CONFIG_BT_LOG_LEVEL_ERR=y
CONFIG_BT_SMP=y
CONFIG_BT_SIGNING=n
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=y
CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=y
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=24
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=40
CONFIG_BT_PERIPHERAL_PREF_LATENCY=0
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=600
CONFIG_BT_CENTRAL=n
CONFIG_BT_ATT_PREPARE_COUNT=5
CONFIG_BT_BAS=y
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_DEVICE_NAME_MAX=65
CONFIG_BT_DEVICE_NAME_GATT_WRITABLE=n
CONFIG_BT_MAX_PAIRED=1
CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
CONFIG_BT_PRIVACY=n
CONFIG_BT_MAX_CONN=1
CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_BUF_ACL_TX_SIZE=502
CONFIG_BT_L2CAP_TX_MTU=498
CONFIG_BT_L2CAP_TX_BUF_COUNT=10
CONFIG_BT_EXT_ADV=n
CONFIG_BT_CONN_PARAM_UPDATE_TIMEOUT=100
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_GATT_AUTO_SEC_REQ=n   # Android is not able to handle this
CONFIG_BT_AUTO_PHY_UPDATE=n     # Let central initiate PHY update
CONFIG_SETTINGS=y
CONFIG_BT_SETTINGS=y
CONFIG_SETTINGS_NVS=y

And finally, Kconfig.sysbuild flags for n5340 based devices :
if SOC_SERIES_NRF53X

config DFU_MULTI_IMAGE_PACKAGE_NET
	default y

config SECURE_BOOT_NETCORE
	default y

config NETCORE_APP_UPDATE
	default y

config MCUBOOT_UPDATEABLE_IMAGES
	default 2

choice MCUBOOT_MODE
	default MCUBOOT_MODE_OVERWRITE_ONLY
endchoice

endif # SOC_SERIES_NRF53X

endif # BOOTLOADER_MCUBOOT

if SOC_SERIES_NRF53X

choice NETCORE
	default NETCORE_HCI_IPC
endchoice

endif # SOC_SERIES_NRF53X


I have zephyr,bt-hci = &bt_hci_ipc0; in the cpuapp DTS file and zephyr,bt-hci-ipc = &ipc0; in the cpunet DTS as  chosen properties, as the nrf5340dk does.

Any help would be much appreciated.

Best regards,
Jimmy





Related