bt_enable() failed after bt_disable() in nrf5340

We want the system to be in low power mode in idle state. Therefore after advertisement is sent the BLE is switched off using bt_disable. The return for this function is fine. But after sleep

when we try to enable ble using bt_enable, this function returns -11. 

We debugged and we saw that the end point attach does not happen and so the semaphore take function() fails.

Can you tell us what we are missing. We are attaching the prj.conf file of application core here.

We are using nrf sdk version 2.,6.1.

it fails at  k_sem_take(&ipc_bound_sem,IPC_BOUND_TIMEOUT_IN_MS); it returns -11;

# GPIO Enable
CONFIG_GPIO=y

CONFIG_I2S=y

# SPI Enable
CONFIG_SPI=y
CONFIG_SPI_ASYNC=y

# I2C Enable
CONFIG_I2C=y

# Floating Point Enable
CONFIG_ASSERT=y
CONFIG_CBPRINTF_FP_SUPPORT=n
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=n
CONFIG_FPU=y
CONFIG_CMSIS_DSP=y
CONFIG_NEWLIB_LIBC=y

# LOG Enable
CONFIG_LOG=n
CONFIG_LOG_MODE_IMMEDIATE=n
#CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n

# Flash Storage Enable
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y

CONFIG_NVS=y
CONFIG_REBOOT=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
# CONFIG_FLASH_MAP=y
# CONFIG_SETTINGS=y

# BLE Config
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
# CONFIG_BT_DEVICE_NAME="IntelliVibe-BAT_DK"
CONFIG_BT_DEVICE_NAME="BLE-TEST"
CONFIG_BT_GATT_NOTIFY_MULTIPLE=y
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_USER_PHY_UPDATE=y
CONFIG_BT_USER_DATA_LEN_UPDATE=y
CONFIG_BT_BUF_ACL_RX_SIZE=517
CONFIG_BT_BUF_ACL_TX_SIZE=517
CONFIG_BT_L2CAP_TX_MTU=517
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_MAX_CONN=1
CONFIG_BT_HCI_VS_EXT=y
# CONFIG_BT_CTLR=y
# CONFIG_BT_SETTINGS=y
# CONFIG_BT_HCI_ACL_FLOW_CONTROL=y

# CONFIG_BT_BAS=y
CONFIG_BT_CTS_CLIENT=y

CONFIG_BT_PERIPHERAL_PREF_MIN_INT=800
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=800
CONFIG_BT_PERIPHERAL_PREF_LATENCY=0
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=y


CONFIG_BT_BUF_ACL_TX_COUNT=20
CONFIG_BT_L2CAP_TX_BUF_COUNT=10
# CONFIG_BT_BUF_ACL_TX_SIZE=39
# CONFIG_BT_CTLR_DATA_LENGTH_MAX=39

# STEP 2 - Enable MCUboot and FOTA
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
CONFIG_SECURE_BOOT=y

CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

CONFIG_PM_DEVICE=y
CONFIG_PM_DEVICE_RUNTIME=y


CONFIG_BOARD_ENABLE_DCDC_APP=n
CONFIG_BOARD_ENABLE_DCDC_HV=n
CONFIG_BOARD_ENABLE_DCDC_NET=n

CONFIG_SOC_ENABLE_LFXO=n

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y

CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
Parents Reply Children
  • I removed the "CONFIG_SOC_NRF53_CPUNET_ENABLE=y" entry from my prj.conf file which let me turn the network core on and off using shell commands and bt_enable() and bt_disable().

    This might not be a viable workaround if you need to use network core resources before calling bt_enable() though.

    I've attached the modified extended advertising sample that I used for testing this. The sample fails to turn the network core back on after issuing the "ble disable" then "ble enable" commands. Comment out the "CONFIG_SOC_NRF53_CPUNET_ENABLE=y" entry in the prj.conf file and the "ble disable" "ble enable" commands should work as intended.

    advertiser.zip

Related