Interfacing FAT file system into WinbondW25Q02 using SPI-nor driver

Greetings,

I have been trying to integrate file system into Winbond W25Q02 NOR storage, Initially I tested the hardware by interfacing SPI communication between nrf 5340 and winbond and I was able to read JEDEC id, write characters into various pages and read back from them, so hardware is NOT the problem. Now I saw that zephyr allows us to integrate file system and there is a library called SPI nor, which is heavily inspired by Winbond. Before jumping into my storage for testing file system, I tested a "Mass" sample which I found in nordic SDK. it follows QSPI protocol, and I was able to mount the mx25r64 storage, which is already present inside nrf dk. Now when I use the same code, with modifications for communication (instead of QSPI, I need SPI),I get the error saying JEDEC id 00 00 00  does not match my given id in the overlay i.e ef 70 22. I just edited prj.config and overlay file in the mass sample for this purpose and I am really not sure if I need to make any changes on main.c or spi-nor.c driver for this. 

This is my overlay file

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
// / {
// aliases {
// spi-flash0 = &winbond;
// };
// };
/* Disable conflicting buttons and UART */
&button2 {
status = "disabled";
};
&button3 {
status = "disabled";
};
&gpio_fwd {
status = "disabled";
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

This is my prj.config file

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
CONFIG_STDOUT_CONSOLE=y
#USB related configs
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Zephyr MSC sample"
CONFIG_USB_DEVICE_PID=0x0008
CONFIG_LOG=y
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
CONFIG_USB_MASS_STORAGE=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
CONFIG_USB_MASS_STORAGE_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n
CONFIG_APP_MSC_STORAGE_FLASH_FATFS=y
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=n
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_FLASH_JESD216_API=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

This is my terminal

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
*** Booting Zephyr OS build 28a3fca7da5c ***
[00:00:00.257,751] <err> flashdisk: Flash area 0 open error -19
[00:00:00.257,751] <err> usb_msc: Storage init ERROR !!!! - Aborting USB init
[00:00:00.257,781] <err> os: ***** BUS FAULT *****
[00:00:00.257,812] <err> os: Precise data bus error
[00:00:00.257,812] <err> os: BFAR Address: 0xef8008f3
[00:00:00.257,843] <err> os: r0/a1: 0x00000000 r1/a2: 0x00013384 r2/a3: 0x00000000
[00:00:00.257,843] <err> os: r3/a4: 0xef8008f3 r12/ip: 0xfffffffc r14/lr: 0x00000883
[00:00:00.257,873] <err> os: xpsr: 0x69000000
[00:00:00.257,873] <err> os: Faulting instruction address (r15/pc): 0x0000f6c0
[00:00:00.257,904] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0
[00:00:00.257,965] <err> os: Current thread: 0x20000b30 (unknown)
[00:00:00.257,110] <dbg> spi_nrfx_spim: spi_context_update_tx: tx buf/len (nil)/0
[00:00:00.257,110] <dbg> spi_nrfx_spim: finish_transaction: Transaction finished with status 0
--- 17 messages dropped ---
[00:00:00.257,141] <dbg> spi_nrfx_spim: spi_context_buffers_setup: tx_bufs 0x20005418 - rx_bufs 0x20005420 - 1
[00:00:00.257,171] <dbg> spi_nrfx_spim: spi_context_buffers_setup: current_tx 0x20005428 (2), current_rx 0x20005428 (2), tx buf/len 0x20005410/1, rx buf/len 0x20005410/1
[00:00:00.257,171] <dbg> spi_nrfx_spim: spi_context_update_tx: tx buf/len 0x20005478/3
[00:00:00.257,202] <dbg> spi_nrfx_spim: spi_context_update_rx: rx buf/len 0x20005478/3
[00:00:00.257,232] <dbg> spi_nrfx_spim: spi_context_update_tx: tx buf/len (nil)/0
[00:00:00.257,232] <dbg> spi_nrfx_spim: spi_context_update_rx: rx buf/len (nil)/0
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

file:///C:/Users/DELL/Desktop/datasheet/W25Q02JV_DTR_RevB_04192021-2329042.pdf

This is the link to winbond datasheet that I am using. Any help would be much appreciated!