Hello,
I want to run mass storage on my custom board with the nRF52833 and W25Q512JVEIQ. I have reviewed the mass storage sample (ncs\v2.7.0\zephyr\samples\subsys\usb\mass).
I have previously communicated with the W25Q512JVEIQ via SPI and written my own test functions (write_enable, erase_sector, send_page_program, read_data). I can successfully write and erase data on the W25Q512JVEIQ.
The relevant configurations in my custom_board.dts are as follows:
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x0 0xc000>;
};
slot0_partition: partition@c000 {
label = "image-0";
reg = <0xc000 0x32000>;
};
slot1_partition: partition@3e000 {
label = "image-1";
reg = <0x3e000 0x32000>;
};
scratch_partition: partition@70000 {
label = "image-scratch";
reg = <0x70000 0xa000>;
};
storage_partition: partition@7a000 {
label = "storage";
reg = <0x7a000 0x6000>;
};
};
};
spi_flash: &spi1 {
status = "okay";
pinctrl-0 = <&spi1_default>;
pinctrl-names = "default";
flash@0 { /* Flash belleğin tanımlanması */
compatible = "jedec,spi-nor"; /* SPI NOR flash belleği uyumluluğu */
reg = <0>; /* SPI cihazı için chip select (CS) numarası */
spi-max-frequency = <8000000>; /* Maksimum 8 MHz SPI frekansı */
label = "W25Q512JV";
jedec-id = [ef 40 20]; /* W25Q512JV'nin JEDEC ID değeri */
size = <0x4000000>; /* Flash boyutu (64 MB, 512 Mb) */
};
};
&pinctrl {
spi1_default: spi1_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 1)>,
<NRF_PSEL(SPIM_MISO, 0, 4)>,
<NRF_PSEL(SPIM_MOSI, 0, 5)>;
};
};
};
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
};
Then, I added the following functions from the mass storage sample to my code without changing them:
static int setup_flash(struct fs_mount_t *mnt)
static int mount_app_fs(struct fs_mount_t *mnt)
static void setup_disk(void)
Then, I implemented it in the main as in the mass storage sample:
I built the project without errors. Then, I debugged it to see how it works. I noticed that the "mount_app_fs(mp)" function is returning -5. I think something is wrong. Could you help me with this? Since I am new to the NCS environment, I might have made some simple mistakes. Please consider that as well.