Hi folks,
I’m trying to get CONFIG_SPI_NOR_SFDP_RUNTIME to work on my board with S25FL127S dataflash. The SFDP header and parameter headers are read according to datasheet, but when it comes to actual parameter blocks I always read the 0xFF in whole area.
I did try to mitigate the problem using sfdp-bfp in devicetree (so with CONFIG_SPI_NOR_SFDP_DEVICETREE) but I’m not sure about the proper way to do it (I did copy the fields from the datasheet but either I did not write them in correct format or I’m missing something else), so I end up just copying the bytes from some jedec samples I found in Zephyr tree. That way I could see that jedec sample did parse those bytes in some sane way, and I can see multiple sector sizes with the erase instructions.
So the question is, how to make proper sfdp-bfp in device tree and how to properly read the parameters from the actual dataflash device. Thanks for clarification and/or any advice.
M.

PS: sorry for the off-topic and non nRF Feather question.

    Hey Marek

    All good. You’re welcome to ask any and all Zephyr related questions here. 🙂

    I haven’t played with these SFDP parameters but have played a bunch with external flash.

    One thing that helped immensely was looking at how it was done in other places in the SDK. Unless you need to change something at runtime, I’d go for the one-time initialization via your overlay.

    I did a quick search and there were a few examples:

    Hope that helps

    Hi Jared,
    thanks for the answer and kind welcome.
    What you suggest is exactly what I did try at the beginning and eventually it works. But I was curious about that SFDP parameters, so besides reading datasheets - which some of them has pieces of actual jesd216 standard - I also tried to read the actual data, but with not much success, as I explained in my original post.

    However lately I discovered that SFDP pointer from SFDP header is not interpreted correctly, and after little fix I was able to read actual SFDP parameters from my flash memory!

    index 64367d673a..35362ddf22 100644
    --- a/drivers/flash/jesd216.h
    +++ b/drivers/flash/jesd216.h
    @@ -51,7 +51,7 @@ static inline uint32_t jesd216_param_addr(const struct jesd216_param_header *hp)
     {
            return ((hp->ptp[2] << 16)
                    | (hp->ptp[1] << 8)
    -               | (hp->ptp[0] << 0));
    +               | (hp->ptp[0] << 0)) << 2;
     }

    https://github.com/zephyrproject-rtos/zephyr/issues/47970

    Here is the part of my .dts with the actual SFDP parameter table on Spansion S25FL127S device:

    	s25fl127: s25fl127@0 {
    		compatible = "jedec,spi-nor";
    		reg = <0>;
    		label = "S25FL127";
    		/* size in Megabits! */
    		size = <0x8000000>;
    		spi-max-frequency = <1000000>;
    		enter-4byte-addr = <0>;
    		jedec-id = [01 20 18];
    		sfdp-bfp = [
    	    	ff ff f3 ff  ff ff ff 07
    		44 eb 08 6b  08 3b 80 bb
    		e6 ff ff ff  ff ff ff ff
    		ff ff ff ff  0c 20 10 d8
                    00 ff 00 ff
    	];
    	status = "okay";
    };

    That’s great you found a fix!!

    The Zephyr repo’s issue tab has a been a good resource for me as well as I’ve found bugs or something wasn’t working.

    Terms and Conditions | Privacy Policy