QSPI Difficulty with Zephyr and Nordic IC

Hello,

I am working on integrating a 4G-BIT Nand Flash, the W25N04KVZEIR with datasheet here, with a custom board equipped with an NRF52840. Currently, I am trying to just get the flash example in Zephyr working in quad mode with my custom board file. My eventual goal is to get a FAT file system running on the flash along with USB mass storage. My attempts to interface over QSPI have been largely unsuccessful, and I am hoping that someone could point me in the right direction.

The Nand flash I am working with should have support for pp4o and read4io, but I always get a mismatch error, as in the bits written don’t match the bits read. I am not sure if this is because the flash is not correctly running in quad mode, or if it is because there is some write protection enabled. As I understand it, the W25’s first register determines write/register protection and quad operation mode.

I am trying to use has-lock = <0x00>; in my boards dts in order to set these registers. I have also tried <0xff> but both of these have not fixed the error. The flash example does work with pp2o and read2io and no has-lock, but takes about 15 seconds to write and then read the bits, this was true even when the max frequency is set high. The following is the QSPI section in my custom board file:

&qspi {
	status = "okay";
	pinctrl-0 = <&qspi_default>;
	pinctrl-1 = <&qspi_sleep>;
	pinctrl-names = "default", "sleep";
	w25n04kv: w25n04kv@0 {
		compatible = "nordic,qspi-nor";
		reg = <0>;
		writeoc = "pp2o"; //Should work with pp4o
		readoc = "read2io"; //Should work with read4io
		sck-frequency = <2000000>; //Has 104MHz max frequency, I brought this down to try to possibly probe the lines
		jedec-id = [00 ef aa 23]; //JEDEC is correctly reaad on boot, when this was wrong I got a mismatch error
		size-in-bytes = <536870912>; // 4 Gigibits, using size of 4294967296 casused overflow
		has-lock = <0x00>; // Register 1 needs to be set to all 0s, pp20 or reda2io did not work with this line
		quad-enable-requirements = "NONE";
		address-size-32;
		has-dpd;
		t-enter-dpd = <3000>; //3us
		t-exit-dpd = <150000>; //was 1500000
	};
};

And this is the config I have for the flash project:

CONFIG_STDOUT_CONSOLE=y
CONFIG_FLASH=y
CONFIG_SPI=y
CONFIG_SPI_NRFX=y
CONFIG_NORDIC_QSPI_NOR=y

# My undertsanding of the datasheet is that this flash uses 2048 pages for writing
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=2048

I am a little at a loss of what to try next, and what exactly the quad-enable code or has-lock code is doing. At this point I have tried every combination of the quad-enable options and the has lock options (00, ff, or none)  but none have been able to get the flash working in quad mode. Is there some way I could directly send commands during init?

Additional detail - The QSPI is wired in the standard recommended configuration, and the flash example is unmodified running in single_sector_test mode.

Any help or guidance is greatly appreciated, thank you!

Parents
  • Hi Eric

    As mentioned by Anthony the QSPI flash driver supports NOR devices only, not NAND devices. 

    NAND devices normally use a different instruction set to that of NOR devices, and are also more complex to use. With a NOR device you don't have to worry about bit errors in the data you read or write (unless you are pushing the number of erase cycles of your device). NAND devices are cheaper, true, but one drawback of this is that they are less reliable as well and you might need to run error correction algorithms in your driver in order to ensure that your data is correct. 

    Is it possible to connect to your device using SPI rather than QSPI? 

    Best regards
    Torbjørn

Reply
  • Hi Eric

    As mentioned by Anthony the QSPI flash driver supports NOR devices only, not NAND devices. 

    NAND devices normally use a different instruction set to that of NOR devices, and are also more complex to use. With a NOR device you don't have to worry about bit errors in the data you read or write (unless you are pushing the number of erase cycles of your device). NAND devices are cheaper, true, but one drawback of this is that they are less reliable as well and you might need to run error correction algorithms in your driver in order to ensure that your data is correct. 

    Is it possible to connect to your device using SPI rather than QSPI? 

    Best regards
    Torbjørn

Children
No Data
Related