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

NCS OTA DFU failed in nrf52832

Hi,

 I am trying to test and develop the DFU-OTA in nRF CONNECT SDK for nRF52832

I followed these link to develop  i am using NCS v1.4.2

1. I have copied the peripheral_lbs code to my workspace

2. Based on the link i have added few things and here i attached the related files

main.c

/*
 * Copyright (c) 2018 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
 */

#include <zephyr/types.h>
#include <stddef.h>
#include <string.h>
#include <errno.h>
#include <sys/printk.h>
#include <sys/byteorder.h>
#include <zephyr.h>
#include <drivers/gpio.h>
#include <soc.h>

#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/conn.h>
#include <bluetooth/uuid.h>
#include <bluetooth/gatt.h>

#include <bluetooth/services/lbs.h>

#include <settings/settings.h>

#include <dk_buttons_and_leds.h>

// For FOTA
#include <tinycbor/cbor.h>
#include "cborattr/cborattr.h"
#include <mgmt/mgmt.h>
#include <mgmt/mcumgr/smp_bt.h>
#include <mgmt/mcumgr/buf.h>
#include <mgmt/mcumgr/smp.h>
#include "os_mgmt/os_mgmt.h"
#include "os_mgmt/os_mgmt_impl.h"
#include "os_mgmt/os_mgmt_config.h"
#include "img_mgmt/image.h"
#include "img_mgmt/img_mgmt.h"
#include "img_mgmt/img_mgmt_impl.h"
#include "img_mgmt/img_mgmt_config.h"

#define DEVICE_NAME             CONFIG_BT_DEVICE_NAME
#define DEVICE_NAME_LEN         (sizeof(DEVICE_NAME) - 1)


#define RUN_STATUS_LED          DK_LED1
#define CON_STATUS_LED          DK_LED2
#define RUN_LED_BLINK_INTERVAL  1000

#define USER_LED                DK_LED3

#define USER_BUTTON             DK_BTN1_MSK

static bool app_button_state;

static const struct bt_data ad[] = {
	BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
	BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
};

static const struct bt_data sd[] = {
	BT_DATA_BYTES(BT_DATA_UUID128_ALL, BT_UUID_LBS_VAL),
};

static void connected(struct bt_conn *conn, uint8_t err)
{
	if (err) {
		printk("Connection failed (err %u)\n", err);
		return;
	}

	printk("Connected\n");

	dk_set_led_on(CON_STATUS_LED);
}

static void disconnected(struct bt_conn *conn, uint8_t reason)
{
	printk("Disconnected (reason %u)\n", reason);

	dk_set_led_off(CON_STATUS_LED);
}

#ifdef CONFIG_BT_LBS_SECURITY_ENABLED
static void security_changed(struct bt_conn *conn, bt_security_t level,
			     enum bt_security_err err)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	if (!err) {
		printk("Security changed: %s level %u\n", addr, level);
	} else {
		printk("Security failed: %s level %u err %d\n", addr, level,
			err);
	}
}
#endif

static struct bt_conn_cb conn_callbacks = {
	.connected        = connected,
	.disconnected     = disconnected,
#ifdef CONFIG_BT_LBS_SECURITY_ENABLED
	.security_changed = security_changed,
#endif
};

#if defined(CONFIG_BT_LBS_SECURITY_ENABLED)
static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	printk("Passkey for %s: %06u\n", addr, passkey);
}

static void auth_cancel(struct bt_conn *conn)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	printk("Pairing cancelled: %s\n", addr);
}

static void pairing_confirm(struct bt_conn *conn)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	bt_conn_auth_pairing_confirm(conn);

	printk("Pairing confirmed: %s\n", addr);
}

static void pairing_complete(struct bt_conn *conn, bool bonded)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	printk("Pairing completed: %s, bonded: %d\n", addr, bonded);
}

static void pairing_failed(struct bt_conn *conn, enum bt_security_err reason)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	printk("Pairing failed conn: %s, reason %d\n", addr, reason);
}

static struct bt_conn_auth_cb conn_auth_callbacks = {
	.passkey_display = auth_passkey_display,
	.cancel = auth_cancel,
	.pairing_confirm = pairing_confirm,
	.pairing_complete = pairing_complete,
	.pairing_failed = pairing_failed
};
#else
static struct bt_conn_auth_cb conn_auth_callbacks;
#endif

static void app_led_cb(bool led_state)
{
	dk_set_led(USER_LED, led_state);
}

static bool app_button_cb(void)
{
	return app_button_state;
}

static struct bt_lbs_cb lbs_callbacs = {
	.led_cb    = app_led_cb,
	.button_cb = app_button_cb,
};

static void button_changed(uint32_t button_state, uint32_t has_changed)
{
	if (has_changed & USER_BUTTON) {
		bt_lbs_send_button_state(button_state);
		app_button_state = button_state ? true : false;
	}
}

static int init_button(void)
{
	int err;

	err = dk_buttons_init(button_changed);
	if (err) {
		printk("Cannot init buttons (err: %d)\n", err);
	}

	return err;
}

void main(void)
{
	int blink_status = 0;
	int err;

	printk("Starting Bluetooth Peripheral LBS example\n");
        printk("Application build time: %s %s \n", __DATE__, __TIME__);
	err = dk_leds_init();
	if (err) {
		printk("LEDs init failed (err %d)\n", err);
		return;
	}

	err = init_button();
	if (err) {
		printk("Button init failed (err %d)\n", err);
		return;
	}

	bt_conn_cb_register(&conn_callbacks);
	if (IS_ENABLED(CONFIG_BT_LBS_SECURITY_ENABLED)) {
		bt_conn_auth_cb_register(&conn_auth_callbacks);
	}

	err = bt_enable(NULL);
	if (err) {
		printk("Bluetooth init failed (err %d)\n", err);
		return;
	}

	printk("Bluetooth initialized\n");

	if (IS_ENABLED(CONFIG_SETTINGS)) {
		settings_load();
	}

	err = bt_lbs_init(&lbs_callbacs);
	if (err) {
		printk("Failed to init LBS (err:%d)\n", err);
		return;
	}

	err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad),
			      sd, ARRAY_SIZE(sd));
	if (err) {
		printk("Advertising failed to start (err %d)\n", err);
		return;
	}

	printk("Advertising successfully started\n");
        // For FOTA
  os_mgmt_register_group();
  img_mgmt_register_group();
  smp_bt_register();

	for (;;) {
		dk_set_led(RUN_STATUS_LED, (++blink_status) % 2);
		k_sleep(K_MSEC(RUN_LED_BLINK_INTERVAL));
	}
}

prj.conf

#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
#
CONFIG_NCS_SAMPLES_DEFAULTS=y

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Nordic_Blinky"

# Enable the LBS service
CONFIG_BT_LBS=y
CONFIG_BT_LBS_POLL_BUTTON=y
CONFIG_DK_LIBRARY=y

# Added for FOTA
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUMGR=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_SMP_BT=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

also added full .zip file here

1447.dfu_app.zip

3. After successful compilation of the code uploaded to the Empty nRF52 DK (there is no bootloader separately added before )

4. Successfully showing the services in the nRF connect APP while entering into DFU

5. On the other-side i have just changed the device name to dfu_nrf_blinky

6. taken the build and app_update.bin is taken to mobile device

7. While initialize the DFU it asked for pairing and also paired with the device with valid key.

8. And on entering to start DFU it was disconnected like this and video is linked below with respective log

Log in the serial

*** Booting Zephyr OS build v2.4.0-ncs2  ***
[00:00:00.528,289] [0m<inf> mcuboot: Starting bootloader[0m
[00:00:00.534,576] [0m<inf> mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3[0m
[00:00:00.545,043] [0m<inf> mcuboot: Boot source: none[0m
[00:00:00.550,781] [0m<inf> mcuboot: Swap type: none[0m
[00:00:00.844,512] [0m<inf> mcuboot: Bootloader chainload address offset: 0xc000[0m
[00:00:00.852,508] [0m<inf> mcuboot: Jumping to the first image slot[0m
*** Booting Zephyr OS build v2.4.0-ncs2  ***
Starting Bluetooth Peripheral LBS example
Application build time: Mar 15 2021 14:36:28 
I: 2 Sectors of 4096 bytes
I: alloc wra: 0, ff0
I: data wra: 0, 0
I: SoftDevice Controller build revision: 
I: cf 5c 0f 11 88 9c d7 02 |.\......
I: 15 27 c7 c3 ca 60 19 85 |.'...`..
I: b7 c4 50 e3             |..P.    
I: No ID address. App must call settings_load()
Bluetooth initialized
Advertising successfully started
Connected
Passkey for 7e:2a:18:a3:a2:3c (random): 757200
Security changed: 7e:2a:18:a3:a2:3c (random) level 4
Pairing completed: 7c:78:7e:78:66:b3 (public), bonded: 1
Disconnected (reason 19)
Connected
Security changed: 7c:78:7e:78:66:b3 (public) level 4
Disconnected (reason 19)
Connected
Security changed: 7c:78:7e:78:66:b3 (public) level 4
Disconnected (reason 19)
Connected
Security changed: 7c:78:7e:78:66:b3 (public) level 4

Log from the nrf connect APP

nRF Connect, 2021-03-15
Nordic_Blinky (FB:B4:FA:11:EB:63)
V	14:54:14.912	Connecting to FB:B4:FA:11:EB:63...
D	14:54:14.912	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
D	14:54:15.042	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
D	14:54:15.096	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I	14:54:15.097	Connected to FB:B4:FA:11:EB:63
D	14:54:15.099	wait(1600ms)
D	14:54:15.360	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11)
D	14:54:15.421	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDED (12)
I	14:54:15.421	Device bonded
I	14:54:15.616	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
I	14:54:16.023	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
V	14:54:16.700	Discovering services...
D	14:54:16.700	gatt.discoverServices()
D	14:54:16.713	[Callback] Services discovered with status: 0
I	14:54:16.714	Services discovered
V	14:54:16.737	Generic Attribute (0x1801)
- Service Changed [I] (0x2A05)
   Client Characteristic Configuration (0x2902)
- Client Supported Features [R W] (0x2B29)
- Database Hash [R] (0x2B2A)
Generic Access (0x1800)
- Device Name [R] (0x2A00)
- Appearance [R] (0x2A01)
- Peripheral Preferred Connection Parameters [R] (0x2A04)
Nordic LED Button Service (00001523-1212-efde-1523-785feabcd123)
- Button [N R] (00001524-1212-efde-1523-785feabcd123)
   Client Characteristic Configuration (0x2902)
- LED [W] (00001525-1212-efde-1523-785feabcd123)
SMP Service (8d53dc1d-1db7-4cd3-868b-8a527460aa84)
- SMP Characteristic [N WNR] (da2e7828-fbce-4e01-ae9e-261174997c48)
   Client Characteristic Configuration (0x2902)
D	14:54:16.738	gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
D	14:54:16.740	gatt.setCharacteristicNotification(00001524-1212-efde-1523-785feabcd123, true)
I	14:54:20.973	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 420ms)
V	14:54:22.707	[McuMgr] Connecting...
D	14:54:22.720	[McuMgr] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, LE 1M)
D	14:54:22.751	[McuMgr] [Callback] Connection state changed with status: 0 and new state: 2 (CONNECTED)
I	14:54:22.767	[McuMgr] Connected to FB:B4:FA:11:EB:63
D	14:54:22.786	[McuMgr] wait(1600)
V	14:54:24.400	[McuMgr] Discovering services...
D	14:54:24.418	[McuMgr] gatt.discoverServices()
I	14:54:24.472	[McuMgr] Services discovered
V	14:54:24.483	[McuMgr] Primary service found
I	14:54:24.500	[McuMgr] Service Changed characteristic found on a bonded device
D	14:54:24.513	[McuMgr] gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
V	14:54:24.550	[McuMgr] Enabling indications for 00002a05-0000-1000-8000-00805f9b34fb
D	14:54:24.561	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x02-00)
I	14:54:24.662	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 02-00
I	14:54:24.672	[McuMgr] Service Changed notifications enabled
V	14:54:24.695	[McuMgr] Requesting new MTU...
D	14:54:24.705	[McuMgr] gatt.requestMtu(515)
I	14:54:24.797	[McuMgr] MTU changed to: 65
D	14:54:24.807	[McuMgr] gatt.setCharacteristicNotification(da2e7828-fbce-4e01-ae9e-261174997c48, true)
V	14:54:24.831	[McuMgr] Enabling notifications for da2e7828-fbce-4e01-ae9e-261174997c48
D	14:54:24.852	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)
I	14:54:24.979	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
I	14:54:24.992	[McuMgr] Notifications enabled
V	14:54:25.034	[McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND)
D	14:54:25.047	[McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48)
I	14:54:25.066	[McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 00-00-00-02-00-01-00-00-BF-FF
A	14:54:25.106	[McuMgr] "Operation: READ
Flags: 0
Length: 2
Group Id: 1 (IMAGE)
Sequence Num: 0
Command Id: 0 (STATE)
Message: {}" sent
I	14:54:25.124	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 01-00-00-86-00-01-00-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-30-2E-30-64-68-61-73-68-58-20-AC-9F-71-AD-D4-4D-30-DB-72-07-FB-55-47-69-4B-33-95
I	14:54:25.161	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 8E-0A-87-5A-57-1A-5A-E0-48-51-DB-E1-28-88-C5-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E
I	14:54:25.174	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 74-F4-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF
A	14:54:25.209	[McuMgr] "{"images":[{"slot":0,"version":"0.0.0","hash":"rJ9xrdRNMNtyB/tVR2lLM5WOCodaVxpa4EhR2+EoiMU=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false}],"splitStatus":0}" received
V	14:54:25.227	[McuMgr] Uploading firmware...
I	14:54:46.130	Notification received from 00001524-1212-efde-1523-785feabcd123, value: (0x) 01
A	14:54:46.130	"Button pressed" received
I	14:54:46.488	Notification received from 00001524-1212-efde-1523-785feabcd123, value: (0x) 00
A	14:54:46.488	"Button released" received
I	14:54:47.030	Notification received from 00001524-1212-efde-1523-785feabcd123, value: (0x) 01
A	14:54:47.030	"Button pressed" received
I	14:54:47.431	Notification received from 00001524-1212-efde-1523-785feabcd123, value: (0x) 00
A	14:54:47.431	"Button released" received
V	14:54:55.459	[McuMgr] Connecting...
D	14:54:55.711	[McuMgr] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, LE 1M)
D	14:54:55.828	[McuMgr] [Callback] Connection state changed with status: 0 and new state: 2 (CONNECTED)
I	14:54:55.853	[McuMgr] Connected to FB:B4:FA:11:EB:63
D	14:54:55.887	[McuMgr] wait(1600)
I	14:54:55.906	[McuMgr] MTU changed to: 65
V	14:54:57.503	[McuMgr] Discovering services...
D	14:54:57.522	[McuMgr] gatt.discoverServices()
I	14:54:57.542	[McuMgr] Services discovered
V	14:54:57.558	[McuMgr] Primary service found
I	14:54:57.589	[McuMgr] Service Changed characteristic found on a bonded device
D	14:54:57.602	[McuMgr] gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
V	14:54:57.643	[McuMgr] Enabling indications for 00002a05-0000-1000-8000-00805f9b34fb
D	14:54:57.659	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x02-00)
I	14:54:57.739	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 02-00
I	14:54:57.748	[McuMgr] Service Changed notifications enabled
V	14:54:57.779	[McuMgr] Requesting new MTU...
D	14:54:57.796	[McuMgr] gatt.requestMtu(515)
I	14:54:57.873	[McuMgr] MTU changed to: 65
D	14:54:57.884	[McuMgr] gatt.setCharacteristicNotification(da2e7828-fbce-4e01-ae9e-261174997c48, true)
V	14:54:57.913	[McuMgr] Enabling notifications for da2e7828-fbce-4e01-ae9e-261174997c48
D	14:54:57.923	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)
I	14:54:58.053	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
I	14:54:58.063	[McuMgr] Notifications enabled
V	14:54:58.092	[McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND)
D	14:54:58.103	[McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48)
I	14:54:58.118	[McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 00-00-00-02-00-01-00-00-BF-FF
A	14:54:58.132	[McuMgr] "Operation: READ
Flags: 0
Length: 2
Group Id: 1 (IMAGE)
Sequence Num: 0
Command Id: 0 (STATE)
Message: {}" sent
I	14:54:58.206	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 01-00-00-86-00-01-00-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-30-2E-30-64-68-61-73-68-58-20-AC-9F-71-AD-D4-4D-30-DB-72-07-FB-55-47-69-4B-33-95
I	14:54:58.252	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 8E-0A-87-5A-57-1A-5A-E0-48-51-DB-E1-28-88-C5-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E
I	14:54:58.267	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 74-F4-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF
A	14:54:58.316	[McuMgr] "{"images":[{"slot":0,"version":"0.0.0","hash":"rJ9xrdRNMNtyB/tVR2lLM5WOCodaVxpa4EhR2+EoiMU=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false}],"splitStatus":0}" received
V	14:54:58.335	[McuMgr] Uploading firmware...
V	14:55:15.765	Disconnecting...
D	14:55:15.765	gatt.disconnect()
D	14:55:15.809	[Callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
I	14:55:15.809	Disconnected
D	14:55:16.833	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED

nRF Connect, 2021-03-15
Nordic_Blinky (FB:B4:FA:11:EB:63)
V	15:07:18.490	[McuMgr] Connecting...
D	15:07:18.500	[McuMgr] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, LE 1M)
D	15:07:18.520	[McuMgr] [Callback] Connection state changed with status: 0 and new state: 2 (CONNECTED)
I	15:07:18.534	[McuMgr] Connected to FB:B4:FA:11:EB:63
D	15:07:18.548	[McuMgr] wait(1600)
V	15:07:20.167	[McuMgr] Discovering services...
D	15:07:20.176	[McuMgr] gatt.discoverServices()
I	15:07:20.198	[McuMgr] Services discovered
V	15:07:20.229	[McuMgr] Primary service found
I	15:07:20.257	[McuMgr] Service Changed characteristic found on a bonded device
D	15:07:20.268	[McuMgr] gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
V	15:07:20.290	[McuMgr] Enabling indications for 00002a05-0000-1000-8000-00805f9b34fb
D	15:07:20.299	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x02-00)
I	15:07:20.379	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 02-00
I	15:07:20.390	[McuMgr] Service Changed notifications enabled
V	15:07:20.417	[McuMgr] Requesting new MTU...
D	15:07:20.427	[McuMgr] gatt.requestMtu(515)
I	15:07:20.514	[McuMgr] MTU changed to: 65
D	15:07:20.525	[McuMgr] gatt.setCharacteristicNotification(da2e7828-fbce-4e01-ae9e-261174997c48, true)
V	15:07:20.561	[McuMgr] Enabling notifications for da2e7828-fbce-4e01-ae9e-261174997c48
D	15:07:20.577	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)
I	15:07:20.741	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
I	15:07:20.760	[McuMgr] Notifications enabled
V	15:07:20.816	[McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND)
D	15:07:20.832	[McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48)
I	15:07:20.853	[McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 00-00-00-02-00-01-00-00-BF-FF
A	15:07:20.874	[McuMgr] "Operation: READ
Flags: 0
Length: 2
Group Id: 1 (IMAGE)
Sequence Num: 0
Command Id: 0 (STATE)
Message: {}" sent
I	15:07:20.923	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 01-00-00-86-00-01-00-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-30-2E-30-64-68-61-73-68-58-20-AC-9F-71-AD-D4-4D-30-DB-72-07-FB-55-47-69-4B-33-95
I	15:07:20.938	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 8E-0A-87-5A-57-1A-5A-E0-48-51-DB-E1-28-88-C5-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E
I	15:07:20.978	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 74-F4-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF
A	15:07:21.028	[McuMgr] "{"images":[{"slot":0,"version":"0.0.0","hash":"rJ9xrdRNMNtyB/tVR2lLM5WOCodaVxpa4EhR2+EoiMU=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false}],"splitStatus":0}" received
V	15:07:21.044	[McuMgr] Uploading firmware...

Parents Reply
  • Hi,

    You can refer to the SMP server sample. Note that some of the zephyr documentation does not apply, as the NCS build system will handle image signing etc. automatically for you. This will also build both the application and mcuboot in one go. You need to flash both or the merged hex.

    Then to test DFU update, make sure to rebuild to get a new timestamp so that the app gets a new hash. Then pick the app_update.bin file, which is the signed upgrade image and use that to perform DFU. It should work out of the box.

    Your prj.cof look sensible. Essentialy you neeed most of the config from zephyr\samples\subsys\mgmt\mcumgr\smp_svr\prj.conf and overlay-bt.conf or overlay-bt-tiny.conf.

    Einar

Children
  • nRF Connect, 2021-03-17
    dfu_Nordic_Blinky (DC:CA:E1:CE:C3:8A)
    V	23:10:24.860	Connecting to DC:CA:E1:CE:C3:8A...
    D	23:10:24.860	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	23:10:25.353	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    D	23:10:25.416	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	23:10:25.416	Connected to DC:CA:E1:CE:C3:8A
    V	23:10:25.457	Discovering services...
    D	23:10:25.458	gatt.discoverServices()
    I	23:10:25.598	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D	23:10:25.957	[Callback] Services discovered with status: 0
    I	23:10:25.957	Services discovered
    V	23:10:25.988	Generic Attribute (0x1801)
    - Service Changed [I] (0x2A05)
       Client Characteristic Configuration (0x2902)
    - Client Supported Features [R W] (0x2B29)
    - Database Hash [R] (0x2B2A)
    Generic Access (0x1800)
    - Device Name [R] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    Nordic LED Button Service (00001523-1212-efde-1523-785feabcd123)
    - Button [N R] (00001524-1212-efde-1523-785feabcd123)
       Client Characteristic Configuration (0x2902)
    - LED [W] (00001525-1212-efde-1523-785feabcd123)
    SMP Service (8d53dc1d-1db7-4cd3-868b-8a527460aa84)
    - SMP Characteristic [N WNR] (da2e7828-fbce-4e01-ae9e-261174997c48)
       Client Characteristic Configuration (0x2902)
    D	23:10:25.989	gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    D	23:10:25.992	gatt.setCharacteristicNotification(00001524-1212-efde-1523-785feabcd123, true)
    I	23:10:26.008	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
    I	23:10:30.501	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 420ms)
    V	23:10:41.878	Enabling notifications for 00001524-1212-efde-1523-785feabcd123
    D	23:10:41.878	gatt.setCharacteristicNotification(00001524-1212-efde-1523-785feabcd123, true)
    D	23:10:41.880	gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x0100)
    I	23:10:41.933	Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
    A	23:10:41.933	"Notifications enabled" sent
    V	23:10:41.941	Notifications enabled for 00001524-1212-efde-1523-785feabcd123
    V	23:10:56.213	[McuMgr] Connecting...
    D	23:10:56.313	[McuMgr] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, LE 1M)
    D	23:10:56.379	[McuMgr] [Callback] Connection state changed with status: 0 and new state: 2 (CONNECTED)
    I	23:10:56.400	[McuMgr] Connected to DC:CA:E1:CE:C3:8A
    D	23:10:56.420	[McuMgr] wait(300)
    V	23:10:56.738	[McuMgr] Discovering services...
    D	23:10:56.751	[McuMgr] gatt.discoverServices()
    I	23:10:56.794	[McuMgr] Services discovered
    V	23:10:56.810	[McuMgr] Primary service found
    V	23:10:56.842	[McuMgr] Requesting new MTU...
    D	23:10:56.852	[McuMgr] gatt.requestMtu(515)
    I	23:10:56.920	[McuMgr] MTU changed to: 65
    D	23:10:56.965	[McuMgr] gatt.setCharacteristicNotification(da2e7828-fbce-4e01-ae9e-261174997c48, true)
    V	23:10:56.980	[McuMgr] Enabling notifications for da2e7828-fbce-4e01-ae9e-261174997c48
    D	23:10:57.002	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)
    I	23:10:57.098	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
    I	23:10:57.112	[McuMgr] Notifications enabled
    V	23:10:57.158	[McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND)
    D	23:10:57.174	[McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48)
    I	23:10:57.197	[McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 00-00-00-02-00-01-00-00-BF-FF
    A	23:10:57.231	[McuMgr] "Operation: READ
    Flags: 0
    Length: 2
    Group Id: 1 (IMAGE)
    Sequence Num: 0
    Command Id: 0 (STATE)
    Message: {}" sent
    I	23:10:57.281	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 01-00-00-86-00-01-00-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-30-2E-30-64-68-61-73-68-58-20-33-C2-C9-C3-37-B0-61-B6-B9-8C-EB-A8-5F-B5-A7-A2-D1
    I	23:10:57.310	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 0A-27-0F-A0-A9-BE-54-74-DA-E7-BB-A7-DF-39-22-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E
    I	23:10:57.341	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 74-F4-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF
    A	23:10:57.421	[McuMgr] "{"images":[{"slot":0,"version":"0.0.0","hash":"M8LJwzewYba5jOuoX7WnotEKJw+gqb5UdNrnu6ffOSI=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false}],"splitStatus":0}" received
    V	23:10:57.451	[McuMgr] Uploading firmware...
    V	23:11:13.953	Starting pairing...
    D	23:11:13.953	device.createBond()
    D	23:11:14.046	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11)
    I	23:11:14.295	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D	23:11:14.314	[Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_PIN (0)
    D	23:11:24.662	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDED (12)
    I	23:11:24.663	Device bonded
    I	23:11:24.892	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 420ms)
    V	23:11:33.794	[McuMgr] Connecting...
    D	23:11:33.805	[McuMgr] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, LE 1M)
    D	23:11:33.828	[McuMgr] [Callback] Connection state changed with status: 0 and new state: 2 (CONNECTED)
    I	23:11:33.840	[McuMgr] Connected to DC:CA:E1:CE:C3:8A
    D	23:11:33.849	[McuMgr] wait(1600)
    I	23:11:33.864	[McuMgr] MTU changed to: 65
    V	23:11:35.468	[McuMgr] Discovering services...
    D	23:11:35.484	[McuMgr] gatt.discoverServices()
    I	23:11:35.513	[McuMgr] Services discovered
    V	23:11:35.562	[McuMgr] Primary service found
    I	23:11:35.585	[McuMgr] Service Changed characteristic found on a bonded device
    D	23:11:35.617	[McuMgr] gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    V	23:11:35.638	[McuMgr] Enabling indications for 00002a05-0000-1000-8000-00805f9b34fb
    D	23:11:35.673	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x02-00)
    I	23:11:35.754	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 02-00
    I	23:11:35.768	[McuMgr] Service Changed notifications enabled
    V	23:11:35.799	[McuMgr] Requesting new MTU...
    D	23:11:35.814	[McuMgr] gatt.requestMtu(515)
    I	23:11:35.896	[McuMgr] MTU changed to: 65
    D	23:11:35.907	[McuMgr] gatt.setCharacteristicNotification(da2e7828-fbce-4e01-ae9e-261174997c48, true)
    V	23:11:35.936	[McuMgr] Enabling notifications for da2e7828-fbce-4e01-ae9e-261174997c48
    D	23:11:35.947	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)
    I	23:11:36.024	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
    I	23:11:36.036	[McuMgr] Notifications enabled
    V	23:11:36.054	[McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND)
    D	23:11:36.086	[McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48)
    I	23:11:36.104	[McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 00-00-00-02-00-01-00-00-BF-FF
    A	23:11:36.117	[McuMgr] "Operation: READ
    Flags: 0
    Length: 2
    Group Id: 1 (IMAGE)
    Sequence Num: 0
    Command Id: 0 (STATE)
    Message: {}" sent
    I	23:11:36.167	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 01-00-00-86-00-01-00-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-30-2E-30-64-68-61-73-68-58-20-33-C2-C9-C3-37-B0-61-B6-B9-8C-EB-A8-5F-B5-A7-A2-D1
    I	23:11:36.178	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 0A-27-0F-A0-A9-BE-54-74-DA-E7-BB-A7-DF-39-22-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E
    I	23:11:36.188	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 74-F4-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF
    A	23:11:36.232	[McuMgr] "{"images":[{"slot":0,"version":"0.0.0","hash":"M8LJwzewYba5jOuoX7WnotEKJw+gqb5UdNrnu6ffOSI=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false}],"splitStatus":0}" received
    V	23:11:36.250	[McuMgr] Uploading firmware...
    I	23:12:24.677	Notification received from 00001524-1212-efde-1523-785feabcd123, value: (0x) 01
    A	23:12:24.677	"Button pressed" received
    I	23:12:24.714	Notification received from 00001524-1212-efde-1523-785feabcd123, value: (0x) 00
    A	23:12:24.714	"Button released" received
    I	23:12:27.684	Notification received from 00001524-1212-efde-1523-785feabcd123, value: (0x) 01
    A	23:12:27.684	"Button pressed" received
    I	23:12:28.044	Notification received from 00001524-1212-efde-1523-785feabcd123, value: (0x) 00
    A	23:12:28.044	"Button released" received
    I	23:12:29.845	Notification received from 00001524-1212-efde-1523-785feabcd123, value: (0x) 01
    A	23:12:29.845	"Button pressed" received
    I	23:12:30.473	Notification received from 00001524-1212-efde-1523-785feabcd123, value: (0x) 00
    A	23:12:30.474	"Button released" received
    V	23:12:57.926	[McuMgr] Connecting...
    D	23:12:57.944	[McuMgr] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, LE 1M)
    D	23:12:57.974	[McuMgr] [Callback] Connection state changed with status: 0 and new state: 2 (CONNECTED)
    I	23:12:57.993	[McuMgr] Connected to DC:CA:E1:CE:C3:8A
    D	23:12:58.009	[McuMgr] wait(1600)
    I	23:12:58.029	[McuMgr] MTU changed to: 65
    V	23:12:59.634	[McuMgr] Discovering services...
    D	23:12:59.658	[McuMgr] gatt.discoverServices()
    I	23:12:59.681	[McuMgr] Services discovered
    V	23:12:59.694	[McuMgr] Primary service found
    I	23:12:59.735	[McuMgr] Service Changed characteristic found on a bonded device
    D	23:12:59.746	[McuMgr] gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    V	23:12:59.772	[McuMgr] Enabling indications for 00002a05-0000-1000-8000-00805f9b34fb
    D	23:12:59.782	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x02-00)
    I	23:12:59.859	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 02-00
    I	23:13:00.052	[McuMgr] Service Changed notifications enabled
    V	23:13:00.276	[McuMgr] Requesting new MTU...
    D	23:13:00.508	[McuMgr] gatt.requestMtu(515)
    I	23:13:00.768	[McuMgr] MTU changed to: 65
    D	23:13:00.955	[McuMgr] gatt.setCharacteristicNotification(da2e7828-fbce-4e01-ae9e-261174997c48, true)
    V	23:13:01.173	[McuMgr] Enabling notifications for da2e7828-fbce-4e01-ae9e-261174997c48
    D	23:13:01.362	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)
    I	23:13:01.640	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
    I	23:13:01.845	[McuMgr] Notifications enabled
    V	23:13:02.070	[McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND)
    D	23:13:02.291	[McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48)
    I	23:13:02.423	[McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 00-00-00-02-00-01-00-00-BF-FF
    A	23:13:02.441	[McuMgr] "Operation: READ
    Flags: 0
    Length: 2
    Group Id: 1 (IMAGE)
    Sequence Num: 0
    Command Id: 0 (STATE)
    Message: {}" sent
    I	23:13:02.520	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 01-00-00-86-00-01-00-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-30-2E-30-64-68-61-73-68-58-20-33-C2-C9-C3-37-B0-61-B6-B9-8C-EB-A8-5F-B5-A7-A2-D1
    I	23:13:02.531	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 0A-27-0F-A0-A9-BE-54-74-DA-E7-BB-A7-DF-39-22-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E
    I	23:13:02.539	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 74-F4-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF
    A	23:13:02.584	[McuMgr] "{"images":[{"slot":0,"version":"0.0.0","hash":"M8LJwzewYba5jOuoX7WnotEKJw+gqb5UdNrnu6ffOSI=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false}],"splitStatus":0}" received
    V	23:13:02.598	[McuMgr] Uploading firmware...
    

    from android nrf connect

    last line show uploading firmware but no movement 

  • I got this kind of message in debug mode

    [00:00:00.536,285] [0m<inf> mcuboot: Starting bootloader[0m
    [00:00:00.542,572] [0m<inf> mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3[0m
    [00:00:00.552,917] [0m<inf> mcuboot: Boot source: none[0m
    [00:00:00.558,624] [0m<inf> mcuboot: Swap type: none[0m
    [00:00:00.876,342] [0m<inf> mcuboot: Bootloader chainload address offset: 0xc000[0m
    [00:00:00.271,789] [0m<inf> mcuboot: Starting bootloader[0m
    [00:00:00.278,015] [0m<inf> mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3[0m
    [00:00:00.288,391] [0m<inf> mcuboot: Boot source: none[0m
    [00:00:00.294,067] [0m<inf> mcuboot: Swap type: perm[0m
    [00:00:00.611,724] [1;33m<wrn> mcuboot: Not enough free space to run swap upgrade[0m
    [00:00:00.932,159] [0m<inf> mcuboot: Bootloader chainload address offset: 0xc000[0m

  • On adding these line in prj.conf

    CONFIG_BT_L2CAP_TX_MTU=252
    CONFIG_BT_L2CAP_RX_MTU=252
    CONFIG_BT_RX_BUF_LEN=260
    CONFIG_BT_CTLR_TX_BUFFER_SIZE=251
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251

    Able to upload the firmware

    final prj.conf file is

    CONFIG_NCS_SAMPLES_DEFAULTS=y
    
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="Nordic_Blinky"
    
    # Enable the LBS service
    CONFIG_BT_LBS=y
    CONFIG_BT_LBS_POLL_BUTTON=y
    CONFIG_DK_LIBRARY=y
    
    # Added for FOTA
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_MCUMGR=y
    CONFIG_MCUMGR_CMD_OS_MGMT=y
    CONFIG_MCUMGR_CMD_IMG_MGMT=y
    CONFIG_MCUMGR_SMP_BT=y
    CONFIG_IMG_ERASE_PROGRESSIVELY=y
    
    CONFIG_DEBUG_OPTIMIZATIONS=y
    CONFIG_MCUMGR_SMP_BT_AUTHEN=n
    CONFIG_LOG=y
    
    CONFIG_BT_L2CAP_TX_MTU=252
    CONFIG_BT_L2CAP_RX_MTU=252
    CONFIG_BT_RX_BUF_LEN=260
    CONFIG_BT_CTLR_TX_BUFFER_SIZE=251
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    

    what is the use of these above lines

    1. Is the prj.conf perfect?

    and Now the problem is " not enough free space to run swap "

    log from the terminal

    [00:00:00.509,552] [0m<inf> mcuboot: Starting bootloader[0m
    [00:00:00.515,838] [0m<inf> mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3[0m
    [00:00:00.526,275] [0m<inf> mcuboot: Boot source: none[0m
    [00:00:00.531,982] [0m<inf> mcuboot: Swap type: none[0m
    [00:00:00.851,165] [0m<inf> mcuboot: Bootloader chainload address offset: 0xc000[0m
    [00:00:00.859,161] [0m<inf> mcuboot: Jumping to the first image slot[0m
    *** Booting Zephyr OS build v2.4.0-ncs2  ***
    Starting Bluetooth Peripheral LBS example
    Application build time: Mar 18 2021 00:56:27 
    I: 2 Sectors of 4096 bytes
    I: alloc wra: 0, ff0
    I: data wra: 0, 0
    I: SoftDevice Controller build revision: 
    I: cf 5c 0f 11 88 9c d7 02 |.\......
    I: 15 27 c7 c3 ca 60 19 85 |.'...`..
    I: b7 c4 50 e3             |..P.    
    I: No ID address. App must call settings_load()
    Bluetooth initialized
    Advertising successfully started
    Connected
    I: Erasing page at offset 0x00045000
    I: Erasing page at offset 0x00046000
    I: Erasing page at offset 0x00047000
    I: Erasing page at offset 0x00048000
    I: Erasing page at offset 0x00049000
    I: Erasing page at offset 0x0004a000
    I: Erasing page at offset 0x0004b000
    I: Erasing page at offset 0x0004c000
    I: Erasing page at offset 0x0004d000
    I: Erasing page at offset 0x0004e000
    I: Erasing page at offset 0x0004f000
    I: Erasing page at offset 0x00050000
    I: Erasing page at offset 0x00051000
    I: Erasing page at offset 0x00052000
    I: Erasing page at offset 0x00053000
    I: Erasing page at offset 0x00054000
    I: Erasing page at offset 0x00055000
    I: Erasing page at offset 0x00056000
    I: Erasing page at offset 0x00057000
    I: Erasing page at offset 0x00058000
    I: Erasing page at offset 0x00059000
    I: Erasing page at offset 0x0005a000
    I: Erasing page at offset 0x0005b000
    I: Erasing page at offset 0x0005c000
    I: Erasing page at offset 0x0005d000
    I: Erasing page at offset 0x0005e000
    I: Erasing page at offset 0x0005f000
    I: Erasing page at offset 0x00060000
    I: Erasing page at offset 0x00061000
    I: Erasing page at offset 0x00062000
    I: Erasing page at offset 0x00063000
    I: Erasing page at offset 0x00064000
    I: Erasing page at offset 0x00065000
    I: Erasing page at offset 0x00066000
    I: Erasing page at offset 0x00067000
    I: Erasing page at offset 0x00068000
    I: Erasing page at offset 0x00069000
    I: Erasing page at offset 0x0006a000
    I: Erasing page at offset 0x0006b000
    I: Erasing page at offset 0x0006c000
    I: Erasing page at offset 0x0006d000
    I: Erasing page at offset 0x0006e000
    I: Erasing page at offset 0x0006f000
    I: Erasing page at offset 0x00070000
    I: Erasing page at offset 0x00071000
    I: Erasing page at offset 0x00072000
    I: Erasing page at offset 0x00073000
    I: Erasing page at offset 0x00074000
    I: Erasing page at offset 0x00075000
    I: Erasing page at offset 0x00076000
    I: Erasing page at offset 0x00077000
    I: Erasing page at offset 0x00078000
    I: Erasing page at offset 0x00079000
    I: Erasing page at offset 0x0007a000
    I: Erasing page at offset 0x0007b000
    I: Erasing page at offset 0x0007c000
    I: Erasing page at offset 0x0007d000
    *** Booting Zephyr OS build v2.4.0-ncs2  ***
    [00:00:00.271,850] [0m<inf> mcuboot: Starting bootloader[0m
    [00:00:00.278,106] [0m<inf> mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3[0m
    [00:00:00.288,543] [0m<inf> mcuboot: Boot source: none[0m
    [00:00:00.294,281] [0m<inf> mcuboot: Swap type: perm[0m
    [00:00:00.613,647] [1;33m<wrn> mcuboot: Not enough free space to run swap upgrade[0m
    [00:00:00.935,852] [0m<inf> mcuboot: Bootloader chainload address offset: 0xc000[0m
    [00:00:00.943,817] [0m<inf> mcuboot: Jumping to the first image slot[0m
    *** Booting Zephyr OS build v2.4.0-ncs2  ***
    Starting Bluetooth Peripheral LBS example
    Application build time: Mar 18 2021 00:56:27 
    I: 2 Sectors of 4096 bytes
    I: alloc wra: 0, fd0
    I: data wra: 0, 29
    I: SoftDevice Controller build revision: 
    I: cf 5c 0f 11 88 9c d7 02 |.\......
    I: 15 27 c7 c3 ca 60 19 85 |.'...`..
    I: b7 c4 50 e3             |..P.    
    I: No ID address. App must call settings_load()
    Bluetooth initialized
    Advertising successfully started
    Connected
    Disconnected (reason 19)
    

    Android log file

    nRF Connect, 2021-03-18
    Nordic_Blinky (DC:CA:E1:CE:C3:8A)
    V	01:01:03.532	Connecting to DC:CA:E1:CE:C3:8A...
    D	01:01:03.532	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	01:01:03.830	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    D	01:01:03.863	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	01:01:03.863	Connected to DC:CA:E1:CE:C3:8A
    V	01:01:03.924	Discovering services...
    D	01:01:03.924	gatt.discoverServices()
    I	01:01:04.091	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D	01:01:04.455	[Callback] Services discovered with status: 0
    I	01:01:04.455	Services discovered
    V	01:01:04.490	Generic Attribute (0x1801)
    - Service Changed [I] (0x2A05)
       Client Characteristic Configuration (0x2902)
    - Client Supported Features [R W] (0x2B29)
    - Database Hash [R] (0x2B2A)
    Generic Access (0x1800)
    - Device Name [R] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    Nordic LED Button Service (00001523-1212-efde-1523-785feabcd123)
    - Button [N R] (00001524-1212-efde-1523-785feabcd123)
       Client Characteristic Configuration (0x2902)
    - LED [W] (00001525-1212-efde-1523-785feabcd123)
    SMP Service (8d53dc1d-1db7-4cd3-868b-8a527460aa84)
    - SMP Characteristic [N WNR] (da2e7828-fbce-4e01-ae9e-261174997c48)
       Client Characteristic Configuration (0x2902)
    D	01:01:04.491	gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    D	01:01:04.496	gatt.setCharacteristicNotification(00001524-1212-efde-1523-785feabcd123, true)
    I	01:01:04.516	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
    I	01:01:09.805	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 420ms)
    V	01:01:10.411	Enabling notifications for 00001524-1212-efde-1523-785feabcd123
    D	01:01:10.411	gatt.setCharacteristicNotification(00001524-1212-efde-1523-785feabcd123, true)
    D	01:01:10.414	gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x0100)
    I	01:01:10.479	Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
    A	01:01:10.480	"Notifications enabled" sent
    V	01:01:10.492	Notifications enabled for 00001524-1212-efde-1523-785feabcd123
    I	01:01:12.868	Notification received from 00001524-1212-efde-1523-785feabcd123, value: (0x) 01
    A	01:01:12.868	"Button pressed" received
    I	01:01:13.135	Notification received from 00001524-1212-efde-1523-785feabcd123, value: (0x) 00
    A	01:01:13.135	"Button released" received
    V	01:01:34.161	[McuMgr] Connecting...
    D	01:01:34.176	[McuMgr] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, LE 1M)
    D	01:01:34.203	[McuMgr] [Callback] Connection state changed with status: 0 and new state: 2 (CONNECTED)
    I	01:01:34.215	[McuMgr] Connected to DC:CA:E1:CE:C3:8A
    D	01:01:34.237	[McuMgr] wait(300)
    V	01:01:34.549	[McuMgr] Discovering services...
    D	01:01:34.557	[McuMgr] gatt.discoverServices()
    I	01:01:34.579	[McuMgr] Services discovered
    V	01:01:34.628	[McuMgr] Primary service found
    V	01:01:34.666	[McuMgr] Requesting new MTU...
    D	01:01:34.678	[McuMgr] gatt.requestMtu(515)
    I	01:01:34.783	[McuMgr] MTU changed to: 252
    D	01:01:34.795	[McuMgr] gatt.setCharacteristicNotification(da2e7828-fbce-4e01-ae9e-261174997c48, true)
    V	01:01:34.824	[McuMgr] Enabling notifications for da2e7828-fbce-4e01-ae9e-261174997c48
    D	01:01:34.836	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)
    I	01:01:34.961	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
    I	01:01:34.972	[McuMgr] Notifications enabled
    V	01:01:34.997	[McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND)
    D	01:01:35.008	[McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48)
    I	01:01:35.019	[McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 00-00-00-02-00-01-00-00-BF-FF
    A	01:01:35.052	[McuMgr] "Operation: READ
    Flags: 0
    Length: 2
    Group Id: 1 (IMAGE)
    Sequence Num: 0
    Command Id: 0 (STATE)
    Message: {}" sent
    I	01:01:35.098	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 01-00-00-86-00-01-00-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-30-2E-30-64-68-61-73-68-58-20-F2-75-94-40-26-A9-39-B9-8C-02-94-0E-BE-E2-AB-2F-34-C4-ED-40-52-AC-73-BE-84-A3-B8-76-6E-E4-8C-85-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF
    A	01:01:35.167	[McuMgr] "{"images":[{"slot":0,"version":"0.0.0","hash":"8nWUQCapObmMApQOvuKrLzTE7UBSrHO+hKO4dm7kjIU=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false}],"splitStatus":0}" received
    V	01:01:35.189	[McuMgr] Uploading firmware...
    V	01:04:24.482	[McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND)
    D	01:04:24.491	[McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48)
    I	01:04:24.501	[McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 02-00-00-32-00-01-00-00-BF-67-63-6F-6E-66-69-72-6D-F5-64-68-61-73-68-58-20-C1-34-8B-75-1C-B2-6F-47-01-31-84-04-CF-4F-BE-C2-19-1E-37-0B-45-29-B0-84-1B-3F-2F-A3-70-34-F6-9A-FF
    A	01:04:24.512	[McuMgr] "Operation: WRITE
    Flags: 0
    Length: 50
    Group Id: 1 (IMAGE)
    Sequence Num: 0
    Command Id: 0 (STATE)
    Message: {"confirm":true,"hash":"wTSLdRyyb0cBMYQEz0++whkeNwtFKbCEGz8vo3A09po="}" sent
    I	01:04:24.570	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 03-00-00-F4-00-01-00-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-30-2E-30-64-68-61-73-68-58-20-F2-75-94-40-26-A9-39-B9-8C-02-94-0E-BE-E2-AB-2F-34-C4-ED-40-52-AC-73-BE-84-A3-B8-76-6E-E4-8C-85-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-BF-64-73-6C-6F-74-01-67-76-65-72-73-69-6F-6E-65-30-2E-30-2E-30-64-68-61-73-68-58-20-C1-34-8B-75-1C-B2-6F-47-01-31-84-04-CF-4F-BE-C2-19-1E-37-0B-45-29-B0-84-1B-3F-2F-A3-70-34-F6-9A-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F5-69-63-6F-6E-66-69-72-6D-65-64-F4-66-61-63-74-69-76-65-F4-69-70-65-72-6D-61-6E-65-6E-74-F5-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75
    I	01:04:24.579	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 73-00-FF
    A	01:04:24.612	[McuMgr] "{"images":[{"slot":0,"version":"0.0.0","hash":"8nWUQCapObmMApQOvuKrLzTE7UBSrHO+hKO4dm7kjIU=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false},{"slot":1,"version":"0.0.0","hash":"wTSLdRyyb0cBMYQEz0++whkeNwtFKbCEGz8vo3A09po=","bootable":true,"pending":true,"confirmed":false,"active":false,"permanent":true}],"splitStatus":0}" received
    V	01:04:24.632	[McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND)
    D	01:04:24.641	[McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48)
    I	01:04:24.656	[McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 02-00-00-02-00-00-00-05-BF-FF
    A	01:04:24.670	[McuMgr] "Operation: WRITE
    Flags: 0
    Length: 2
    Group Id: 0 (OS)
    Sequence Num: 0
    Command Id: 5 (RESET)
    Message: {}" sent
    I	01:04:24.702	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 03-00-00-02-00-00-00-05-BF-FF
    A	01:04:24.736	[McuMgr] "{}" received
    D	01:04:25.320	[Callback] Connection state changed with status: 8 and new state: DISCONNECTED (0)
    E	01:04:25.321	Error 8 (0x8): GATT CONN TIMEOUT
    I	01:04:25.321	Disconnected
    D	01:04:25.326	[McuMgr] [Callback] Connection state changed with status: 8 and new state: 0 (DISCONNECTED)
    W	01:04:25.425	[McuMgr] Error: (0x8): GATT CONN TIMEOUT
    D	01:04:25.426	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    I	01:04:25.449	[McuMgr] Disconnected
    D	01:04:25.500	[McuMgr] gatt.close()
    V	01:04:25.536	[McuMgr] Connecting...
    D	01:04:25.547	[McuMgr] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, LE 1M)
    D	01:04:26.289	[McuMgr] [Callback] Connection state changed with status: 0 and new state: 2 (CONNECTED)
    D	01:04:26.289	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    I	01:04:26.315	[McuMgr] Connected to DC:CA:E1:CE:C3:8A
    D	01:04:26.327	[McuMgr] wait(300)
    I	01:04:26.547	[McuMgr] Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    V	01:04:26.645	[McuMgr] Discovering services...
    D	01:04:26.660	[McuMgr] gatt.discoverServices()
    I	01:04:26.915	[McuMgr] Services discovered
    V	01:04:26.935	[McuMgr] Primary service found
    V	01:04:26.988	[McuMgr] Requesting new MTU...
    D	01:04:27.001	[McuMgr] gatt.requestMtu(515)
    I	01:04:27.037	[McuMgr] Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
    I	01:04:27.180	[McuMgr] MTU changed to: 252
    D	01:04:27.204	[McuMgr] gatt.setCharacteristicNotification(da2e7828-fbce-4e01-ae9e-261174997c48, true)
    V	01:04:27.259	[McuMgr] Enabling notifications for da2e7828-fbce-4e01-ae9e-261174997c48
    D	01:04:27.275	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)
    I	01:04:27.357	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
    I	01:04:27.368	[McuMgr] Notifications enabled
    V	01:04:27.382	[McuMgr] Disconnecting...
    D	01:04:27.391	[McuMgr] gatt.disconnect()
    D	01:04:27.411	[McuMgr] [Callback] Connection state changed with status: 0 and new state: 0 (DISCONNECTED)
    I	01:04:27.420	[McuMgr] Disconnected
    D	01:04:27.448	[McuMgr] gatt.close()
    D	01:04:27.461	gatt.close()
    D	01:04:27.464	wait(200)
    V	01:04:27.668	Connecting to DC:CA:E1:CE:C3:8A...
    D	01:04:27.668	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	01:04:27.707	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	01:04:27.707	Connected to DC:CA:E1:CE:C3:8A
    V	01:04:27.780	Discovering services...
    D	01:04:27.780	gatt.discoverServices()
    I	01:04:27.941	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D	01:04:28.251	[Callback] Services discovered with status: 0
    I	01:04:28.251	Services discovered
    V	01:04:28.279	Generic Attribute (0x1801)
    - Service Changed [I] (0x2A05)
       Client Characteristic Configuration (0x2902)
    - Client Supported Features [R W] (0x2B29)
    - Database Hash [R] (0x2B2A)
    Generic Access (0x1800)
    - Device Name [R] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    Nordic LED Button Service (00001523-1212-efde-1523-785feabcd123)
    - Button [N R] (00001524-1212-efde-1523-785feabcd123)
       Client Characteristic Configuration (0x2902)
    - LED [W] (00001525-1212-efde-1523-785feabcd123)
    SMP Service (8d53dc1d-1db7-4cd3-868b-8a527460aa84)
    - SMP Characteristic [N WNR] (da2e7828-fbce-4e01-ae9e-261174997c48)
       Client Characteristic Configuration (0x2902)
    D	01:04:28.280	gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    D	01:04:28.283	gatt.setCharacteristicNotification(00001524-1212-efde-1523-785feabcd123, true)
    I	01:04:28.304	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
    D	01:04:29.267	[Callback] Connection state changed with status: 22 and new state: DISCONNECTED (0)
    E	01:04:29.267	Error 22 (0x16): GATT CONN TERMINATE LOCAL HOST
    I	01:04:29.267	Disconnected
    D	01:04:29.398	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    D	01:05:21.695	gatt.close()
    D	01:05:21.702	wait(200)
    V	01:05:21.906	Connecting to DC:CA:E1:CE:C3:8A...
    D	01:05:21.906	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	01:05:22.236	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    D	01:05:22.317	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	01:05:22.317	Connected to DC:CA:E1:CE:C3:8A
    V	01:05:22.423	Discovering services...
    D	01:05:22.423	gatt.discoverServices()
    I	01:05:22.482	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D	01:05:22.838	[Callback] Services discovered with status: 0
    I	01:05:22.838	Services discovered
    V	01:05:22.888	Generic Attribute (0x1801)
    - Service Changed [I] (0x2A05)
       Client Characteristic Configuration (0x2902)
    - Client Supported Features [R W] (0x2B29)
    - Database Hash [R] (0x2B2A)
    Generic Access (0x1800)
    - Device Name [R] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    Nordic LED Button Service (00001523-1212-efde-1523-785feabcd123)
    - Button [N R] (00001524-1212-efde-1523-785feabcd123)
       Client Characteristic Configuration (0x2902)
    - LED [W] (00001525-1212-efde-1523-785feabcd123)
    SMP Service (8d53dc1d-1db7-4cd3-868b-8a527460aa84)
    - SMP Characteristic [N WNR] (da2e7828-fbce-4e01-ae9e-261174997c48)
       Client Characteristic Configuration (0x2902)
    D	01:05:22.888	gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    D	01:05:22.892	gatt.setCharacteristicNotification(00001524-1212-efde-1523-785feabcd123, true)
    I	01:05:22.898	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
    I	01:05:27.838	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 420ms)
    

    Android debug file

    nRF Connect, 2021-03-18
    Nordic_Blinky (DC:CA:E1:CE:C3:8A)
    V	01:01:03.532	Connecting to DC:CA:E1:CE:C3:8A...
    D	01:01:03.532	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	01:01:03.830	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    D	01:01:03.863	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	01:01:03.863	Connected to DC:CA:E1:CE:C3:8A
    V	01:01:03.924	Discovering services...
    D	01:01:03.924	gatt.discoverServices()
    I	01:01:04.091	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D	01:01:04.455	[Callback] Services discovered with status: 0
    I	01:01:04.455	Services discovered
    V	01:01:04.490	Generic Attribute (0x1801)
    - Service Changed [I] (0x2A05)
       Client Characteristic Configuration (0x2902)
    - Client Supported Features [R W] (0x2B29)
    - Database Hash [R] (0x2B2A)
    Generic Access (0x1800)
    - Device Name [R] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    Nordic LED Button Service (00001523-1212-efde-1523-785feabcd123)
    - Button [N R] (00001524-1212-efde-1523-785feabcd123)
       Client Characteristic Configuration (0x2902)
    - LED [W] (00001525-1212-efde-1523-785feabcd123)
    SMP Service (8d53dc1d-1db7-4cd3-868b-8a527460aa84)
    - SMP Characteristic [N WNR] (da2e7828-fbce-4e01-ae9e-261174997c48)
       Client Characteristic Configuration (0x2902)
    D	01:01:04.491	gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    D	01:01:04.496	gatt.setCharacteristicNotification(00001524-1212-efde-1523-785feabcd123, true)
    I	01:01:04.516	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
    I	01:01:09.805	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 420ms)
    V	01:01:10.411	Enabling notifications for 00001524-1212-efde-1523-785feabcd123
    D	01:01:10.411	gatt.setCharacteristicNotification(00001524-1212-efde-1523-785feabcd123, true)
    D	01:01:10.414	gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x0100)
    I	01:01:10.479	Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
    A	01:01:10.480	"Notifications enabled" sent
    V	01:01:10.492	Notifications enabled for 00001524-1212-efde-1523-785feabcd123
    I	01:01:12.868	Notification received from 00001524-1212-efde-1523-785feabcd123, value: (0x) 01
    A	01:01:12.868	"Button pressed" received
    I	01:01:13.135	Notification received from 00001524-1212-efde-1523-785feabcd123, value: (0x) 00
    A	01:01:13.135	"Button released" received
    V	01:01:34.161	[McuMgr] Connecting...
    D	01:01:34.176	[McuMgr] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, LE 1M)
    D	01:01:34.203	[McuMgr] [Callback] Connection state changed with status: 0 and new state: 2 (CONNECTED)
    I	01:01:34.215	[McuMgr] Connected to DC:CA:E1:CE:C3:8A
    D	01:01:34.237	[McuMgr] wait(300)
    V	01:01:34.549	[McuMgr] Discovering services...
    D	01:01:34.557	[McuMgr] gatt.discoverServices()
    I	01:01:34.579	[McuMgr] Services discovered
    V	01:01:34.628	[McuMgr] Primary service found
    V	01:01:34.666	[McuMgr] Requesting new MTU...
    D	01:01:34.678	[McuMgr] gatt.requestMtu(515)
    I	01:01:34.783	[McuMgr] MTU changed to: 252
    D	01:01:34.795	[McuMgr] gatt.setCharacteristicNotification(da2e7828-fbce-4e01-ae9e-261174997c48, true)
    V	01:01:34.824	[McuMgr] Enabling notifications for da2e7828-fbce-4e01-ae9e-261174997c48
    D	01:01:34.836	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)
    I	01:01:34.961	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
    I	01:01:34.972	[McuMgr] Notifications enabled
    V	01:01:34.997	[McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND)
    D	01:01:35.008	[McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48)
    I	01:01:35.019	[McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 00-00-00-02-00-01-00-00-BF-FF
    A	01:01:35.052	[McuMgr] "Operation: READ
    Flags: 0
    Length: 2
    Group Id: 1 (IMAGE)
    Sequence Num: 0
    Command Id: 0 (STATE)
    Message: {}" sent
    I	01:01:35.098	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 01-00-00-86-00-01-00-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-30-2E-30-64-68-61-73-68-58-20-F2-75-94-40-26-A9-39-B9-8C-02-94-0E-BE-E2-AB-2F-34-C4-ED-40-52-AC-73-BE-84-A3-B8-76-6E-E4-8C-85-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF
    A	01:01:35.167	[McuMgr] "{"images":[{"slot":0,"version":"0.0.0","hash":"8nWUQCapObmMApQOvuKrLzTE7UBSrHO+hKO4dm7kjIU=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false}],"splitStatus":0}" received
    V	01:01:35.189	[McuMgr] Uploading firmware...
    V	01:04:24.482	[McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND)
    D	01:04:24.491	[McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48)
    I	01:04:24.501	[McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 02-00-00-32-00-01-00-00-BF-67-63-6F-6E-66-69-72-6D-F5-64-68-61-73-68-58-20-C1-34-8B-75-1C-B2-6F-47-01-31-84-04-CF-4F-BE-C2-19-1E-37-0B-45-29-B0-84-1B-3F-2F-A3-70-34-F6-9A-FF
    A	01:04:24.512	[McuMgr] "Operation: WRITE
    Flags: 0
    Length: 50
    Group Id: 1 (IMAGE)
    Sequence Num: 0
    Command Id: 0 (STATE)
    Message: {"confirm":true,"hash":"wTSLdRyyb0cBMYQEz0++whkeNwtFKbCEGz8vo3A09po="}" sent
    I	01:04:24.570	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 03-00-00-F4-00-01-00-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-30-2E-30-64-68-61-73-68-58-20-F2-75-94-40-26-A9-39-B9-8C-02-94-0E-BE-E2-AB-2F-34-C4-ED-40-52-AC-73-BE-84-A3-B8-76-6E-E4-8C-85-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-BF-64-73-6C-6F-74-01-67-76-65-72-73-69-6F-6E-65-30-2E-30-2E-30-64-68-61-73-68-58-20-C1-34-8B-75-1C-B2-6F-47-01-31-84-04-CF-4F-BE-C2-19-1E-37-0B-45-29-B0-84-1B-3F-2F-A3-70-34-F6-9A-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F5-69-63-6F-6E-66-69-72-6D-65-64-F4-66-61-63-74-69-76-65-F4-69-70-65-72-6D-61-6E-65-6E-74-F5-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75
    I	01:04:24.579	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 73-00-FF
    A	01:04:24.612	[McuMgr] "{"images":[{"slot":0,"version":"0.0.0","hash":"8nWUQCapObmMApQOvuKrLzTE7UBSrHO+hKO4dm7kjIU=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false},{"slot":1,"version":"0.0.0","hash":"wTSLdRyyb0cBMYQEz0++whkeNwtFKbCEGz8vo3A09po=","bootable":true,"pending":true,"confirmed":false,"active":false,"permanent":true}],"splitStatus":0}" received
    V	01:04:24.632	[McuMgr] Writing characteristic da2e7828-fbce-4e01-ae9e-261174997c48 (WRITE COMMAND)
    D	01:04:24.641	[McuMgr] gatt.writeCharacteristic(da2e7828-fbce-4e01-ae9e-261174997c48)
    I	01:04:24.656	[McuMgr] Data written to da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 02-00-00-02-00-00-00-05-BF-FF
    A	01:04:24.670	[McuMgr] "Operation: WRITE
    Flags: 0
    Length: 2
    Group Id: 0 (OS)
    Sequence Num: 0
    Command Id: 5 (RESET)
    Message: {}" sent
    I	01:04:24.702	[McuMgr] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 03-00-00-02-00-00-00-05-BF-FF
    A	01:04:24.736	[McuMgr] "{}" received
    D	01:04:25.320	[Callback] Connection state changed with status: 8 and new state: DISCONNECTED (0)
    E	01:04:25.321	Error 8 (0x8): GATT CONN TIMEOUT
    I	01:04:25.321	Disconnected
    D	01:04:25.326	[McuMgr] [Callback] Connection state changed with status: 8 and new state: 0 (DISCONNECTED)
    W	01:04:25.425	[McuMgr] Error: (0x8): GATT CONN TIMEOUT
    D	01:04:25.426	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    I	01:04:25.449	[McuMgr] Disconnected
    D	01:04:25.500	[McuMgr] gatt.close()
    V	01:04:25.536	[McuMgr] Connecting...
    D	01:04:25.547	[McuMgr] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, LE 1M)
    D	01:04:26.289	[McuMgr] [Callback] Connection state changed with status: 0 and new state: 2 (CONNECTED)
    D	01:04:26.289	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    I	01:04:26.315	[McuMgr] Connected to DC:CA:E1:CE:C3:8A
    D	01:04:26.327	[McuMgr] wait(300)
    I	01:04:26.547	[McuMgr] Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    V	01:04:26.645	[McuMgr] Discovering services...
    D	01:04:26.660	[McuMgr] gatt.discoverServices()
    I	01:04:26.915	[McuMgr] Services discovered
    V	01:04:26.935	[McuMgr] Primary service found
    V	01:04:26.988	[McuMgr] Requesting new MTU...
    D	01:04:27.001	[McuMgr] gatt.requestMtu(515)
    I	01:04:27.037	[McuMgr] Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
    I	01:04:27.180	[McuMgr] MTU changed to: 252
    D	01:04:27.204	[McuMgr] gatt.setCharacteristicNotification(da2e7828-fbce-4e01-ae9e-261174997c48, true)
    V	01:04:27.259	[McuMgr] Enabling notifications for da2e7828-fbce-4e01-ae9e-261174997c48
    D	01:04:27.275	[McuMgr] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)
    I	01:04:27.357	[McuMgr] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
    I	01:04:27.368	[McuMgr] Notifications enabled
    V	01:04:27.382	[McuMgr] Disconnecting...
    D	01:04:27.391	[McuMgr] gatt.disconnect()
    D	01:04:27.411	[McuMgr] [Callback] Connection state changed with status: 0 and new state: 0 (DISCONNECTED)
    I	01:04:27.420	[McuMgr] Disconnected
    D	01:04:27.448	[McuMgr] gatt.close()
    D	01:04:27.461	gatt.close()
    D	01:04:27.464	wait(200)
    V	01:04:27.668	Connecting to DC:CA:E1:CE:C3:8A...
    D	01:04:27.668	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	01:04:27.707	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	01:04:27.707	Connected to DC:CA:E1:CE:C3:8A
    V	01:04:27.780	Discovering services...
    D	01:04:27.780	gatt.discoverServices()
    I	01:04:27.941	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D	01:04:28.251	[Callback] Services discovered with status: 0
    I	01:04:28.251	Services discovered
    V	01:04:28.279	Generic Attribute (0x1801)
    - Service Changed [I] (0x2A05)
       Client Characteristic Configuration (0x2902)
    - Client Supported Features [R W] (0x2B29)
    - Database Hash [R] (0x2B2A)
    Generic Access (0x1800)
    - Device Name [R] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    Nordic LED Button Service (00001523-1212-efde-1523-785feabcd123)
    - Button [N R] (00001524-1212-efde-1523-785feabcd123)
       Client Characteristic Configuration (0x2902)
    - LED [W] (00001525-1212-efde-1523-785feabcd123)
    SMP Service (8d53dc1d-1db7-4cd3-868b-8a527460aa84)
    - SMP Characteristic [N WNR] (da2e7828-fbce-4e01-ae9e-261174997c48)
       Client Characteristic Configuration (0x2902)
    D	01:04:28.280	gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    D	01:04:28.283	gatt.setCharacteristicNotification(00001524-1212-efde-1523-785feabcd123, true)
    I	01:04:28.304	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
    D	01:04:29.267	[Callback] Connection state changed with status: 22 and new state: DISCONNECTED (0)
    E	01:04:29.267	Error 22 (0x16): GATT CONN TERMINATE LOCAL HOST
    I	01:04:29.267	Disconnected
    D	01:04:29.398	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    D	01:05:21.695	gatt.close()
    D	01:05:21.702	wait(200)
    V	01:05:21.906	Connecting to DC:CA:E1:CE:C3:8A...
    D	01:05:21.906	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	01:05:22.236	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    D	01:05:22.317	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	01:05:22.317	Connected to DC:CA:E1:CE:C3:8A
    V	01:05:22.423	Discovering services...
    D	01:05:22.423	gatt.discoverServices()
    I	01:05:22.482	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D	01:05:22.838	[Callback] Services discovered with status: 0
    I	01:05:22.838	Services discovered
    V	01:05:22.888	Generic Attribute (0x1801)
    - Service Changed [I] (0x2A05)
       Client Characteristic Configuration (0x2902)
    - Client Supported Features [R W] (0x2B29)
    - Database Hash [R] (0x2B2A)
    Generic Access (0x1800)
    - Device Name [R] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    Nordic LED Button Service (00001523-1212-efde-1523-785feabcd123)
    - Button [N R] (00001524-1212-efde-1523-785feabcd123)
       Client Characteristic Configuration (0x2902)
    - LED [W] (00001525-1212-efde-1523-785feabcd123)
    SMP Service (8d53dc1d-1db7-4cd3-868b-8a527460aa84)
    - SMP Characteristic [N WNR] (da2e7828-fbce-4e01-ae9e-261174997c48)
       Client Characteristic Configuration (0x2902)
    D	01:05:22.888	gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    D	01:05:22.892	gatt.setCharacteristicNotification(00001524-1212-efde-1523-785feabcd123, true)
    I	01:05:22.898	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
    I	01:05:27.838	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 420ms)
    

    nrf52dk_nrf52832.dts

    changed

    slot0_partition: partition@c000 {
                label = "image-0";
                reg = <0x0000C000 0x34000>;
            };
            slot1_partition: partition@3e000 {
                label = "image-1";
                reg = <0x0003E000 0x34000>;
            };

    /*
     * Copyright (c) 2017 Shawn Nock <[email protected]>
     * Copyright (c) 2017 Linaro Limited
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    
    /dts-v1/;
    #include <nordic/nrf52832_qfaa.dtsi>
    
    / {
    	model = "Nordic nRF52 DK NRF52832";
    	compatible = "nordic,nrf52-dk-nrf52832";
    
    	chosen {
    		zephyr,console = &uart0;
    		zephyr,shell-uart = &uart0;
    		zephyr,uart-mcumgr = &uart0;
    		zephyr,bt-mon-uart = &uart0;
    		zephyr,bt-c2h-uart = &uart0;
    		zephyr,sram = &sram0;
    		zephyr,flash = &flash0;
    		zephyr,code-partition = &slot0_partition;
    	};
    
    	leds {
    		compatible = "gpio-leds";
    		led0: led_0 {
    			gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
    			label = "Green LED 0";
    		};
    		led1: led_1 {
    			gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
    			label = "Green LED 1";
    		};
    		led2: led_2 {
    			gpios = <&gpio0 19 GPIO_ACTIVE_LOW>;
    			label = "Green LED 2";
    		};
    		led3: led_3 {
    			gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
    			label = "Green LED 3";
    		};
    	};
    
    	pwmleds {
    		compatible = "pwm-leds";
    		pwm_led0: pwm_led_0 {
    			pwms = <&pwm0 17>;
    		};
    	};
    
    	buttons {
    		compatible = "gpio-keys";
    		button0: button_0 {
    			gpios = <&gpio0 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
    			label = "Push button switch 0";
    		};
    		button1: button_1 {
    			gpios = <&gpio0 14 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
    			label = "Push button switch 1";
    		};
    		button2: button_2 {
    			gpios = <&gpio0 15 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
    			label = "Push button switch 2";
    		};
    		button3: button_3 {
    			gpios = <&gpio0 16 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
    			label = "Push button switch 3";
    		};
    	};
    
    	arduino_header: connector {
    		compatible = "arduino-header-r3";
    		#gpio-cells = <2>;
    		gpio-map-mask = <0xffffffff 0xffffffc0>;
    		gpio-map-pass-thru = <0 0x3f>;
    		gpio-map = <0 0 &gpio0 3 0>,	/* A0 */
    			   <1 0 &gpio0 4 0>,	/* A1 */
    			   <2 0 &gpio0 28 0>,	/* A2 */
    			   <3 0 &gpio0 29 0>,	/* A3 */
    			   <4 0 &gpio0 30 0>,	/* A4 */
    			   <5 0 &gpio0 31 0>,	/* A5 */
    			   <6 0 &gpio0 11 0>,	/* D0 */
    			   <7 0 &gpio0 12 0>,	/* D1 */
    			   <8 0 &gpio0 13 0>,	/* D2 */
    			   <9 0 &gpio0 14 0>,	/* D3 */
    			   <10 0 &gpio0 15 0>,	/* D4 */
    			   <11 0 &gpio0 16 0>,	/* D5 */
    			   <12 0 &gpio0 17 0>,	/* D6 */
    			   <13 0 &gpio0 18 0>,	/* D7 */
    			   <14 0 &gpio0 19 0>,	/* D8 */
    			   <15 0 &gpio0 20 0>,	/* D9 */
    			   <16 0 &gpio0 22 0>,	/* D10 */
    			   <17 0 &gpio0 23 0>,	/* D11 */
    			   <18 0 &gpio0 24 0>,	/* D12 */
    			   <19 0 &gpio0 25 0>,	/* D13 */
    			   <20 0 &gpio0 26 0>,	/* D14 */
    			   <21 0 &gpio0 27 0>;	/* D15 */
    	};
    
    	arduino_adc: analog-connector {
    		compatible = "arduino,uno-adc";
    		#io-channel-cells = <1>;
    		io-channel-map = <0 &adc 1>,	/* A0 = P0.3 = AIN1 */
    				 <1 &adc 2>,	/* A1 = P0.4 = AIN2 */
    				 <2 &adc 4>,	/* A2 = P0.28 = AIN4 */
    				 <3 &adc 5>,	/* A3 = P0.29 = AIN5 */
    				 <4 &adc 6>,	/* A4 = P0.30 = AIN6 */
    				 <5 &adc 7>;	/* A5 = P0.31 = AIN7 */
    	};
    
    	/* These aliases are provided for compatibility with samples */
    	aliases {
    		led0 = &led0;
    		led1 = &led1;
    		led2 = &led2;
    		led3 = &led3;
    		pwm-led0 = &pwm_led0;
    		sw0 = &button0;
    		sw1 = &button1;
    		sw2 = &button2;
    		sw3 = &button3;
    	};
    };
    
    &adc {
    	status = "okay";
    };
    
    &gpiote {
    	status = "okay";
    };
    
    &gpio0 {
    	status = "okay";
    };
    
    arduino_serial: &uart0 {
    	status = "okay";
    	compatible = "nordic,nrf-uart";
    	current-speed = <115200>;
    	tx-pin = <6>;
    	rx-pin = <8>;
    	rts-pin = <5>;
    	cts-pin = <7>;
    };
    
    arduino_i2c: &i2c0 {
    	compatible = "nordic,nrf-twi";
    	status = "okay";
    	sda-pin = <26>;
    	scl-pin = <27>;
    };
    
    &i2c1 {
    	compatible = "nordic,nrf-twi";
    	/* Cannot be used together with spi1. */
    	/* status = "okay"; */
    	sda-pin = <30>;
    	scl-pin = <31>;
    };
    
    &pwm0 {
    	status = "okay";
    	ch0-pin = <17>;
    	ch0-inverted;
    };
    
    &spi0 {
    	compatible = "nordic,nrf-spi";
    	/* Cannot be used together with i2c0. */
    	/* status = "okay"; */
    	sck-pin = <27>;
    	mosi-pin = <26>;
    	miso-pin = <28>;
    };
    
    &spi1 {
    	compatible = "nordic,nrf-spi";
    	status = "okay";
    	sck-pin = <31>;
    	mosi-pin = <30>;
    	miso-pin = <29>;
    };
    
    arduino_spi: &spi2 {
    	compatible = "nordic,nrf-spi";
    	status = "okay";
    	sck-pin = <25>;
    	mosi-pin = <23>;
    	miso-pin = <24>;
    	cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
    };
    
    &flash0 {
    	/*
    	 * For more information, see:
    	 * https://docs.zephyrproject.org/latest/guides/dts/legacy-macros.html#legacy-flash-partitions
    	 */
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		boot_partition: partition@0 {
    			label = "mcuboot";
    			reg = <0x00000000 0xc000>;
    		};
    		slot0_partition: partition@c000 {
    			label = "image-0";
    			reg = <0x0000C000 0x34000>;
    		};
    		slot1_partition: partition@3e000 {
    			label = "image-1";
    			reg = <0x0003E000 0x34000>;
    		};
    		scratch_partition: partition@70000 {
    			label = "image-scratch";
    			reg = <0x00070000 0xa000>;
    		};
    		storage_partition: partition@7a000 {
    			label = "storage";
    			reg = <0x0007a000 0x00006000>;
    		};
    	};
    };
    

  • Hi,

    You need to ensure that the app is small enough to fit in one slot, and the slots need to have the same size in order for this to work. Also, you cannot just increase the size of the slots without moving other things around, and ensuring that there is not enough space. In short, the default dts has the sensible configuration here. Your changes will not work. Let me explain.

    Original partition layout of slot0 and slot1:

    		slot0_partition: partition@c000 {
    			label = "image-0";
    			reg = <0x0000C000 0x32000>;
    		};
    		slot1_partition: partition@3e000 {
    			label = "image-1";
    			reg = <0x0003E000 0x32000>;
    		};

    Here you see that slot 1 starts at the end of slot 0 (0xC000 + 0x32000 = 3E000)

    Your layout:

    slot0_partition: partition@c000 {
                label = "image-0";
                reg = <0x0000C000 0x34000>;
            };
            slot1_partition: partition@3e000 {
                label = "image-1";
                reg = <0x0003E000 0x34000>;
            };
    
    Fullscreen
    

    Here you increase the size of the slots, but you do not move slot 1, so there is an overlap. So if you should do this, it must be something like:

    		slot0_partition: partition@c000 {
    			label = "image-0";
    			reg = <0x0000C000 0x32000>;
    		};
    		slot1_partition: partition@3e000 {
    			label = "image-1";
    			reg = <0x0003E000 0x32000>;
    		};

    But then the end of slot1 is at 0x74000, so this overlaps with the scratch_partition, and so on. So you need to move everything down.

Related