nRF5340 and W25Q512NW Nor Flash R/W problem?

Hello,

I am using W25Q512NW (https://www.winbond.com/resource-files/W25Q512NW%20RevB%2007192021.pdf) in my custom board. I want to store the sensor data in this flash.

My custom board use the nRF5340 MCU and the version of the nrf connect sdk is V2.5.2.

the problem i am facing that i am not able to read the data from the flash.

 

*** Booting nRF Connect SDK v2.5.2 ***
[00:00:00.252,868] <inf> main: iMedrix External flash Application Started.

Device name: w25q512nw@0
Data written. Good!!
23 22 33 44 55 66 77 88 
Data read. Good!!
FF FF FF FF FF FF FF FF 
Data not matched..!!
JEDEC ID : EF  60  20 

In above log, i am writing 8 bytes and also read those 8 bytes. but when i read data from the flash i am getting only FF. 
And when i read the JEDEC id of the flash, i am getting right JEDEC id.

Here is the prj.conf file.

# Logger module
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG=y
CONFIG_LOG_MODE_DEFERRED=y
CONFIG_LOG_SPEED=y
CONFIG_UART_CONSOLE=n

CONFIG_DEBUG=y


# spi Configuration
CONFIG_SPI=y

#External flash configuration
CONFIG_FLASH=y
CONFIG_FLASH_JESD216_API=y
CONFIG_FLASH_PAGE_LAYOUT=y


CONFIG_NEWLIB_LIBC=y

Here is the .overlay file below.

 

&qspi {
	status = "okay";
	pinctrl-0 = <&qspi_default>;
	pinctrl-1 = <&qspi_sleep>;
	pinctrl-names = "default", "sleep";
	w25q512: w25q512nw@0 {
		compatible = "nordic,qspi-nor";
		reg = <0>;
		/* MX25R64 supports only pp and pp4io */
		writeoc = "pp4io";
		// writeoc = "pp4o";
		/* MX25R64 supports all readoc options */
		readoc = "read4io";
		sck-frequency = <8000000>;
		// jedec-id = [c2 28 17];
		jedec-id = [EF 60 20];
		sfdp-bfp = [
  			e5 20 fb ff  ff ff ff 1f  44 eb 08 6b  08 3b 42 bb
  			fe ff ff ff  ff ff 00 00  ff ff 40 eb  0c 20 0f 52
  			10 d8 00 00  33 02 a6 00  81 e7 14 d9  e9 63 76 33
  			7a 75 7a 75  f7 bd d5 5c  19 f7 5d ff  e9 70 f9 a5
  		];
		size = <536870912>;
		// address-size-32;
		has-dpd;
		// t-enter-dpd = <10000>;
		// t-exit-dpd = <35000>;
		t-enter-dpd = <3000>;
		t-exit-dpd = <30000>;
	};
};

Please give me your suggestion in this.  

Let me know if any modification is required.

Thank you in advance.

Gautam.

Related