nRF54L15 DK QSPI external flash with FAT filesystem

Hi, I am trying to use the external flash on the nRF54L15 DK with QSPI to perform the zephyr/samples/subsys/fs/fs_sample sample.

I am using NCS v3.1.0 (on Windows if that matters). I used the nrf/samples/zephyr/subsys/jesd216 and nrf/samples/zephyr/subsys/spi_flash samples to check that sQSPI communication was working properly, but I have trouble with implementing the filesystem on the external flash.

Here are the modifications I applied to the fs_sample sample :

fs_sample/boards/nrf54l15dk_nrf54l15_cpuapp.overlay

/*
 * Copyright (c) 2024 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/* Because FAT FS needs at least 64kiB partition and default
 * storage_partition is 36kiB for this board, we need to reorganize
 * partitions to get at least 64KiB.
 */
/delete-node/ &storage_partition;

&pinctrl {
	sqspi_default: sqspi_default {
		group1 {
			psels = <NRF_PSEL(SDP_MSPI_SCK, 2, 1)>,
				<NRF_PSEL(SDP_MSPI_CS0, 2, 5)>,
				<NRF_PSEL(SDP_MSPI_DQ0, 2, 2)>;
			nordic,drive-mode = <NRF_DRIVE_E0E1>;
		};
		group2 {
			psels = <NRF_PSEL(SDP_MSPI_DQ1, 2, 4)>,
				<NRF_PSEL(SDP_MSPI_DQ2, 2, 3)>,
				<NRF_PSEL(SDP_MSPI_DQ3, 2, 0)>;
			nordic,drive-mode = <NRF_DRIVE_E0E1>;
			bias-pull-up;
		};
	};

	sqspi_sleep: sqspi_sleep {
		group1 {
			low-power-enable;
			psels = <NRF_PSEL(SDP_MSPI_SCK, 2, 1)>,
				<NRF_PSEL(SDP_MSPI_CS0, 2, 5)>,
				<NRF_PSEL(SDP_MSPI_DQ0, 2, 2)>,
				<NRF_PSEL(SDP_MSPI_DQ1, 2, 4)>,
				<NRF_PSEL(SDP_MSPI_DQ2, 2, 3)>,
				<NRF_PSEL(SDP_MSPI_DQ3, 2, 0)>;
		};
	};
};

&cpuflpr_vpr {
	pinctrl-0 = <&sqspi_default>;
	pinctrl-1 = <&sqspi_sleep>;
	pinctrl-names = "default", "sleep";
	interrupts = <76 NRF_DEFAULT_IRQ_PRIORITY>;
	status = "okay";
};

/ {
	chosen {
		nordic,pm-ext-flash = &mx25r64;
	};

	reserved-memory {
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;

		softperipheral_ram: memory@2003c000 {
			reg = <0x2003c000 0x4000>;
			ranges = <0 0x2003c000 0x4000>;
			#address-cells = <1>;
			#size-cells = <1>;

			sqspi: sqspi@3b40 {
				compatible = "nordic,nrf-sqspi";
				#address-cells = <1>;
				#size-cells = <0>;
				reg = <0x3b40 0x200>;
				status = "okay";
				zephyr,pm-device-runtime-auto;
			};
		};
	};

	msc_disk0 {
		status="okay";
		compatible = "zephyr,flash-disk";
		partition = <&storage_partition>;
		disk-name = "SD";
		cache-size = <65536>;
	};
};

/delete-node/ &mx25r64;

&sqspi {
	mx25r64: mx25r6435f@0 {
		compatible = "mxicy,mx25r", "jedec,mspi-nor";
		status = "okay";
		reg = <0>;
		jedec-id = [c2 28 17];
		quad-enable-requirements = "S1B6";
		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>;
		has-dpd;
		t-enter-dpd = <10000>;
		t-exit-dpd = <35000>;
		t-reset-pulse = <10000>;
		t-reset-recovery = <35000>;

		mspi-max-frequency = <DT_FREQ_M(8)>;
		mspi-io-mode = "MSPI_IO_MODE_QUAD_1_4_4";
		mspi-data-rate = "MSPI_DATA_RATE_SINGLE";
		mspi-hardware-ce-num = <1>;
		mspi-cpp-mode = "MSPI_CPP_MODE_0";
		mspi-endian = "MSPI_BIG_ENDIAN";
		mspi-ce-polarity = "MSPI_CE_ACTIVE_LOW";

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			// Warning: check the partition adress/size in pm_static.yml.
			storage_partition: partition@0 {
				label = "storage";
				reg = <0x0 DT_SIZE_K(128)>;
			};
		};
	};
};

I also added a pm_static.yml file to put the storage partition in the external flash:

storage_partition:
  address: 0x0
  end_address: 0x20000
  affiliation:
  - disk
  extra_params:
    disk_cache_size: 0x10000
    disk_name: SD
    disk_read_only: 0x0
    disk_sector_size: 0x200
  region: external_flash
  size: 0x20000

When I flash the sample to the board, I get the following error:

*** Booting nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
[00:34:26.877,190] <err> flashdisk: Flash area 1 open error -2
[00:34:26.877,194] <err> main: Storage init ERROR!
[00:34:26.877,209] <err> flashdisk: Flash area 1 open error -2
[00:34:26.877,216] <err> fs: fs mount error (-5)
Error mounting disk.
[00:34:26.877,236] <err> fs: fs not mounted (mp == 0x200000d0)

I also tried to disable the partition manager by adding SB_CONFIG_PARTITION_MANAGER=n to sysbuild.conf. In this case, I ge the following errors:

*** Booting nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
[00:29:09.722,697] <inf> flashdisk: Initialize device SD
--- 227 messages dropped ---
[00:29:09.738,709] <err> flash_mspi_nor: Read xfer failed: -5
[00:29:09.738,761] <err> mspi_sqspi: nrf_sqspi_xfer() failed: 0bad000b
[00:29:09.738,776] <err> flash_mspi_nor: perform_xfer: transceive() failed: -5
[00:29:09.738,786] <err> flash_mspi_nor: Read xfer failed: -5
[00:29:09.738,838] <err> mspi_sqspi: nrf_sqspi_xfer() failed: 0bad000b
[00:29:09.738,853] <err> flash_mspi_nor: perform_xfer: transceive() failed: -5
[00:29:09.738,863] <err> flash_mspi_nor: Read xfer failed: -5
[00:29:09.738,915] <err> mspi_sqspi: nrf_sqspi_xfer() failed: 0bad000b
[00:29:09.738,930] <err> flash_mspi_nor: perform_xfer: transceive() failed: -5
[00:29:09.738,940] <err> flash_mspi_nor: Read xfer failed: -5
[00:29:09.738,992] <err> mspi_sqspi: nrf_sqspi_xfer() failed: 0bad000b
[00:29:09.739,007] <err> flash_mspi_nor: perform_xfer: transceive() failed: -5
[00:29:09.739,017] <err> flash_mspi_nor: Read xfer failed: -5
[00:29:09.739,069] <err> mspi_sqspi: nrf_sqspi_xfer() failed: 0bad000b
[00:29:09.739,084] <err> flash_mspi_nor: perform_xfer: transceive() failed: -5
[00:29:09.739,094] <err> flash_mspi_nor: Read xfer failed: -5
[00:29:09.739,146] <err> mspi_sqspi: nrf_sqspi_xfer() failed: 0bad000b
[00:29:09.739,161] <err> flash_mspi_nor: perform_xfer: transceive() failed: -5
[00:29:09.739,171] <err> flash_mspi_nor: Read xfer failed: -5
[00:29:09.739,226] <err> mspi_sqspi: nrf_sqspi_xfer() failed: 0bad000b
[00:29:09.739,244] <err> flash_mspi_nor: Read xfer failed: -5
[00:29:09.740,799] <err> mspi_sqspi: nrf_sqspi_xfer() failed: 0bad000b
[00:29:09.740,815] <err> flash_mspi_nor: perform_xfer: transceive() failed: -5
[00:29:09.740,828] <err> flash_mspi_nor: cmd_wren failed: -5
[00:29:09.740,852] <err> mspi_sqspi: nrf_sqspi_xfer() failed: 0bad000b
[00:29:09.740,866] <err> flash_mspi_nor: perform_xfer: transceive() failed: -5
[00:29:09.740,878] <err> flash_mspi_nor: cmd_wren failed: -5
[00:29:09.740,926] <err> fs: fs mount error (-19)
Error mounting disk.
[00:29:09.740,950] <err> fs: fs not mounted (mp == 0x200000d0)

Is this sample supported by the sQSPI peripheral ? It seems to be working when not using sQSPI.

Best regards,

Nicolas Goualard

Related