Writing and reading data from NRF52 serial flash memory in Zephyr

Hello everyone. I have an nRF52832 processor and a W25Q128JVPIQ serial flash memory. I want to save data to this flash memory and read from it. I haven't done such an application before. Can you give me some tips for this application? I'm using Zephyr.

  • I used the spi_flash sample code. Below is the overlay file I created. There are no errors during the compilation of the code. However, in the terminal, I see the message 'Flash memory device not ready.

    / {
        aliases {
            spi-flash0 = &w25q128jv;
        };
    };
    
    
    &spi0 {
    	compatible = "nordic,nrf-spi";
    	status = "okay";
    	cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
    
    	pinctrl-0 = <&spi0_default_alt>;
    	pinctrl-1 = <&spi0_sleep_alt>;
    	pinctrl-names = "default", "sleep";
    	w25q128jv:w25q128jv@0 {
    		compatible = "jedec,spi-nor";
            status = "okay";
    		reg = <0>;
    		spi-max-frequency = <8000000>;
    	jedec-id = [EF 40 16];	
    		size = <4194304>;};
    };
    
    &spi1 {
    	status = "disabled";
    };
    
    &spi2 {
    	status = "disabled";
    };
    
    
    &pinctrl {
    	spi0_default_alt: spi0_default_alt {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 0, 11)>,
    				<NRF_PSEL(SPIM_MOSI, 0, 12)>,
    				<NRF_PSEL(SPIM_MISO, 0, 13)>;
    		};
    
    		
    	};
    
    	spi0_sleep_alt: spi0_sleep_alt {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 0, 11)>,
    				<NRF_PSEL(SPIM_MOSI, 0, 12)>,
    				<NRF_PSEL(SPIM_MISO, 0, 13)>;
    			low-power-enable;
    		};
    	};
    
    };

    I have no information about the JEDEC-ID values in the overlay file. I just took them from a sample code.


    The error function I see in the RTT terminal is as follows

    	if (!device_is_ready(flash_dev)) {
    		printk("%s: device not ready.\n", flash_dev->name);
    		return;
    	}

  • Hi,

    I will take a look at this. In the meantime, could you refer to this ticket and see how it goes?

    -Priyanka

Related