No boot with CONFIG_NVS or LITTLEFS enabled

Hi,

I am trying to implement external flash storage onto my custom board, featuring an nrf9160-SICA-B1 and a Winbound w25q128jv 128Mbit flash chip on SPI3 (I cannot get QSPI to work in devicetree).

I am able to successfully read the entire flash chip through a small test script using the base flash_read APIs, however as soon as I enable either CONFIG_NVS or CONFIG_FILE_SYSTEM_LITTLEFS the board no longer boots, and debugging has only gotten me so far with an exception handler break somewhere inside TFM. I am unsure on how to debug this further, or what the root cause is. It's not clear what exactly breaks, as I don't even need to implement anything in my storage module (remove from cmake) and the board will still refuse to boot (or at least output to UART) so I assume something is wrong inside the TFM side of things.

Stepping through with the debugger it never gets past FIH_CALL(tfm_core_init, fih_rc);

It also appears that the partitions are not being placed into the external flash as I would expect, just looking at the partition yaml file. I tried static partition config but that also didn't help, and I am unsure on how to proceed for that as the documentation is unclear.

My end goal, is to have 16MB (128MBit) of flash memory available to either littlefs or NVS for storing persistent data offline while waiting for LTE to sync.

SPI3 Definition:

&spi3 {
  label = "SPI3";
  compatible = "nordic,nrf-spim";
  status = "okay";
  cs-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
  pinctrl-0 = <&spi3_default>;
  pinctrl-1 = <&spi3_sleep>;
  pinctrl-names = "default", "sleep";
  w25q128jv: w25q128jv@0 {
    compatible = "jedec,spi-nor";
    label = "W25Q128JV_SPI";
    reg = <0x0>;
    spi-max-frequency = <80000000>;
    wp-gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
    hold-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
    size = <DT_SIZE_M(16)>;
    // has-dpd;
    // t-enter-dpd = <4000>;
    // t-exit-dpd = <25000>;
    jedec-id = [ ef 40 18  ];
  };
};

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

};

Partition Definition:

/delete-node/ &storage_partition;

&w25q128jv {
  partitions {
    compatible = "fixed-partitions";
    #address-cells = <1>;
    #size-cells = <1>;
    partition@0 {
      label = "storage";
      reg = <0x0 DT_SIZE_M(16)>;
    };
  };
};

My prj.conf

#### Flash Storage ####
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_NORDIC_QSPI_NOR=n

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FILE_SYSTEM=y
CONFIG_FS_LOG_LEVEL_DBG=y

# Uncommenting either of these causes the board to not run
# CONFIG_FILE_SYSTEM_LITTLEFS=y
# CONFIG_NVS=y

Happy to provide more debugging information as necessary, just not sure what to include. I may be missing something.

Parents
  • Small update. I was able to compile the application an flash it with successful boot with a hardcoded region size of 0x200000 (2MB), which is not ideal realy but will do for now. My flash chip is 16MB. I have yet to test if NVS actually stores data on the SPI flash or not but for now at least the board boots.


    It seems somewhere external_flash is hardcoded to be 0x200000 and I can't really find where to change that, as the pm_static.yml file does not override the region size only the partition size.

    The size parameter in regions.yaml doesn't seem to be able to be over 2MB.

     

    nvs_storage:
      address: 0x0
      device: W25Q128JV
      region: external_flash
      size: 0x200000
    external_flash:
      address: 0x0
      end_address: 0x200000
      region: external_flash
      size: 0x200000
    

Reply
  • Small update. I was able to compile the application an flash it with successful boot with a hardcoded region size of 0x200000 (2MB), which is not ideal realy but will do for now. My flash chip is 16MB. I have yet to test if NVS actually stores data on the SPI flash or not but for now at least the board boots.


    It seems somewhere external_flash is hardcoded to be 0x200000 and I can't really find where to change that, as the pm_static.yml file does not override the region size only the partition size.

    The size parameter in regions.yaml doesn't seem to be able to be over 2MB.

     

    nvs_storage:
      address: 0x0
      device: W25Q128JV
      region: external_flash
      size: 0x200000
    external_flash:
      address: 0x0
      end_address: 0x200000
      region: external_flash
      size: 0x200000
    

Children
No Data
Related