NVS: External flash on nRF52840dk is not getting configured correctly

Hello Nordic team,

I am trying to use external flash on nRF52840dk using Qspi.

 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// To get started, press Ctrl+Space (or Option+Esc) to bring up the completion menu and view the available nodes.
// You can also use the buttons in the sidebar to perform actions on nodes.
// Actions currently available include:
// * Enabling / disabling the node
// * Adding the bus to a bus
// * Removing the node
// * Connecting ADC channels
// For more help, browse the DeviceTree documentation at https://docs.zephyrproject.org/latest/guides/dts/index.html
// You can also visit the nRF DeviceTree extension documentation at https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/guides/ncs_configure_app.html#devicetree-support-in-the-extension
/ {
zephyr,user {
io-channels = <&adc 0>, <&adc 1>;
pulsemon-gpios = <&gpio0 30 0>;
readsw-gpios = <&gpio0 31 0>;
tamper-gpios = <&gpio0 24 0>;
digitalip1-gpios = <&gpio0 25 0>;
digitalop1-gpios = <&gpio0 26 0>;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Above is my overlay file.

Fullscreen
1
2
3
4
sensor_data_ex_partition:
address: 0x0
region: external_flash
size: 0x800000
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Above is my pm_static file.

I am using custom board where I have define the details for external flash.

Below is my proj_minimal.conf file

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Copyright (c) 2021 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
# Enable the UART driver
CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UARTE0=y
CONFIG_SERIAL=y
CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_NRFX_TIMER0=y
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Flow meter"
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <zephyr/storage/flash_map.h>
#include <zephyr/fs/nvs.h>
#include <zephyr/logging/log.h>
#include <zephyr/drivers/flash.h>
#define NVS_PARTITION sensor_data_ex_partition
#define NVS_PARTITION_DEVICE FIXED_PARTITION_DEVICE(NVS_PARTITION)
#define NVS_PARTITION_OFFSET FIXED_PARTITION_OFFSET(NVS_PARTITION)
#define NVS_PARTITION_SIZE FIXED_PARTITION_SIZE(NVS_PARTITION)
/* NVS file system structure */
static struct nvs_fs fs;
/* Initialize NVS */
int init_nvs()
{
int rc;
struct flash_pages_info info;
/* Define the NVS storage area */
fs.flash_device = NVS_PARTITION_DEVICE;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I am getting below error when I use it in my init_nvs_function (attached above):

Can you tell me where I am doing wrong?

Thanks for your support.

Chinmay