<?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>nRF54L15 Zephry Flash init error -22</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/119099/nrf54l15-zephry-flash-init-error--22</link><description>Hi Nordic, 
 Board:nRF54L15 DK 
 Code Base:peripheral_uart 
 Issue: Added Zephyr NVS Flash support but encountered error -22 from nvs_mount(&amp;amp;fs). Additionally, data cannot be saved successfully. 
 The settings were referenced from a Zephyr sample (Refer</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 Feb 2025 10:26:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/119099/nrf54l15-zephry-flash-init-error--22" /><item><title>RE: nRF54L15 Zephry Flash init error -22</title><link>https://devzone.nordicsemi.com/thread/525022?ContentTypeID=1</link><pubDate>Thu, 27 Feb 2025 10:26:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2bdfd92-49e1-47e2-a874-5c8aafb8db02</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Ah, you&amp;#39;re using 2.8.0. The bug in the peripheral_lbs sample is only present in 2.9.0 so you&amp;#39;re good.&lt;/p&gt;
&lt;p&gt;Have you seen&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev/device_guides/nrf54l/zms.html"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev/device_guides/nrf54l/zms.html&amp;nbsp;&lt;/a&gt;and the two options there to set zms through the settings subsystem?&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15 Zephry Flash init error -22</title><link>https://devzone.nordicsemi.com/thread/524949?ContentTypeID=1</link><pubDate>Thu, 27 Feb 2025 02:12:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:592b3117-d5e4-49e8-99b9-e95055519d66</guid><dc:creator>Joey Wang</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi AHaug&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I check my project&amp;#39;s Kconfig setting, it seems already match the solution(Attached the&amp;nbsp; Kconfig code ).&lt;/p&gt;
&lt;p&gt;But I still got the same error. Did I miss something&amp;nbsp; ?Thanks.&lt;/p&gt;
&lt;p&gt;My SDK Version is:2.8.0&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1740621906559v2.png" /&gt;&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
#

source &amp;quot;Kconfig.zephyr&amp;quot;

menu &amp;quot;Nordic UART BLE GATT service sample&amp;quot;

config BT_NUS_THREAD_STACK_SIZE
	int &amp;quot;Thread stack size&amp;quot;
	default 1024
	help
	  Stack size used in each of the two threads

config BT_NUS_UART_BUFFER_SIZE
	int &amp;quot;UART payload buffer element size&amp;quot;
	default 40
	help
	  Size of the payload buffer in each RX and TX FIFO element

config BT_NUS_SECURITY_ENABLED
	bool &amp;quot;Enable security&amp;quot;
	default y
	select BT_SMP
	help
	  &amp;quot;Enable BLE security for the UART service&amp;quot;

config BT_NUS_UART_RX_WAIT_TIME
	int &amp;quot;Timeout for UART RX complete event&amp;quot;
	default 50000
	help
	  Wait for RX complete event time in microseconds

config SETTINGS
	default y

config ZMS
	default y if SOC_FLASH_NRF_RRAM

config NVS
	default y if !SOC_FLASH_NRF_RRAM

endmenu&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1740621735745v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;Below is the prj.conf&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
#

#flash enable setting
# Eable NVS 

CONFIG_ZMS=y #zms enable
#CONFIG_SETTINGS_NVS=n
#CONFIG_SETTINGS_FCB=n
#PM_SETTINGS_STORAGE_ID=n

# Enable the UART driver
CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UARTE0=y
CONFIG_SERIAL=y

CONFIG_GPIO=y

# Make sure printk is printing to the UART console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

CONFIG_HEAP_MEM_POOL_SIZE=2048

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME=&amp;quot;Nordic_UART_Service&amp;quot;
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1

# Enable the NUS service
CONFIG_BT_NUS=y

# Enable bonding
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
#CONFIG_MPU_ALLOW_FLASH_WRITE=y
# Enable DK LED and Buttons library
CONFIG_DK_LIBRARY=y

# This example requires more stack
CONFIG_MAIN_STACK_SIZE=1152
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Config logger
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n
CONFIG_LOG_PRINTK=n

CONFIG_ASSERT=y


#CONFIG_NRFX_SYSTICK_ENABLED=y
CONFIG_TIMER=y&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15 Zephry Flash init error -22</title><link>https://devzone.nordicsemi.com/thread/524598?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2025 13:05:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7599902e-53b8-43ac-8c92-15659e9c28ba</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Good news. I found the reason for why you get both a NVS settings partition and NVS settings partition.&lt;/p&gt;
&lt;p&gt;In&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.9.0/samples/bluetooth/peripheral_uart/Kconfig"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v2.9.0/samples/bluetooth/peripheral_uart/Kconfig&lt;/a&gt;&amp;nbsp;it defaults to both NVS and ZMS, while it should be set as shown in&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.9.0/samples/bluetooth/central_uart/Kconfig"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v2.9.0/samples/bluetooth/central_uart/Kconfig&amp;nbsp;&lt;/a&gt;(and any other BLE sample).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I.e change&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;config ZMS
	default y if !(SOC_FLASH_NRF_RRAM || SOC_FLASH_NRF_MRAM)

config NVS
	default y if !(SOC_FLASH_NRF_RRAM || SOC_FLASH_NRF_MRAM)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;to&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;config ZMS
	default y if (SOC_FLASH_NRF_RRAM || SOC_FLASH_NRF_MRAM)

config NVS
	default y if !(SOC_FLASH_NRF_RRAM || SOC_FLASH_NRF_MRAM)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and it should work with ZMS only.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In case you want to use both ZMS and NVS settings, it might be possible, but for now the suggestion above should fix the issue you&amp;#39;re seeing. I will make a bug report to fix it. Edit: The fix is already in sdk-nrf main and will be there from NCS v3.0.0 for the sample this affects&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15 Zephry Flash init error -22</title><link>https://devzone.nordicsemi.com/thread/524226?ContentTypeID=1</link><pubDate>Mon, 24 Feb 2025 06:29:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:483c0047-8300-4d7d-b6bc-2c4eebb5957e</guid><dc:creator>Joey Wang</dc:creator><description>&lt;p&gt;Hi AHaug/ Emil,&lt;/p&gt;
&lt;p&gt;Thanks for the advice. I&amp;rsquo;ve changed the setting to ZMS now.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m still encountering the same problem in BLE_UART, but ZMS initializes successfully when using the non-BLE blinky sample.&lt;/p&gt;
&lt;p&gt;As you mentioned, this might be a flash map issue.&lt;/p&gt;
&lt;p&gt;The only difference I found is in the flash_map_pm.h settings:&lt;/p&gt;
&lt;p&gt;BLE_UART: settings_storage (RED) &amp;rarr; Init failed, fs.offset = 0x163000&lt;br /&gt;Blinky: zms_storage (Green) &amp;rarr; Init OK, fs.offset = 0x15F000&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1740378437707v2.png" /&gt;&lt;/p&gt;
&lt;p&gt;It seems no more setting value can check in &amp;quot;&lt;span&gt;flash_map_pm.h&amp;quot;,&lt;br /&gt;Only can change the setting &amp;quot;CONFIG_ZMS=y&amp;quot; in prj.conf&lt;pre class="ui-code" data-mode="text"&gt;/*
 * Copyright (c) 2018 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

/** @file
 *  @brief Nordic UART Bridge Service (NUS) sample
 */
#include &amp;lt;uart_async_adapter.h&amp;gt;

#include &amp;lt;zephyr/types.h&amp;gt;
#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/drivers/uart.h&amp;gt;
#include &amp;lt;zephyr/usb/usb_device.h&amp;gt;

#include &amp;lt;zephyr/device.h&amp;gt;
#include &amp;lt;zephyr/devicetree.h&amp;gt;
#include &amp;lt;soc.h&amp;gt;

#include &amp;lt;zephyr/bluetooth/bluetooth.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/uuid.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/gatt.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/hci.h&amp;gt;

#include &amp;lt;bluetooth/services/nus.h&amp;gt;

#include &amp;lt;dk_buttons_and_leds.h&amp;gt;

#include &amp;lt;zephyr/settings/settings.h&amp;gt;

#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

#include &amp;lt;zephyr/logging/log.h&amp;gt;

#define LOG_MODULE_NAME peripheral_uart
LOG_MODULE_REGISTER(LOG_MODULE_NAME);

#define STACKSIZE CONFIG_BT_NUS_THREAD_STACK_SIZE
#define PRIORITY 7

#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
#define DEVICE_NAME_LEN	(sizeof(DEVICE_NAME) - 1)

#define RUN_STATUS_LED DK_LED1
#define RUN_LED_BLINK_INTERVAL 1000

#define CON_STATUS_LED DK_LED2

#define KEY_PASSKEY_ACCEPT DK_BTN1_MSK
#define KEY_PASSKEY_REJECT DK_BTN2_MSK

#define UART_BUF_SIZE CONFIG_BT_NUS_UART_BUFFER_SIZE
#define UART_WAIT_FOR_BUF_DELAY K_MSEC(50)
#define UART_WAIT_FOR_RX CONFIG_BT_NUS_UART_RX_WAIT_TIME

static K_SEM_DEFINE(ble_init_ok, 0, 1);

static struct bt_conn *current_conn;
static struct bt_conn *auth_conn;

static const struct device *uart = DEVICE_DT_GET(DT_CHOSEN(nordic_nus_uart));
static struct k_work_delayable uart_work;

struct uart_data_t {
	void *fifo_reserved;
	uint8_t data[UART_BUF_SIZE];
	uint16_t len;
};

static K_FIFO_DEFINE(fifo_uart_tx_data);
static K_FIFO_DEFINE(fifo_uart_rx_data);

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_NUS_VAL),
};

#ifdef CONFIG_UART_ASYNC_ADAPTER
UART_ASYNC_ADAPTER_INST_DEFINE(async_adapter);
#else
#define async_adapter NULL
#endif

static void uart_cb(const struct device *dev, struct uart_event *evt, void *user_data)
{
	ARG_UNUSED(dev);

	static size_t aborted_len;
	struct uart_data_t *buf;
	static uint8_t *aborted_buf;
	static bool disable_req;

	switch (evt-&amp;gt;type) {
	case UART_TX_DONE:
		LOG_DBG(&amp;quot;UART_TX_DONE&amp;quot;);
		if ((evt-&amp;gt;data.tx.len == 0) ||
		    (!evt-&amp;gt;data.tx.buf)) {
			return;
		}

		if (aborted_buf) {
			buf = CONTAINER_OF(aborted_buf, struct uart_data_t,
					   data[0]);
			aborted_buf = NULL;
			aborted_len = 0;
		} else {
			buf = CONTAINER_OF(evt-&amp;gt;data.tx.buf, struct uart_data_t,
					   data[0]);
		}

		k_free(buf);

		buf = k_fifo_get(&amp;amp;fifo_uart_tx_data, K_NO_WAIT);
		if (!buf) {
			return;
		}

		if (uart_tx(uart, buf-&amp;gt;data, buf-&amp;gt;len, SYS_FOREVER_MS)) {
			LOG_WRN(&amp;quot;Failed to send data over UART&amp;quot;);
		}

		break;

	case UART_RX_RDY:
		LOG_DBG(&amp;quot;UART_RX_RDY&amp;quot;);
		buf = CONTAINER_OF(evt-&amp;gt;data.rx.buf, struct uart_data_t, data[0]);
		buf-&amp;gt;len += evt-&amp;gt;data.rx.len;

		if (disable_req) {
			return;
		}

		if ((evt-&amp;gt;data.rx.buf[buf-&amp;gt;len - 1] == &amp;#39;\n&amp;#39;) ||
		    (evt-&amp;gt;data.rx.buf[buf-&amp;gt;len - 1] == &amp;#39;\r&amp;#39;)) {
			disable_req = true;
			uart_rx_disable(uart);
		}

		break;

	case UART_RX_DISABLED:
		LOG_DBG(&amp;quot;UART_RX_DISABLED&amp;quot;);
		disable_req = false;

		buf = k_malloc(sizeof(*buf));
		if (buf) {
			buf-&amp;gt;len = 0;
		} else {
			LOG_WRN(&amp;quot;Not able to allocate UART receive buffer&amp;quot;);
			k_work_reschedule(&amp;amp;uart_work, UART_WAIT_FOR_BUF_DELAY);
			return;
		}

		uart_rx_enable(uart, buf-&amp;gt;data, sizeof(buf-&amp;gt;data),
			       UART_WAIT_FOR_RX);

		break;

	case UART_RX_BUF_REQUEST:
		LOG_DBG(&amp;quot;UART_RX_BUF_REQUEST&amp;quot;);
		buf = k_malloc(sizeof(*buf));
		if (buf) {
			buf-&amp;gt;len = 0;
			uart_rx_buf_rsp(uart, buf-&amp;gt;data, sizeof(buf-&amp;gt;data));
		} else {
			LOG_WRN(&amp;quot;Not able to allocate UART receive buffer&amp;quot;);
		}

		break;

	case UART_RX_BUF_RELEASED:
		LOG_DBG(&amp;quot;UART_RX_BUF_RELEASED&amp;quot;);
		buf = CONTAINER_OF(evt-&amp;gt;data.rx_buf.buf, struct uart_data_t,
				   data[0]);

		if (buf-&amp;gt;len &amp;gt; 0) {
			k_fifo_put(&amp;amp;fifo_uart_rx_data, buf);
		} else {
			k_free(buf);
		}

		break;

	case UART_TX_ABORTED:
		LOG_DBG(&amp;quot;UART_TX_ABORTED&amp;quot;);
		if (!aborted_buf) {
			aborted_buf = (uint8_t *)evt-&amp;gt;data.tx.buf;
		}

		aborted_len += evt-&amp;gt;data.tx.len;
		buf = CONTAINER_OF((void *)aborted_buf, struct uart_data_t,
				   data);

		uart_tx(uart, &amp;amp;buf-&amp;gt;data[aborted_len],
			buf-&amp;gt;len - aborted_len, SYS_FOREVER_MS);

		break;

	default:
		break;
	}
}

static void uart_work_handler(struct k_work *item)
{
	struct uart_data_t *buf;

	buf = k_malloc(sizeof(*buf));
	if (buf) {
		buf-&amp;gt;len = 0;
	} else {
		LOG_WRN(&amp;quot;Not able to allocate UART receive buffer&amp;quot;);
		k_work_reschedule(&amp;amp;uart_work, UART_WAIT_FOR_BUF_DELAY);
		return;
	}

	uart_rx_enable(uart, buf-&amp;gt;data, sizeof(buf-&amp;gt;data), UART_WAIT_FOR_RX);
}

static bool uart_test_async_api(const struct device *dev)
{
	const struct uart_driver_api *api =
			(const struct uart_driver_api *)dev-&amp;gt;api;

	return (api-&amp;gt;callback_set != NULL);
}

static int uart_init(void)
{
	int err;
	int pos;
	struct uart_data_t *rx;
	struct uart_data_t *tx;

	if (!device_is_ready(uart)) {
		return -ENODEV;
	}

	if (IS_ENABLED(CONFIG_USB_DEVICE_STACK)) {
		err = usb_enable(NULL);
		if (err &amp;amp;&amp;amp; (err != -EALREADY)) {
			LOG_ERR(&amp;quot;Failed to enable USB&amp;quot;);
			return err;
		}
	}

	rx = k_malloc(sizeof(*rx));
	if (rx) {
		rx-&amp;gt;len = 0;
	} else {
		return -ENOMEM;
	}

	k_work_init_delayable(&amp;amp;uart_work, uart_work_handler);


	if (IS_ENABLED(CONFIG_UART_ASYNC_ADAPTER) &amp;amp;&amp;amp; !uart_test_async_api(uart)) {
		/* Implement API adapter */
		uart_async_adapter_init(async_adapter, uart);
		uart = async_adapter;
	}

	err = uart_callback_set(uart, uart_cb, NULL);
	if (err) {
		k_free(rx);
		LOG_ERR(&amp;quot;Cannot initialize UART callback&amp;quot;);
		return err;
	}

	if (IS_ENABLED(CONFIG_UART_LINE_CTRL)) {
		LOG_INF(&amp;quot;Wait for DTR&amp;quot;);
		while (true) {
			uint32_t dtr = 0;

			uart_line_ctrl_get(uart, UART_LINE_CTRL_DTR, &amp;amp;dtr);
			if (dtr) {
				break;
			}
			/* Give CPU resources to low priority threads. */
			k_sleep(K_MSEC(100));
		}
		LOG_INF(&amp;quot;DTR set&amp;quot;);
		err = uart_line_ctrl_set(uart, UART_LINE_CTRL_DCD, 1);
		if (err) {
			LOG_WRN(&amp;quot;Failed to set DCD, ret code %d&amp;quot;, err);
		}
		err = uart_line_ctrl_set(uart, UART_LINE_CTRL_DSR, 1);
		if (err) {
			LOG_WRN(&amp;quot;Failed to set DSR, ret code %d&amp;quot;, err);
		}
	}

	tx = k_malloc(sizeof(*tx));

	if (tx) {
		pos = snprintf(tx-&amp;gt;data, sizeof(tx-&amp;gt;data),
			       &amp;quot;Starting Nordic UART service example\r\n&amp;quot;);

		if ((pos &amp;lt; 0) || (pos &amp;gt;= sizeof(tx-&amp;gt;data))) {
			k_free(rx);
			k_free(tx);
			LOG_ERR(&amp;quot;snprintf returned %d&amp;quot;, pos);
			return -ENOMEM;
		}

		tx-&amp;gt;len = pos;
	} else {
		k_free(rx);
		return -ENOMEM;
	}

	err = uart_tx(uart, tx-&amp;gt;data, tx-&amp;gt;len, SYS_FOREVER_MS);
	if (err) {
		k_free(rx);
		k_free(tx);
		LOG_ERR(&amp;quot;Cannot display welcome message (err: %d)&amp;quot;, err);
		return err;
	}

	err = uart_rx_enable(uart, rx-&amp;gt;data, sizeof(rx-&amp;gt;data), UART_WAIT_FOR_RX);
	if (err) {
		LOG_ERR(&amp;quot;Cannot enable uart reception (err: %d)&amp;quot;, err);
		/* Free the rx buffer only because the tx buffer will be handled in the callback */
		k_free(rx);
	}

	return err;
}

static void connected(struct bt_conn *conn, uint8_t err)
{
	char addr[BT_ADDR_LE_STR_LEN];

	if (err) {
		LOG_ERR(&amp;quot;Connection failed, err 0x%02x %s&amp;quot;, err, bt_hci_err_to_str(err));
		return;
	}

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
	LOG_INF(&amp;quot;Connected %s&amp;quot;, addr);

	current_conn = bt_conn_ref(conn);

	dk_set_led_on(CON_STATUS_LED);
}

static void disconnected(struct bt_conn *conn, uint8_t reason)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	LOG_INF(&amp;quot;Disconnected: %s, reason 0x%02x %s&amp;quot;, addr, reason, bt_hci_err_to_str(reason));

	if (auth_conn) {
		bt_conn_unref(auth_conn);
		auth_conn = NULL;
	}

	if (current_conn) {
		bt_conn_unref(current_conn);
		current_conn = NULL;
		dk_set_led_off(CON_STATUS_LED);
	}
}

#ifdef CONFIG_BT_NUS_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) {
		LOG_INF(&amp;quot;Security changed: %s level %u&amp;quot;, addr, level);
	} else {
		LOG_WRN(&amp;quot;Security failed: %s level %u err %d %s&amp;quot;, addr, level, err,
			bt_security_err_to_str(err));
	}
}
#endif

BT_CONN_CB_DEFINE(conn_callbacks) = {
	.connected    = connected,
	.disconnected = disconnected,
#ifdef CONFIG_BT_NUS_SECURITY_ENABLED
	.security_changed = security_changed,
#endif
};

#if defined(CONFIG_BT_NUS_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));

	LOG_INF(&amp;quot;Passkey for %s: %06u&amp;quot;, addr, passkey);
}

static void auth_passkey_confirm(struct bt_conn *conn, unsigned int passkey)
{
	char addr[BT_ADDR_LE_STR_LEN];

	auth_conn = bt_conn_ref(conn);

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	LOG_INF(&amp;quot;Passkey for %s: %06u&amp;quot;, addr, passkey);

	if (IS_ENABLED(CONFIG_SOC_SERIES_NRF54HX) || IS_ENABLED(CONFIG_SOC_SERIES_NRF54LX)) {
		LOG_INF(&amp;quot;Press Button 0 to confirm, Button 1 to reject.&amp;quot;);
	} else {
		LOG_INF(&amp;quot;Press Button 1 to confirm, Button 2 to reject.&amp;quot;);
	}
}


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));

	LOG_INF(&amp;quot;Pairing cancelled: %s&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));

	LOG_INF(&amp;quot;Pairing completed: %s, bonded: %d&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));

	LOG_INF(&amp;quot;Pairing failed conn: %s, reason %d %s&amp;quot;, addr, reason,
		bt_security_err_to_str(reason));
}

static struct bt_conn_auth_cb conn_auth_callbacks = {
	.passkey_display = auth_passkey_display,
	.passkey_confirm = auth_passkey_confirm,
	.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 bt_receive_cb(struct bt_conn *conn, const uint8_t *const data,
			  uint16_t len)
{
	int err;
	char addr[BT_ADDR_LE_STR_LEN] = {0};

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, ARRAY_SIZE(addr));

	LOG_INF(&amp;quot;Received data from: %s&amp;quot;, addr);

	for (uint16_t pos = 0; pos != len;) {
		struct uart_data_t *tx = k_malloc(sizeof(*tx));

		if (!tx) {
			LOG_WRN(&amp;quot;Not able to allocate UART send data buffer&amp;quot;);
			return;
		}

		/* Keep the last byte of TX buffer for potential LF char. */
		size_t tx_data_size = sizeof(tx-&amp;gt;data) - 1;

		if ((len - pos) &amp;gt; tx_data_size) {
			tx-&amp;gt;len = tx_data_size;
		} else {
			tx-&amp;gt;len = (len - pos);
		}

		memcpy(tx-&amp;gt;data, &amp;amp;data[pos], tx-&amp;gt;len);

		pos += tx-&amp;gt;len;

		/* Append the LF character when the CR character triggered
		 * transmission from the peer.
		 */
		if ((pos == len) &amp;amp;&amp;amp; (data[len - 1] == &amp;#39;\r&amp;#39;)) {
			tx-&amp;gt;data[tx-&amp;gt;len] = &amp;#39;\n&amp;#39;;
			tx-&amp;gt;len++;
		}

		err = uart_tx(uart, tx-&amp;gt;data, tx-&amp;gt;len, SYS_FOREVER_MS);
		if (err) {
			k_fifo_put(&amp;amp;fifo_uart_tx_data, tx);
		}
	}
}

static struct bt_nus_cb nus_cb = {
	.received = bt_receive_cb,
};

void error(void)
{
	dk_set_leds_state(DK_ALL_LEDS_MSK, DK_NO_LEDS_MSK);

	while (true) {
		/* Spin for ever */
		k_sleep(K_MSEC(1000));
	}
}

#ifdef CONFIG_BT_NUS_SECURITY_ENABLED
static void num_comp_reply(bool accept)
{
	if (accept) {
		bt_conn_auth_passkey_confirm(auth_conn);
		LOG_INF(&amp;quot;Numeric Match, conn %p&amp;quot;, (void *)auth_conn);
	} else {
		bt_conn_auth_cancel(auth_conn);
		LOG_INF(&amp;quot;Numeric Reject, conn %p&amp;quot;, (void *)auth_conn);
	}

	bt_conn_unref(auth_conn);
	auth_conn = NULL;
}

void button_changed(uint32_t button_state, uint32_t has_changed)
{
	uint32_t buttons = button_state &amp;amp; has_changed;

	if (auth_conn) {
		if (buttons &amp;amp; KEY_PASSKEY_ACCEPT) {
			num_comp_reply(true);
		}

		if (buttons &amp;amp; KEY_PASSKEY_REJECT) {
			num_comp_reply(false);
		}
	}
}
#endif /* CONFIG_BT_NUS_SECURITY_ENABLED */

static void configure_gpio(void)
{
	int err;

#ifdef CONFIG_BT_NUS_SECURITY_ENABLED
	err = dk_buttons_init(button_changed);
	if (err) {
		LOG_ERR(&amp;quot;Cannot init buttons (err: %d)&amp;quot;, err);
	}
#endif /* CONFIG_BT_NUS_SECURITY_ENABLED */

	err = dk_leds_init();
	if (err) {
		LOG_ERR(&amp;quot;Cannot init LEDs (err: %d)&amp;quot;, err);
	}
}


// #define OpenFlash 1
// #if OpenFlash
// #include &amp;lt;zephyr/drivers/flash.h&amp;gt;
// #include &amp;lt;zephyr/storage/flash_map.h&amp;gt;
// #include &amp;lt;zephyr/fs/nvs.h&amp;gt;
// #endif

// #define NVS_PARTITION		 storage_partition
// #define NVS_PARTITION_DEVICE FIXED_PARTITION_DEVICE(NVS_PARTITION)
// #define NVS_PARTITION_OFFSET FIXED_PARTITION_OFFSET(NVS_PARTITION)



// #if OpenFlash
// struct nvs_fs fs;
// static struct flash_pages_info flash_info;
// static int rc;
// #endif
// int ADDRESS_ID=1;
// int init_flash(void)
// {
// 	#if OpenFlash
// 	fs.flash_device = NVS_PARTITION_DEVICE;
// 	if (!device_is_ready(fs.flash_device)) {
// 		LOG_INF(&amp;quot;Flash device %s is not ready\n&amp;quot;, fs.flash_device-&amp;gt;name);
// 		return 0;
// 	}
// 	fs.offset = NVS_PARTITION_OFFSET;
// 	rc = flash_get_page_info_by_offs(fs.flash_device, fs.offset, &amp;amp;flash_info);
// 	LOG_INF(&amp;quot;fs.offset= 0x%X&amp;quot;,fs.offset);
// 	if (rc) {
// 		LOG_INF(&amp;quot;Unable to get page info\n&amp;quot;);
// 		return 0;
// 	}
// 	fs.sector_size = flash_info.size;
// 	fs.sector_count = 5U; //要在Flash存幾筆資料
// 	rc = nvs_mount(&amp;amp;fs);
// 	if (rc) {
// 		LOG_INF(&amp;quot;Flash Init failed rc %d\n&amp;quot;,rc);
// 		return 0;
// 	}
// 	else{


// 	}
// 	#endif
// 	static char buf[16];
// 	/* ADDRESS_ID is used to store an address, lets see if we can
// 	 * read it from flash, since we don&amp;#39;t know the size read the
// 	 * maximum possible
// 	 */
// 	rc = nvs_read(&amp;amp;fs, ADDRESS_ID, &amp;amp;buf, sizeof(buf));
// 	if (rc &amp;gt; 0) { /* item was found, show it */
// 		LOG_INF(&amp;quot;Id: %d, Address: %s\n&amp;quot;, ADDRESS_ID, buf);
// 	} else   {/* item was not found, add it */
// 		strcpy(buf, &amp;quot;192.168.1.1&amp;quot;);
// 		LOG_INF(&amp;quot;No address found, adding %s at id %d\n&amp;quot;, buf,
// 		       ADDRESS_ID);
// 		(void)nvs_write(&amp;amp;fs, ADDRESS_ID, &amp;amp;buf, strlen(buf)+1);
// 	}

// 	return 1;
// }


// int setup_flash()
// {
// 	int err;
// 	/////////// KH Tsai New Add for Flash (Start)
// 	LOG_INF(&amp;quot;init_flash&amp;quot;);
// 	err = init_flash(); // KH Tsai New Add
// 	if (err == 0) {
// 		LOG_INF(&amp;quot;Flash init failed (err %d)\n&amp;quot;, err);
// 		return err;
// 	} else {
// 		LOG_INF(&amp;quot;Flash init ok (err %d)\n&amp;quot;, err);
// 	}
// 	/////////// KH Tsai New Add for Flash (End)
// }


//#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/sys/reboot.h&amp;gt;
//#include &amp;lt;zephyr/device.h&amp;gt;
//#include &amp;lt;string.h&amp;gt;
#include &amp;lt;zephyr/drivers/flash.h&amp;gt;
#include &amp;lt;zephyr/storage/flash_map.h&amp;gt;
#include &amp;lt;zephyr/fs/zms.h&amp;gt;

static struct zms_fs fs;

#define ZMS_PARTITION        storage_partition
#define ZMS_PARTITION_DEVICE FIXED_PARTITION_DEVICE(ZMS_PARTITION)
#define ZMS_PARTITION_OFFSET FIXED_PARTITION_OFFSET(ZMS_PARTITION)

#define IP_ADDRESS_ID 1
#define KEY_VALUE_ID  0xbeefdead
#define CNT_ID        2
#define LONG_DATA_ID  3

#define MAX_ITERATIONS   300
#define DELETE_ITERATION 10

static int delete_and_verify_items(struct zms_fs *fs, uint32_t id)
{
	int rc = 0;
	LOG_INF(&amp;quot;delete_and_verify_items&amp;quot;);
	rc = zms_delete(fs, id);
	if (rc) {
		goto error1;
	}
	rc = zms_get_data_length(fs, id);
	if (rc &amp;gt; 0) {
		goto error2;
	}

	return 0;
error1:
LOG_INF(&amp;quot;Error while deleting item rc=%d\n&amp;quot;, rc);
	return rc;
error2:
LOG_INF(&amp;quot;Error, Delete failed item should not be present\n&amp;quot;);
	return -1;
}

static int delete_basic_items(struct zms_fs *fs)
{
	int rc = 0;
	LOG_INF(&amp;quot;delete_basic_items&amp;quot;);
	rc = delete_and_verify_items(fs, IP_ADDRESS_ID);
	if (rc) {
		LOG_INF(&amp;quot;Error while deleting item %x rc=%d\n&amp;quot;, IP_ADDRESS_ID, rc);
		return rc;
	}
	rc = delete_and_verify_items(fs, KEY_VALUE_ID);
	if (rc) {
		LOG_INF(&amp;quot;Error while deleting item %x rc=%d\n&amp;quot;, KEY_VALUE_ID, rc);
		return rc;
	}
	rc = delete_and_verify_items(fs, CNT_ID);
	if (rc) {
		LOG_INF(&amp;quot;Error while deleting item %x rc=%d\n&amp;quot;, CNT_ID, rc);
		return rc;
	}
	rc = delete_and_verify_items(fs, LONG_DATA_ID);
	if (rc) {
		LOG_INF(&amp;quot;Error while deleting item %x rc=%d\n&amp;quot;, LONG_DATA_ID, rc);
	}

	return rc;
}

void zms_setting(void )
{

	int rc = 0;
	char buf[16];
	uint8_t key[8] = {0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE, 0xEF}, longarray[128];
	uint32_t i_cnt = 0U;
	uint32_t i;
	uint32_t id = 0;
	ssize_t free_space = 0;
	struct flash_pages_info info;

	for (int n = 0; n &amp;lt; sizeof(longarray); n++) {
		longarray[n] = n;
	}

	/* define the zms file system by settings with:
	 *	sector_size equal to the pagesize,
	 *	3 sectors
	 *	starting at ZMS_PARTITION_OFFSET
	 */
	fs.flash_device = ZMS_PARTITION_DEVICE;
	if (!device_is_ready(fs.flash_device)) {
		LOG_INF(&amp;quot;Storage device %s is not ready\n&amp;quot;, fs.flash_device-&amp;gt;name);
		return 0;
	}
	fs.offset = ZMS_PARTITION_OFFSET;
	rc = flash_get_page_info_by_offs(fs.flash_device, fs.offset, &amp;amp;info);
	LOG_INF(&amp;quot;rc=%d&amp;quot;,rc);
	if (rc) {
		LOG_INF(&amp;quot;Unable to get page info, rc=%d\n&amp;quot;, rc);
		return 0;
	}
	fs.sector_size = info.size;
	fs.sector_count = 3U;
	for (i = 0; i &amp;lt; MAX_ITERATIONS; i++) {
		rc = zms_mount(&amp;amp;fs);
		LOG_INF(&amp;quot;fs offset=%x&amp;quot;,fs.offset);
		if (rc) {
			LOG_INF(&amp;quot;Storage Init failed, rc=%d\n&amp;quot;, rc);
			return 0;
		}

		LOG_INF(&amp;quot;ITERATION: %u\n&amp;quot;, i);
		/* IP_ADDRESS_ID is used to store an address, lets see if we can
		 * read it from flash, since we don&amp;#39;t know the size read the
		 * maximum possible
		 */
		rc = zms_read(&amp;amp;fs, IP_ADDRESS_ID, &amp;amp;buf, sizeof(buf));
		if (rc &amp;gt; 0) {
			/* item was found, show it */
			buf[rc] = &amp;#39;\0&amp;#39;;
			LOG_INF(&amp;quot;ID: %u, IP Address: %s\n&amp;quot;, IP_ADDRESS_ID, buf);
		}
		/* Rewriting ADDRESS IP even if we found it */
		strncpy(buf, &amp;quot;172.16.254.1&amp;quot;, sizeof(buf) - 1);
		LOG_INF(&amp;quot;Adding IP_ADDRESS %s at id %u\n&amp;quot;, buf, IP_ADDRESS_ID);
		rc = zms_write(&amp;amp;fs, IP_ADDRESS_ID, &amp;amp;buf, strlen(buf));
		if (rc &amp;lt; 0) {
			LOG_INF(&amp;quot;Error while writing Entry rc=%d\n&amp;quot;, rc);
			break;
		}

		/* KEY_VALUE_ID is used to store a key/value pair , lets see if we can read
		 * it from storage.
		 */
		rc = zms_read(&amp;amp;fs, KEY_VALUE_ID, &amp;amp;key, sizeof(key));
		if (rc &amp;gt; 0) { /* item was found, show it */
			LOG_INF(&amp;quot;Id: %x, Key: &amp;quot;, KEY_VALUE_ID);
			for (uint8_t n = 0; n &amp;lt; 8; n++) {
				LOG_INF(&amp;quot;%x &amp;quot;, key[n]);
			}
			LOG_INF(&amp;quot;\n&amp;quot;);
		}
		/* Rewriting KEY_VALUE even if we found it */
		LOG_INF(&amp;quot;Adding key/value at id %x\n&amp;quot;, KEY_VALUE_ID);
		rc = zms_write(&amp;amp;fs, KEY_VALUE_ID, &amp;amp;key, sizeof(key));
		if (rc &amp;lt; 0) {
			LOG_INF(&amp;quot;Error while writing Entry rc=%d\n&amp;quot;, rc);
			break;
		}

		/* CNT_ID is used to store the loop counter, lets see
		 * if we can read it from storage
		 */
		rc = zms_read(&amp;amp;fs, CNT_ID, &amp;amp;i_cnt, sizeof(i_cnt));
		if (rc &amp;gt; 0) { /* item was found, show it */
			LOG_INF(&amp;quot;Id: %d, loop_cnt: %u\n&amp;quot;, CNT_ID, i_cnt);
			if (i_cnt != (i - 1)) {
				break;
			}
		}
		LOG_INF(&amp;quot;Adding counter at id %u\n&amp;quot;, CNT_ID);
		rc = zms_write(&amp;amp;fs, CNT_ID, &amp;amp;i, sizeof(i));
		if (rc &amp;lt; 0) {
			LOG_INF(&amp;quot;Error while writing Entry rc=%d\n&amp;quot;, rc);
			break;
		}

		/* LONG_DATA_ID is used to store a larger dataset ,lets see if we can read
		 * it from flash
		 */
		rc = zms_read(&amp;amp;fs, LONG_DATA_ID, &amp;amp;longarray, sizeof(longarray));
		if (rc &amp;gt; 0) {
			/* item was found, show it */
			LOG_INF(&amp;quot;Id: %d, Longarray: &amp;quot;, LONG_DATA_ID);
			for (uint16_t n = 0; n &amp;lt; sizeof(longarray); n++) {
				LOG_INF(&amp;quot;%x &amp;quot;, longarray[n]);
			}
			LOG_INF(&amp;quot;\n&amp;quot;);
		}
		/* Rewrite the entry even if we found it */
		LOG_INF(&amp;quot;Adding Longarray at id %d\n&amp;quot;, LONG_DATA_ID);
		rc = zms_write(&amp;amp;fs, LONG_DATA_ID, &amp;amp;longarray, sizeof(longarray));
		if (rc &amp;lt; 0) {
			LOG_INF(&amp;quot;Error while writing Entry rc=%d\n&amp;quot;, rc);
			break;
		}

		/* Each DELETE_ITERATION delete all basic items */
		if (!(i % DELETE_ITERATION) &amp;amp;&amp;amp; (i)) {
			rc = delete_basic_items(&amp;amp;fs);
			if (rc) {
				break;
			}
		}
	}

}


int main(void)
{
	int blink_status = 0;
	int err = 0;

	configure_gpio();

	err = uart_init();
	if (err) {
		error();
	}

	if (IS_ENABLED(CONFIG_BT_NUS_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;
		}
	}

	//setup_flash();
	zms_setting();

	err = bt_enable(NULL);
	if (err) {
		error();
	}

	LOG_INF(&amp;quot;Bluetooth initialized&amp;quot;);

	k_sem_give(&amp;amp;ble_init_ok);

	if (IS_ENABLED(CONFIG_SETTINGS)) {
		settings_load();
	}

	err = bt_nus_init(&amp;amp;nus_cb);
	if (err) {
		LOG_ERR(&amp;quot;Failed to initialize UART service (err: %d)&amp;quot;, err);
		return 0;
	}

	err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd,
			      ARRAY_SIZE(sd));
	if (err) {
		LOG_ERR(&amp;quot;Advertising failed to start (err %d)&amp;quot;, err);
		return 0;
	}

	for (;;) {
		dk_set_led(RUN_STATUS_LED, (++blink_status) % 2);
		k_sleep(K_MSEC(RUN_LED_BLINK_INTERVAL));
	}
}

void ble_write_thread(void)
{
	/* Don&amp;#39;t go any further until BLE is initialized */
	k_sem_take(&amp;amp;ble_init_ok, K_FOREVER);
	struct uart_data_t nus_data = {
		.len = 0,
	};

	for (;;) {
		/* Wait indefinitely for data to be sent over bluetooth */
		struct uart_data_t *buf = k_fifo_get(&amp;amp;fifo_uart_rx_data,
						     K_FOREVER);

		int plen = MIN(sizeof(nus_data.data) - nus_data.len, buf-&amp;gt;len);
		int loc = 0;

		while (plen &amp;gt; 0) {
			memcpy(&amp;amp;nus_data.data[nus_data.len], &amp;amp;buf-&amp;gt;data[loc], plen);
			nus_data.len += plen;
			loc += plen;

			if (nus_data.len &amp;gt;= sizeof(nus_data.data) ||
			   (nus_data.data[nus_data.len - 1] == &amp;#39;\n&amp;#39;) ||
			   (nus_data.data[nus_data.len - 1] == &amp;#39;\r&amp;#39;)) {
				if (bt_nus_send(NULL, nus_data.data, nus_data.len)) {
					LOG_WRN(&amp;quot;Failed to send data over BLE connection&amp;quot;);
				}
				nus_data.len = 0;
			}

			plen = MIN(sizeof(nus_data.data), buf-&amp;gt;len - loc);
		}

		k_free(buf);
	}
}

K_THREAD_DEFINE(ble_write_thread_id, STACKSIZE, ble_write_thread, NULL, NULL,
		NULL, PRIORITY, 0, 0);
&lt;/pre&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15 Zephry Flash init error -22</title><link>https://devzone.nordicsemi.com/thread/523830?ContentTypeID=1</link><pubDate>Thu, 20 Feb 2025 09:13:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0635446e-9400-470b-a24c-d7c1352a8dcf</guid><dc:creator>Emil Lenngren</dc:creator><description>&lt;p&gt;Thanks for the correction. I updated my reply.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15 Zephry Flash init error -22</title><link>https://devzone.nordicsemi.com/thread/523816?ContentTypeID=1</link><pubDate>Thu, 20 Feb 2025 07:48:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f10315de-8880-4364-9028-f1d5f3f3de37</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;That&amp;#39;s a very good point, Emil. NVS is compatible with RRAM, but it treats it as flash and introduces a lot more write/swap and general tear on the RRAM. As the link you sent states, ZMS reduces this: &lt;em&gt;&amp;quot;&lt;/em&gt;&lt;span&gt;&lt;em&gt;&amp;nbsp;reduces write and erase cycles, extending the lifespan of non-volatile memory.&lt;/em&gt;&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kind regards,&lt;br /&gt;Andreas&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15 Zephry Flash init error -22</title><link>https://devzone.nordicsemi.com/thread/523764?ContentTypeID=1</link><pubDate>Wed, 19 Feb 2025 18:04:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b13908d3-aebb-4d15-90d0-183f8949eed8</guid><dc:creator>Emil Lenngren</dc:creator><description>&lt;p&gt;Note that nRF54L15 does not have any flash. Instead it has RRAM. NVS is designed for flash and comes with a penalty if you use it for RRAM. You can use ZMS instead as a replacement, see&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.9.0/page/nrf/app_dev/device_guides/nrf54l/zms.html"&gt;docs.nordicsemi.com/.../zms.html&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15 Zephry Flash init error -22</title><link>https://devzone.nordicsemi.com/thread/523732?ContentTypeID=1</link><pubDate>Wed, 19 Feb 2025 14:29:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c439cd6f-fc21-4a16-93bb-bb220f4462ba</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Just to be sure, are you able to set up a sample without BLE that uses the LittleFS partition on the nRF54L15? Both BLE and the NVS sample sets up a settings partition that it seems to be a conflict with. If you could isolate that you&amp;#39;re getting either setups to work, that would be much appreciated.&lt;/p&gt;
&lt;p&gt;I would also recommend that you in the future attach code and/or logs as a insert -&amp;gt; code&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/pastedimage1739975346843v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>