<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>DFU in Zephyr + nsc 2.3.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/100061/dfu-in-zephyr-nsc-2-3-0</link><description>Hello guys, I&amp;#39;ve been looking for an example of using DFU (Device Firmware Update) with Zephyr for quite some time now. Previously, I used to do it quite easily with the classic SDK in Keil uVision. However, I&amp;#39;m struggling to find a step-by-step example</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 31 May 2023 09:24:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/100061/dfu-in-zephyr-nsc-2-3-0" /><item><title>RE: DFU in Zephyr + nsc 2.3.0</title><link>https://devzone.nordicsemi.com/thread/428374?ContentTypeID=1</link><pubDate>Wed, 31 May 2023 09:24:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5596e2e-2542-4763-96a0-812c9409b404</guid><dc:creator>babos</dc:creator><description>&lt;p&gt;ok, thank you.&lt;/p&gt;
&lt;p&gt;I thought it was necessary to adjust the program offset or relocate it. Now I&amp;#39;ll try and tell you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU in Zephyr + nsc 2.3.0</title><link>https://devzone.nordicsemi.com/thread/428372?ContentTypeID=1</link><pubDate>Wed, 31 May 2023 09:20:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28f14984-bde7-4cd5-a27d-b949203449c2</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Silvio,&amp;nbsp;&lt;br /&gt;Yes I don&amp;#39;t see any problem using the lbs sample as the base for testing OTA.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU in Zephyr + nsc 2.3.0</title><link>https://devzone.nordicsemi.com/thread/428250?ContentTypeID=1</link><pubDate>Tue, 30 May 2023 15:44:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:187da6cf-0562-4d10-867b-44760e0b3a48</guid><dc:creator>babos</dc:creator><description>&lt;p&gt;Hi Hung&lt;/p&gt;
&lt;p&gt;yes, now i Found sample and it work properly !&lt;/p&gt;
&lt;p&gt;Can I theoretically use it as a basis for having the OTA update on my programs?&lt;/p&gt;
&lt;p&gt;S.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU in Zephyr + nsc 2.3.0</title><link>https://devzone.nordicsemi.com/thread/428134?ContentTypeID=1</link><pubDate>Tue, 30 May 2023 10:55:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:daa86206-ea34-41e0-9796-965f762569f3</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Silvio,&amp;nbsp;&lt;br /&gt;The sample is peripheral_lbs and it&amp;#39;s located in&amp;nbsp;\nrf\samples\bluetooth\peripheral_lbs.&lt;/p&gt;
&lt;p&gt;Have you followed the last step to add:&amp;nbsp;smp_bt_register() into the code ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1685444152182v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU in Zephyr + nsc 2.3.0</title><link>https://devzone.nordicsemi.com/thread/427941?ContentTypeID=1</link><pubDate>Sun, 28 May 2023 17:24:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bea73fca-7101-4521-b0b1-5c29a85a29d1</guid><dc:creator>babos</dc:creator><description>&lt;p&gt;&lt;span&gt;CONFIG_MCUMGR was assigned the value y, but got the value n. Missing dependencies:&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ZCBOR&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU in Zephyr + nsc 2.3.0</title><link>https://devzone.nordicsemi.com/thread/427940?ContentTypeID=1</link><pubDate>Sun, 28 May 2023 17:22:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c2a879b-4304-4ce0-93e1-01a60657acd1</guid><dc:creator>babos</dc:creator><description>&lt;p&gt;Attached are the changes I managed to make in Simon&amp;#39;s example regarding updating a smartphone app. I compile but I can&amp;#39;t insert, because it doesn&amp;#39;t recognize them, the configurations:&lt;br /&gt;- # Enable mcumgr.&lt;br /&gt;CONFIG_MCUMGR=y&lt;/p&gt;
&lt;p&gt;# Enable most core commands.&lt;br /&gt;CONFIG_MCUMGR_CMD_IMG_MGMT=y&lt;br /&gt;CONFIG_MCUMGR_CMD_OS_MGMT=y&lt;/p&gt;
&lt;p&gt;And&lt;/p&gt;
&lt;p&gt;# Enable the Bluetooth (unauthenticated) and shell mcumgr transports.&lt;br /&gt;CONFIG_MCUMGR_SMP_BT=y&lt;br /&gt;CONFIG_MCUMGR_SMP_BT_AUTHEN=n&lt;/p&gt;
&lt;p&gt;because it doesn&amp;#39;t seem to recognize them in my ncs 2.3.0 system so I export the file but I get an error from my smartphone: &amp;quot;SMP service not found&amp;quot;&lt;/p&gt;
&lt;p&gt;any idea ?&lt;/p&gt;
&lt;p&gt;Silvio&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
CONFIG_NCS_SAMPLES_DEFAULTS=y

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME=&amp;quot;NORDIC_LBS&amp;quot;

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

# Ensure an MCUboot-compatible binary is generated.
CONFIG_BOOTLOADER_MCUBOOT=y

# Allow for large Bluetooth data packets.
CONFIG_BT_L2CAP_TX_MTU=252
CONFIG_BT_BUF_ACL_RX_SIZE=256

# Enable the Bluetooth (unauthenticated) and shell mcumgr transports.

# Some command handlers require a large stack.
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/*
 * Copyright (c) 2018 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

#include &amp;lt;zephyr/types.h&amp;gt;
#include &amp;lt;stddef.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;errno.h&amp;gt;
#include &amp;lt;zephyr/sys/printk.h&amp;gt;
#include &amp;lt;zephyr/sys/byteorder.h&amp;gt;
#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/drivers/gpio.h&amp;gt;
#include &amp;lt;soc.h&amp;gt;

#include &amp;lt;zephyr/bluetooth/bluetooth.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/hci.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/conn.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/uuid.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/gatt.h&amp;gt;

#include &amp;lt;bluetooth/services/lbs.h&amp;gt;

#include &amp;lt;zephyr/settings/settings.h&amp;gt;

#include &amp;lt;dk_buttons_and_leds.h&amp;gt;

#include &amp;lt;zephyr/mgmt/mcumgr/transport/smp_bt.h&amp;gt;

#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,
		      0x84, 0xaa, 0x60, 0x74, 0x52, 0x8a, 0x8b, 0x86,
		      0xd3, 0x4c, 0xb7, 0x1d, 0x1d, 0xdc, 0x53, 0x8d),
};

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

	printk(&amp;quot;Connected\n&amp;quot;);

	dk_set_led_on(CON_STATUS_LED);
}

static void disconnected(struct bt_conn *conn, uint8_t reason)
{
	printk(&amp;quot;Disconnected (reason %u)\n&amp;quot;, 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(&amp;quot;Security changed: %s level %u\n&amp;quot;, addr, level);
	} else {
		printk(&amp;quot;Security failed: %s level %u err %d\n&amp;quot;, addr, level,
			err);
	}
}
#endif

BT_CONN_CB_DEFINE(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(&amp;quot;Passkey for %s: %06u\n&amp;quot;, 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(&amp;quot;Pairing cancelled: %s\n&amp;quot;, 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(&amp;quot;Pairing completed: %s, bonded: %d\n&amp;quot;, 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(&amp;quot;Pairing failed conn: %s, reason %d\n&amp;quot;, addr, reason);
}

static struct bt_conn_auth_cb conn_auth_callbacks = {
	.passkey_display = auth_passkey_display,
	.cancel = auth_cancel,
};

static struct bt_conn_auth_info_cb conn_auth_info_callbacks = {
	.pairing_complete = pairing_complete,
	.pairing_failed = pairing_failed
};
#else
static struct bt_conn_auth_cb conn_auth_callbacks;
static struct bt_conn_auth_info_cb conn_auth_info_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 &amp;amp; USER_BUTTON) {
		uint32_t user_button_state = button_state &amp;amp; USER_BUTTON;

		bt_lbs_send_button_state(user_button_state);
		app_button_state = user_button_state ? true : false;
	}
}

static int init_button(void)
{
	int err;

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

	return err;
}

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

	printk(&amp;quot;Starting Bluetooth Peripheral LBS example\n&amp;quot;);

	err = dk_leds_init();
	if (err) {
		printk(&amp;quot;LEDs init failed (err %d)\n&amp;quot;, err);
		return 0;
	}

	err = init_button();
	if (err) {
		printk(&amp;quot;Button init failed (err %d)\n&amp;quot;, err);
		return 0;
	}

	if (IS_ENABLED(CONFIG_BT_LBS_SECURITY_ENABLED)) {
		err = bt_conn_auth_cb_register(&amp;amp;conn_auth_callbacks);
		if (err) {
			printk(&amp;quot;Failed to register authorization callbacks.\n&amp;quot;);
			return 0;
		}

		err = bt_conn_auth_info_cb_register(&amp;amp;conn_auth_info_callbacks);
		if (err) {
			printk(&amp;quot;Failed to register authorization info callbacks.\n&amp;quot;);
			return 0;
		}
	}

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

	printk(&amp;quot;Bluetooth initialized\n&amp;quot;);
	

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

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

	err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad),
			      sd, ARRAY_SIZE(sd));
	if (err) {
		printk(&amp;quot;Advertising failed to start (err %d)\n&amp;quot;, err);
		return 0;
	}
    printk(&amp;quot;\n\nbuild time: &amp;quot; __DATE__ &amp;quot; &amp;quot; __TIME__ &amp;quot;\n&amp;quot;);
	printk(&amp;quot;Advertising successfully started\n&amp;quot;);

	for (;;) {
		dk_set_led(RUN_STATUS_LED, (++blink_status) % 2);
		k_sleep(K_MSEC(RUN_LED_BLINK_INTERVAL));
	}
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU in Zephyr + nsc 2.3.0</title><link>https://devzone.nordicsemi.com/thread/427938?ContentTypeID=1</link><pubDate>Sun, 28 May 2023 16:21:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b0f69c8-d026-419f-abd0-06623b6caf1b</guid><dc:creator>babos</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;these samples of which you gave me the links, refer to a version SDK 1.7 of nordic. Isn&amp;#39;t there something newer? In ncs 2.3.0 I can&amp;#39;t find the names of the samples unless they have changed.&lt;br /&gt;Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU in Zephyr + nsc 2.3.0</title><link>https://devzone.nordicsemi.com/thread/427315?ContentTypeID=1</link><pubDate>Wed, 24 May 2023 16:56:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93a1d99d-1928-48e6-b1b0-7000b07ba2f2</guid><dc:creator>babos</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;I will let you know&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;thank you&lt;/p&gt;
&lt;p&gt;S.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU in Zephyr + nsc 2.3.0</title><link>https://devzone.nordicsemi.com/thread/427223?ContentTypeID=1</link><pubDate>Wed, 24 May 2023 12:14:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3df0c310-0e40-43d0-916e-0a42e1809f07</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Silvio,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;DFU protocol in Zephyr is quite different from the nRF SDK DFU protocol.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Among other things here are the main difference:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;- On air protocols&amp;nbsp;are different. They are not compatible. So the sign process is now different. The bootloader&amp;nbsp;is now MCUBoot.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-&amp;nbsp;The DFU update is now background DFU update. Meaning the application doesn&amp;#39;t switch to bootloader mode to do DFU (except for serial recovery mode)&lt;/p&gt;
&lt;p&gt;- Only dual bank update supported.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;My suggestion is to have a look at the documentation &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/working_with_nrf/nrf52/developing.html#fota-updates"&gt;here&lt;/a&gt;. We have a guide &lt;a href="https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/ncs-dfu"&gt;here &lt;/a&gt;that can help you to getting started with the DFU update.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>