Device tree configuration for MX25L6473E on QSPI with nrf52840

Hi Nordic Team!

I'm trying to configure device tree to add support of MX25L6473E for my custom board.

I have successfully configured it to correctly read the jedec-id on start up.

But any of read operation return values near the 0x88a88888 (every time it is some sort of 0x8 and 0xA combinations).

The following code I use in .dts file. I add comments near the parameters which I don't understand clear, please check it and clarify if possible.

&qspi {
status = "okay";
sck-pin = <21>;
io-pins = <23>, <22>, <24>, <19>;
csn-pins = <20>;
mx25l64: mx25l6473e@0 {
compatible = "nordic,qspi-nor";

size = <67108864>; /* 67108864 == 0x4000000*/
label = "MX25L64";
jedec-id = [c2 20 17];
readoc = "read4io";
writeoc = "pp4io";

reg = <0>;

has-dpd;
t-enter-dpd = <10000>;
t-exit-dpd = <100000>; /* is it tRES1 and tRES2 in DS terms ? */

/* The BP3, BP2, BP1, BP0 bits are "0" as default.
Which is un-protected. Is it means the following instruction (has-lock)
does not need ? */
// has-lock = <0x3C>; /* here the value is bitmask for all BPx bits */

// rx-delay = <8>; /* is this property to config dummy cycles ? */
// sck-delay = <4>; /* is it tCSS in datasheet terms ? */

// sck-frequency = <104000000>; /* max freq by DS */
sck-frequency = <8000000>; /* frequency for test */
};
};

Also I tried to use sfdp-bfp sequence from datasheet but it seems not working too. Please, clarify how to use 3 tables from datasheet to provide sfdp sequence.

As I understand the following must be correct:

sfdp-bfp = [
53 46 44 50 00 01 01 ff 00 00 01 09 30 00 00 ff
c2 00 01 04 60 00 00 ff

ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb
ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
10 d8 00 ff

ff ff ff ff ff ff ff ff ff ff ff ff
00 36 00 27 9c 49 ff ff d9 c8 ff ff ff ff ff ff
];

Where each paragraph of the array related with the corresponding line in the following description:

Table 9. (Datasheet)
JEDEC Padding (unused or reserved).
Table 10. (Datasheet)
JEDEC Padding (unused or reserved).
Table 11. (Datasheet)

The following code I use to write and read flash after initialization:

#if DT_NODE_HAS_STATUS(DT_INST(0, nordic_qspi_nor), okay)
#define FLASH_DEVICE DT_LABEL(DT_INST(0, nordic_qspi_nor))
#else
#error Unsupported flash driver
#endif
void main(void)
{
const struct device *dev = device_get_binding(FLASH_DEVICE);


static uint32_t data = 0x01234567;
size_t size = sizeof(data);
int err = flash_write(dev, 0, &data, size);
if (err != 0) {
LOG_WRN("FAILED TO WRITE FLASH: %d", err); /* no errors here! */
}

static uint32_t data_read = 0;
err = flash_read(dev, 0, &data_read, size);
if (err != 0) {
LOG_WRN("FAILED TO READ FLASH: %d", err); /* no errors here! */
}
LOG_INF("DATA FROM FLASH %x", data_read);
while (1) {
k_sleep(K_SECONDS(1));
/* also tried to loop read-write operations here */
}
}

To prevent some questions: I checked all the qspi lines with the oscilloscope and each works correctly.

Best regards,

0xFA.

Parents Reply Children
No Data
Related