Get "SPI_NOR_FLASH_LAYOUT_PAGE_SIZE incompatible with flash size" error

Hi,

I am working on a project which has external flash (FM25V01A ) connected to nrf52832 board over SPI. And when building the project, I am getting the following error:

In the overlay file when I put the memory size  above few megabyte or Gigabyte, then the program run perfectly. However, when I try to put the actual size of the memory, which is (0x00004000) then I got the above error.  My overlay file is given below

/delete-node/ &storage_partition;


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

/ {
	fstab {
		compatible = "zephyr,fstab";
		lfs1: lfs1 {
			compatible = "zephyr,fstab,littlefs";
			mount-point = "/lfs1";
			partition = <&lfs1_part>;
			automount;
			read-size = <16>;
			prog-size = <16>;
			cache-size = <64>;
			lookahead-size = <32>;
			block-cycles = <512>;
		};
	};
};

&spi2 {
    compatible = "nordic,nrf-spi";
    status = "okay";
    pinctrl-0 = <&spi2_default>;
    pinctrl-1 = <&spi2_sleep>;
    pinctrl-names = "default", "sleep";
    cs-gpios = <&gpio0 22 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;   
    FM25V01A:  FM25V01A@0 {
        compatible = "jedec,spi-nor";
        status = "okay";
        label = "25V01A";
        reg = <0>;
        spi-max-frequency = <8000000>; /* Adjust based on your flash specifications */
        size = <0x0004000>; /* Adjust based on your flash size */
        //has-dpd;
       // t-enter-dpd = <3000>;
       // t-exit-dpd = <30000>;
        jedec-id = [ c2 22 10 ]; /* Adjust based on your flash JEDEC ID */
        };
    };

&pinctrl {
    spi2_default: spi2_default {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 25)>, /* gpio 0 pin P0.25 */
                    <NRF_PSEL(SPIM_MISO, 0, 24)>, /* gpio 0 pin P0.24 */
                    <NRF_PSEL(SPIM_MOSI, 0, 23)>; /* gpio 0 pin P0.23 */
        };
    };

    spi2_sleep: spi2_sleep {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 25)>, /* gpio 0 pin P0.25 */
                    <NRF_PSEL(SPIM_MISO, 0, 24)>, /* gpio 0 pin P0.24 */
                    <NRF_PSEL(SPIM_MOSI, 0, 23)>; /* gpio 0 pin P0.23 */
        };
    };
};


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

		lfs1_part: partition@0 {
			label = "storage";
			reg = <0x00000000 0x00004000>;
		};
	};
};

&i2c0 {
	status = "disabled";
};
&i2c1 {
	status = "disabled";
};
&spi1 {
	status = "disabled";
};
&spi0 {
	status = "disabled";
};

&uart0 {
	status = "disabled";
};
&flash0{
    status = "disabled";
};
&led0 {
	status = "disabled";
};
&led1 {
	status = "disabled";
};
&led2 {
	status = "disabled";
};
&led3 {
	status = "disabled";
};
&pwm_led0 {
	status = "disabled";
};
&button0 {
	status = "disabled";
};
&button1 {
	status = "disabled";
};
&button2 {
	status = "disabled";
};
&button3 {
	status = "disabled";
};
/*
&arduino_header {
	status = "disabled";
};
*/

I am also adding my prj file below.

CONFIG_SPI=y
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_FLASH_PAGE_LAYOUT=y

# Let __ASSERT do its job
CONFIG_DEBUG=y

CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y

CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y

Related