Hello Nordic team,
I am trying to use external flash on nRF52840dk using Qspi.
// 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>; digitalop2-gpios = <&gpio0 27 0>; digitalop3-gpios = <&gpio0 28 0>; digitalop4-gpios = <&gpio0 29 0>; }; // leds { // led4 { // status = "disabled"; // }; // led2 { // status = "disabled"; // }; // led3 { // status = "disabled"; // }; // }; }; &adc { #address-cells = <1>; #size-cells = <0>; status = "okay"; channel@0 { reg = <0>; zephyr,gain = "ADC_GAIN_1_6"; zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>; zephyr,input-positive = <NRF_SAADC_VDD>; zephyr,resolution = <12>; }; channel@1 { reg = <1>; zephyr,gain = "ADC_GAIN_1_5"; zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>; zephyr,input-positive = <NRF_SAADC_AIN1>; zephyr,resolution = <12>; }; }; / { chosen { nordic,pm-ext-flash = &mx25r64; }; };
Above is my overlay file.
sensor_data_ex_partition: address: 0x0 region: external_flash size: 0x800000
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
# # 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 CONFIG_BT_USER_PHY_UPDATE=y CONFIG_BT_USER_DATA_LEN_UPDATE=y CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 CONFIG_BT_BUF_ACL_RX_SIZE=251 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_L2CAP_TX_MTU=247 CONFIG_BT_GATT_CLIENT=y # 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 # Enable DK LED and Buttons library CONFIG_DK_LIBRARY=y # Drivers and peripherals CONFIG_I2C=n CONFIG_WATCHDOG=n CONFIG_SPI=n CONFIG_GPIO=y # Power management # Interrupts CONFIG_DYNAMIC_INTERRUPTS=n CONFIG_IRQ_OFFLOAD=n # Memory protection CONFIG_THREAD_STACK_INFO=n CONFIG_THREAD_CUSTOM_DATA=n CONFIG_FPU=y # Boot CONFIG_NCS_BOOT_BANNER=n CONFIG_BOOT_BANNER=n CONFIG_BOOT_DELAY=0 # Console CONFIG_CONSOLE=n CONFIG_UART_CONSOLE=n CONFIG_STDOUT_CONSOLE=n CONFIG_PRINTK=y CONFIG_EARLY_CONSOLE=n # Build CONFIG_SIZE_OPTIMIZATIONS=y # ARM CONFIG_ARM_MPU=n # In order to correctly tune the stack sizes for the threads the following # Configurations can enabled to print the current use: #CONFIG_THREAD_NAME=y #CONFIG_THREAD_ANALYZER=y #CONFIG_THREAD_ANALYZER_AUTO=y #CONFIG_THREAD_ANALYZER_RUN_UNLOCKED=y #CONFIG_THREAD_ANALYZER_USE_PRINTK=y #CONFIG_CONSOLE=y #CONFIG_UART_CONSOLE=y #CONFIG_SERIAL=y #CONFIG_PRINTK=y # Example output of thread analyzer #SDC RX : unused 800 usage 224 / 1024 (21 %) #BT ECC : unused 216 usage 888 / 1104 (80 %) #BT RX : unused 1736 usage 464 / 2200 (21 %) #BT TX : unused 1008 usage 528 / 1536 (34 %) #ble_write_thread_id : unused 688 usage 336 / 1024 (32 %) #sysworkq : unused 1912 usage 136 / 2048 (6 %) #MPSL signal : unused 928 usage 96 / 1024 (9 %) #idle 00 : unused 224 usage 96 / 320 (30 %) #main : unused 568 usage 456 / 1024 (44 %) CONFIG_BT_RX_STACK_SIZE=2048 CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y CONFIG_BT_HCI_TX_STACK_SIZE=640 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 CONFIG_MPSL_WORK_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=864 CONFIG_IDLE_STACK_SIZE=128 CONFIG_ISR_STACK_SIZE=1024 CONFIG_BT_NUS_THREAD_STACK_SIZE=512 # Disable features not needed CONFIG_TIMESLICING=n CONFIG_COMMON_LIBC_MALLOC=n CONFIG_ASSERT=n # Disable Bluetooth features not needed CONFIG_BT_DEBUG_NONE=y CONFIG_BT_ASSERT=n CONFIG_BT_DATA_LEN_UPDATE=y CONFIG_BT_GATT_CACHING=n CONFIG_BT_GATT_SERVICE_CHANGED=n CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=y CONFIG_BT_SETTINGS_CCC_LAZY_LOADING=y CONFIG_BT_HCI_VS=n # Disable Bluetooth controller features not needed CONFIG_BT_CTLR_PRIVACY=n CONFIG_BT_CTLR_PHY_2M=n # Reduce Bluetooth buffers CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT=1 CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=43 CONFIG_BT_BUF_EVT_RX_COUNT=2 CONFIG_BT_CONN_TX_MAX=3 CONFIG_BT_L2CAP_TX_BUF_COUNT=2 CONFIG_BT_ATT_TX_COUNT=2 CONFIG_BT_BUF_ACL_TX_COUNT=3 CONFIG_BT_BUF_ACL_TX_SIZE=27 #Config logger CONFIG_LOG=y CONFIG_USE_SEGGER_RTT=y CONFIG_LOG_BACKEND_RTT=y CONFIG_LOG_BACKEND_UART=y CONFIG_LOG_PRINTK=y CONFIG_LOG_BUFFER_SIZE=10240 #nvs CONFIG_FLASH=y CONFIG_NVS=y #ADC CONFIG_ADC=y #I2C CONFIG_I2C=y # CONFIG_TIMESLICING=y # CONFIG_TIMESLICE_SIZE=10 # CONFIG_TIMESLICE_PRIORITY=0 CONFIG_SPI=y CONFIG_SPI_NOR=y CONFIG_LOG_MODE_IMMEDIATE=y CONFIG_NVS_LOG_LEVEL_DBG=y CONFIG_REBOOT=y CONFIG_MPU_ALLOW_FLASH_WRITE=y
#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; fs.offset = NVS_PARTITION_OFFSET; if (!device_is_ready(fs.flash_device)) { printk("Flash device %s is not ready\n", fs.flash_device->name); return 0; } /* Set NVS storage offset */ rc = flash_get_page_info_by_offs(fs.flash_device, fs.offset, &info); if (rc) { printk("Unable to get page info, rc=%d\n", rc); return 0; } fs.sector_size = info.size; fs.sector_count = NVS_PARTITION_SIZE / fs.sector_size; rc = nvs_mount(&fs); if (rc) { LOG_ERR("Failed to mount NVS, error: %d", rc); return rc; } LOG_INF("NVS initialized successfully"); }
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