NRF54L15 spi00 not working

Hello team,

I am using SPI00 of NRF54L15 to communicate with w25q32fv (spi Flash). Below is the configuration I set in .overlay file

&pinctrl {
    spi00_default: spi00_default {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
                    <NRF_PSEL(SPIM_MOSI, 2, 2)>,
                    <NRF_PSEL(SPIM_MISO, 2, 4)>;
        };
    };
    spi00_sleep: spi00_sleep {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
                    <NRF_PSEL(SPIM_MOSI, 2, 2)>,
                    <NRF_PSEL(SPIM_MISO, 2, 4)>;
					
            low-power-enable;
        };
    };
};

&spi00 {
	compatible = "nordic,nrf-spim";
	status = "okay";
    pinctrl-0 = <&spi00_default>;
    pinctrl-1 = <&spi00_sleep>;
    pinctrl-names = "default", "sleep";
	cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
	w25q32fv: w25q32fv@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <8000000>;
		label = "W25Q32FV";
		status = "okay";
		jedec-id = [ef 40 16];   /* optional but helpful */
		size = <0x400000>;       /* 4 MByte = 32 Mbit */
	};
};

And below is the code I am using to read the ID of the flash

void data_write_spi()
{
    if (!device_is_ready(spi_dev)) {
        printf("SPI device not ready");
        return;
    }
    
    uint8_t cmd[4];
    uint8_t rx[5];

    cmd[0] = 0x9F;

    struct spi_buf tx_bufs = {.buf = cmd, .len = 1};
    struct spi_buf rx_bufs = {.buf = rx, .len = 5};

    struct spi_buf_set tx = {.buffers = &tx_bufs, .count = 1};    
    struct spi_buf_set rx_set = {.buffers = &rx_bufs, .count = 1};

    k_msleep(5);
    int ret = spi_transceive(spi_dev, &spi_cfg, &tx, &rx_set);


    if (ret == 0) {
        printf("JEDEC ID: %02X %02X %02X %02x %02x", rx[0], rx[1], rx[2], rx[3], rx[4]);
    } else {
        printf("SPI transfer failed: %d", ret);
    }
}

I am getting the following error.

SPI transfer failed: -5

How can I fix this issue so I can use spi00 appropriately? Any help would be greatly appreciated.

Thanks,

Payal

Parents Reply Children
  • Or do you have an extension board that you've connected to the GPIOs that the external flash uses on the DK, i.e P2.1, 2.2 and 2.4

    Yes, I have connected w25q32fv externally on the DK. Also, I have disabled mx25r64 in .overlay as follows,

    &mx25r64 {
    	status = "disabled";
    };

  • Noted,

    Then the most likely cause is that you will have to disable the external memory in the Board Configurator app within nRF Connect for Desktop

      

    By default, the SPI (P2.1, 2.2 and 2.4) lines connected to the mx25 will still be connected to the external flash, even if you disable the mx25 in the overlay. To free those GPIOs up for other things, such as with an external external flash, you also need to disable the external memory in the board configurator app.

    Kind regards,
    Andreas

  • Hi, 

    Now I am using SPI00 on a custom board. And I am observing the same error SPI transfer failed: -5, on the custom board as well

  • Hi,

    Please share your custom board and overlay files, and the generated .dts and .config and I'll have a look

    Kind regards,
    Andreas

  • Hi, 

    Now we have changed the flash part to AT45DB641E

    The following are the settings in .overlay

     
    &pinctrl {
        spi00_default: spi00_default {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
                        <NRF_PSEL(SPIM_MOSI, 2, 2)>,
                        <NRF_PSEL(SPIM_MISO, 2, 4)>;
    			nordic,drive-mode = <NRF_DRIVE_E0E1>;
            };
        };
        spi00_sleep: spi00_sleep {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
                        <NRF_PSEL(SPIM_MOSI, 2, 2)>,
                        <NRF_PSEL(SPIM_MISO, 2, 4)>;
    			nordic,drive-mode = <NRF_DRIVE_E0E1>;
                low-power-enable;
            };
        };
    };
    
    &spi00 {
    	compatible = "nordic,nrf-spim";
    	status = "okay";
        pinctrl-0 = <&spi00_default>;
        pinctrl-1 = <&spi00_sleep>;
        pinctrl-names = "default", "sleep";
    	cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
    	at45db641e: at45db641e@0 {
    		compatible = "atmel,at45";//"zephyr,spi-device";
    		reg = <0>;
    		spi-max-frequency = <8000000>;
    		label = "AT45DB641E";
    		status = "okay";
    		jedec-id = [1f 28 00];   /* optional but helpful */
    		size = <0x800000>;       /* 4 MByte = 32 Mbit */
    		sector-size = <262144>;
            block-size = <2048>;
            page-size = <256>;
    	};
    };
    

    Attaching the .dts and .config file

    reference_files.zip

Related