Unable to access mx25r64 partition using partition manager on sdk 2.9.0

I am trying to create a partition on mx25r64 using partition manager on my nrf52840dk.
Below is my overlay file

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

Below is my prj.conf file

CONFIG_FLASH=y 
CONFIG_FILE_SYSTEM=y  
CONFIG_FILE_SYSTEM_LITTLEFS=y 
CONFIG_FS_LITTLEFS_FMP_DEV=y 
CONFIG_FLASH_MAP=y 
CONFIG_PARTITION_MANAGER_ENABLED=y
CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL=y

Below is my pm_static.yml file

external_flash:
  address: 0x00000000
  end_address: 0x007F0000
  region: external_flash
  size: 0x007F0000


littlefs_storage:
  address: 0x00000000
  device: mx25r64
  region: external_flash
  size: 0x007F0000

below is my main.c file. when i run it i keep getting the error storage device is null. meaning the flash cannot be located.

#define LFS_PARTITION FLASH_AREA_ID(littlefs_storage) 
#define LFS_STORAGE_DEV FLASH_AREA_DEVICE(LFS_PARTITION)

static struct fs_littlefs fs_config;
FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(fs_config);

static struct fs_mount_t lfs_mounted = {
    .type = FS_LITTLEFS,
    .mnt_point = "/lfs",            
    .fs_data = &fs_config,          
    .storage_dev = (void *)LFS_STORAGE_DEV, 
};

int main()
{
        const struct device *dev = lfs_mounted.storage_dev;
        if (!dev)
        {
                printk("Storage device is NULL\n");
                return -1;
        }

        printk("Device name: %s\n", dev->name);
}

Kindly assist me in identifying which configurations would i have missed that would be causing this issue.

Related