Hello
I am using the nRF9160-DK and I would like to access the external flash memory (mx25r6435f), as a FAT format file system. To do that I have made a 'test project' to access the file system from the SHELL, as a starting point.
I can access the flash memory successfully using the flash command in the shell, as you can see in the following picture.
But when I try to mount the filesystem it gives me the error code -5, as you can see in the next picture.
The project code:
main.c
#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(app); int main(void) { return 0; }
prj.conf
CONFIG_FLASH=y CONFIG_LOG=y CONFIG_FS_LOG_LEVEL_DBG=y CONFIG_FLASH_LOG_LEVEL_DBG=y CONFIG_HEAP_MEM_POOL_SIZE=16384 CONFIG_SHELL=y CONFIG_SHELL_LOG_LEVEL_INF=y CONFIG_FILE_SYSTEM=y CONFIG_FILE_SYSTEM_SHELL=y CONFIG_FILE_SYSTEM_SHELL_TEST_COMMANDS=y CONFIG_FAT_FILESYSTEM_ELM=y CONFIG_FLASH_MAP=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_MPU_ALLOW_FLASH_WRITE=y CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y
nrf9160dk_nrf9160_ns.dts
/dts-v1/; #include <nordic/nrf9160ns_sica.dtsi> #include "nrf9160dk_nrf9160_common.dtsi" #include "nrf9160dk_nrf9160_common_0_14_0.dtsi" /delete-node/ &storage_partition; &spi3 { cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>, /* D10 */ <&gpio0 25 GPIO_ACTIVE_LOW>; mx25r64: mx25r6435f@1 { compatible = "jedec,spi-nor"; reg = <1>; status = "okay"; spi-max-frequency = <8000000>; jedec-id = [c2 28 17]; sfdp-bfp = [ e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44 30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff ]; size = <67108864>; mxicy,mx25r-power-mode = "high-performance"; }; }; &mx25r64 { partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; storage_partition: partition@0 { label = "storage"; reg = <0x00000000 0x08000000>; }; }; }; / { aliases { ext-flash = &mx25r64; }; chosen { nordic,pm-ext-flash = &mx25r64; zephyr,flash = &flash0; zephyr,sram = &sram0_ns; zephyr,code-partition = &slot0_ns_partition; }; msc_disk0 { compatible = "zephyr,flash-disk"; partition = <&storage_partition>; disk-name = "NAND"; cache-size = <4096>; }; }; /* Disable UART1, because it is used by default in TF-M */ &uart1 { status = "disabled"; };
nrf9160dk_nrf9160_ns.overlay
&mx25r64 { status = "okay"; };
CMakeLists.txt
cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(flash_test) target_sources(app PRIVATE src/main.c)
To build the project I am using the nrf9160dk_nrf9160_ns Board with the nRFConnect SDK v2.5.1
Is there something wrong in the configuration files? I can not figure out why it does not mount the device.
Thank you