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