Working with different NOR Flash jedec-id on same dts

Hello,

I'm using nor flash with qspi as an external storage.

I'm facing problem where i can have different NOR Flash chips (with different jedec-id).
Is there a way to make the qspi driver work without giving it specific jedec-id?

Thanks.

Parents Reply
  • Can you please test with setting CONFIG_SPI_NOR_SFDP_RUNTIME=y in your prj.conf

    From zephyr\drivers\flash\Kconfig.nor
    config SPI_NOR_SFDP_RUNTIME
        bool "Read flash parameters at runtime"
        help
            Read all flash device characteristics from the device at runtime.
            This option is the most flexible as it should provide functionality
            for all supported JESD216-compatible devices.
    This might be a solution to determine during runtime.
Children
  • this config should work for qspi usage?

    assuming that this will fit qspi - I don't get how the change in config let me control it from the code to not return an error of the wrong jedec-id. (and preferably to detect the jedec-id and use it)

    To make it more clear - this is how i use it now:

    dts

    &qspi {
        status = "okay";
        pinctrl-0 = <&qspi_default>;
        pinctrl-1 = <&qspi_sleep>;
        pinctrl-names = "default", "sleep";
        mynorflash: mynorflash@0 {
            compatible = "nordic,qspi-nor";
            reg = <0>;
            sck-frequency = <16000000>;
            jedec-id = [some ID];
            size = <33554432>;
            has-dpd;
            t-enter-dpd = <3000>;
            t-exit-dpd = <5000>;
            quad-enable-requirements = "S2B1v1";
            writeoc = "pp4o";
            readoc = "read4io";
        };
    };


    sysbuild.conf
    SB_CONFIG_BOOTLOADER_MCUBOOT=y
    SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
    SB_CONFIG_SECURE_BOOT_APPCORE=y


    when uploading the code to a board with different nor flash manufacturer, the program can't start because the jedec-id is wrong (prompted with ERROR LOG).

    How does the config you refer me to will help to solve this problem?

  • My apologies, as mentioned we do not have any samples of this in our SDK, so this is a little hit and miss to find the correct setting.

    Could you try adding CONFIG_FLASH_JESD216_API=y

    From zephyr\drivers\flash\Kconfig it states 

    config FLASH_JESD216_API
    	bool "Provide API to read JESD216 flash parameters"
    	depends on FLASH_JESD216
    	help
    	  This option extends the Zephyr flash API with the ability
    	  to access the Serial Flash Discoverable Parameter section
    	  allowing runtime determination of serial flash parameters
    	  for flash drivers that expose this capability.

    There is also a driver sample that could be helpful : JESD216 sample in the Zephyr repo

  • adding CONFIG_FLASH_JESD216_API=y and using the sample you provide did compiled and i was able to run it.

    it printed the correct parameters of the nor flash, but, and it is very important - it worked because my dts jedec-id was correct.

    means that when i will face the situation where for any reason i dont know my jedec-id and it is hard coded in the dts, i wont be able to start my program to even recognize the new jedec-id.

Related