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.

  • Hello, 

    Sorry, DevZone has been somewhat challenging the last days and my answer was for some reason not sent. 

    There should be support for it, but I have no examples at the moment. You should be able to configure this through the .dts file and then access it as normal.

    Kind regards,
    Øyvind

  • Thanks for replying.

    First of all, it's good to hear that it is possible. I have some specific requirements for the use of a different NOR Flash. In case I can't know the jedec-id at all, up to the point where the device is already deployed, is there a way to determine it at runtime? Or make it accept any jedec-id?

  • 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.
  • 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

Related