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.

Parents
  • Hello,

    As far as I can see you don't need the following in your static partitioning to set up the external flash

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

    Your overlay file where you set the chosen external flash and in the board files handles this. CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL sets up the littlefs partition on the external partition and you specify that it should be a static size by setting it up in your pm_static.yml

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

    Let me know if this works out for you,

    Kind regards,
    Andreas

  • I removed the external flash partition in the pm_static.yml file and retained only the littlefs_storage partition but I still get Storage device is NULL

Reply Children
No Data
Related