This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Impossible to use BLE DFU

Hi,

I'm trying to set up BLE DFU for bith the app and net cores of the nrf5340.

We are currentrly using NCS 1.4.99, commit 3366927a54 (need latest master for lorawan usage)

I've enabled all the configurations described in the doc:

CONFIG_MCUMGR=y # Missing in the doc!
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_SMP_BT=y

The cores boot,  the device is discoverable using the following code:

#if defined(CONFIG_BT)
#if defined(CONFIG_MCUMGR_CMD_OS_MGMT)
#include <os_mgmt/os_mgmt.h>
#endif
#if defined(CONFIG_MCUMGR_CMD_IMG_MGMT)
#include <img_mgmt/img_mgmt.h>
#endif
#if defined(CONFIG_MCUMGR_SMP_BT)
#include <mgmt/mcumgr/smp_bt.h>
#endif
#endif
static void test_bt(void)
{
#if defined(CONFIG_BT)
	bt_enable(NULL);

#if defined(CONFIG_MCUMGR_CMD_OS_MGMT)
	os_mgmt_register_group();
#endif
#if defined(CONFIG_MCUMGR_CMD_IMG_MGMT)
	img_mgmt_register_group();
#endif
#if defined(CONFIG_MCUMGR_SMP_BT)
	smp_bt_register();
#endif

	/* Start advertising */
	bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0);
#endif
}

I've also generated another firmware and I've put the app_update.bin on my phone.

Using nRF Connect app, I can connect to my device. I press "DFU" and choose the app_update.bin.

The device becomes "bound", and the DFU starts the "Validating" step.

The "Validating" state freezes for about 5 seconds, and the device crash:

ASSERTION FAIL [err == 0] @WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:374 
k_sem_take failed with err -11
 

Looks like the communication between app and net cores is not working properly during the DFU.

Any guidelines to fix it and update app and net cores using BLE?

Regards

Giuliano 

Related