QSPI Flash memory configuration

Hello,

I have a nrf52840 project that uses an external flash over QSPI. My code works as expected with the PCA10056 devkit and the memory MX25R6435F (64 Mbit).
When I port the code to my custom PCB, which uses the memory MX25L25645G (256 Mbit), the same code works for addresses that are < 3 bytes length, but it fails to access bigger addresses. I.e. if I try to write to address 0x1000000, it will write to address 0, instead.

The MX25L25645G datasheet mentions that 4 bytes address mode needs to be enabled to access the higher addresses, so I suspect the flash driver (#include <zephyr/drivers/flash.h>) is not doing that.

My next step would be to check the driver implementation, but before I do that, I'd like to know what is the right way of solving this with Zephyr. This is my 1st Zephyr project and I'm not sure if I configured the memory correctly or I missed something.

In case I do need to change the driver, what's the best way of doing that? Just change the current code or create a new one? Guidance is appreciated.

This is the DTS configuration I'm using for the memory (I used the MX25R6435F as a base and changed the values accordingly).

qspi: qspi@40029000 
{
    compatible = "nordic,nrf-qspi";
    #address-cells = < 0x1 >;
    #size-cells = < 0x0 >;
    reg = < 0x40029000 0x1000 >, < 0x12000000 0x8000000 >;
    reg-names = "qspi", "qspi_mm";
    interrupts = < 0x29 0x1 >;
    status = "okay";
    pinctrl-0 = < &qspi_default >;
    pinctrl-1 = < &qspi_sleep >;
    pinctrl-names = "default", "sleep";
    mx25l25: mx25l25645g@0 
    {
        compatible = "nordic,qspi-nor";
        reg = < 0x0 >;
        writeoc = "pp4io";
        readoc = "read4io";
        sck-frequency = < 0x7a1200 >;
        jedec-id = [ C2 20 19 ];
        sfdp-bfp = [ E5 20 ... ];
        size = < 0x10000000 >;
        has-dpd;
        t-enter-dpd = < 0x2710 >;
        t-exit-dpd = < 0x88b8 >;
    };
};

Thank you!

Parents
  • I tried all the suggestions and none worked. The nrfx_qspi_cinstr_xfer function always returns BUSY error. I don't know why, but I think Zephyr is using the driver somehow and making it busy.

    Anyways, found a better solution using the DTS file. Just need to add:

    enter-4byte-addr = <0x87>;
    address-size-32;

    The whole overlay node I used:

    &qspi
    {    
        mx25l25: mx25l25645g@0
        {
            compatible = "nordic,qspi-nor";
            reg = < 0x0 >;
            writeoc = "pp4io";
            readoc = "read4io";
            sck-frequency = < 0x7a1200 >;
            jedec-id = [ C2 20 19 ];
            sfdp-bfp = [ e5 20 fb ff ff ff ff 0f 44 eb 08 6b 08 3b 04 bb fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 10 d8 00 ff d6 59 dd 00 82 9f 03 db 44 03 67 38 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 ];
            size = < 0x10000000 >;
            has-dpd;
            t-enter-dpd = < 0x2710 >;
            t-exit-dpd = < 0x88b8 >;
            enter-4byte-addr = <0x87>;
    		address-size-32;
        };
    };

Reply
  • I tried all the suggestions and none worked. The nrfx_qspi_cinstr_xfer function always returns BUSY error. I don't know why, but I think Zephyr is using the driver somehow and making it busy.

    Anyways, found a better solution using the DTS file. Just need to add:

    enter-4byte-addr = <0x87>;
    address-size-32;

    The whole overlay node I used:

    &qspi
    {    
        mx25l25: mx25l25645g@0
        {
            compatible = "nordic,qspi-nor";
            reg = < 0x0 >;
            writeoc = "pp4io";
            readoc = "read4io";
            sck-frequency = < 0x7a1200 >;
            jedec-id = [ C2 20 19 ];
            sfdp-bfp = [ e5 20 fb ff ff ff ff 0f 44 eb 08 6b 08 3b 04 bb fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 10 d8 00 ff d6 59 dd 00 82 9f 03 db 44 03 67 38 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 ];
            size = < 0x10000000 >;
            has-dpd;
            t-enter-dpd = < 0x2710 >;
            t-exit-dpd = < 0x88b8 >;
            enter-4byte-addr = <0x87>;
    		address-size-32;
        };
    };

Children
No Data
Related