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
  • Hi Simon,

    I don't have a DK, we developed on a SparkFun Thing Plus nrf9160, however modifying the sample you gave for my board yielded the same results. No boot, and the debugger dying after a call to FIH_CALL(tfm_core_init, fih_rc);

    Applying partition manager to my project and adjusting for the 128MBit size doesn't seem to make partition manager happy. Honestly memory addresses and stuff like that confuse me a little, so I may have missed something.

    nvs_storage:
      address: 0x00000
      device: W25Q128JV
      region: external_flash
      size: 0x7F00000
    external_flash:
      address: 0x0
      end_address: 0x8000000
      region: external_flash
      size: 0x8000000
    

    I would posit that it appears there is nothing wrong with my devicetree spec or hardware layout, as I have been experimenting with nanopb and raw read/write to flash with no issues, although it's entirely possible it's something in there. I notice that the DK version has a definition for sfdp-bfp which I don't really know how to get out of the device and I'm not 100% on the JEDEC ID for my particular chip, only following what others have done online. The other thing that is different is I am using pinctrl and have dpd disabled; changing either does not resolve the issue.

    I think static partition definition will be easier, but does not solve the problem of  the OS not booting regardless of where the partition is placed with either CONFIG_NVS or CONFIG_FILE_SYSTEM_LITTLEFS enabled.

Reply
  • Hi Simon,

    I don't have a DK, we developed on a SparkFun Thing Plus nrf9160, however modifying the sample you gave for my board yielded the same results. No boot, and the debugger dying after a call to FIH_CALL(tfm_core_init, fih_rc);

    Applying partition manager to my project and adjusting for the 128MBit size doesn't seem to make partition manager happy. Honestly memory addresses and stuff like that confuse me a little, so I may have missed something.

    nvs_storage:
      address: 0x00000
      device: W25Q128JV
      region: external_flash
      size: 0x7F00000
    external_flash:
      address: 0x0
      end_address: 0x8000000
      region: external_flash
      size: 0x8000000
    

    I would posit that it appears there is nothing wrong with my devicetree spec or hardware layout, as I have been experimenting with nanopb and raw read/write to flash with no issues, although it's entirely possible it's something in there. I notice that the DK version has a definition for sfdp-bfp which I don't really know how to get out of the device and I'm not 100% on the JEDEC ID for my particular chip, only following what others have done online. The other thing that is different is I am using pinctrl and have dpd disabled; changing either does not resolve the issue.

    I think static partition definition will be easier, but does not solve the problem of  the OS not booting regardless of where the partition is placed with either CONFIG_NVS or CONFIG_FILE_SYSTEM_LITTLEFS enabled.

Children
No Data
Related