How to configure and use nRF9160DK external flash mx25r6435f

Hi,

I use the nRF9160dk and I want to use nRF9160's external flash mx25r6435f to store a few data.

There are few related posts from too many years ago. Could you provide a clear guideline to configure and use it?

board: nrf9160dk

SDK: v2.5.0

Thanks,

Liza

Parents
  • Hi Liza,

    You could follow external flash documentation which shows Kconfig and devicetree configuration.

    Best regards,
    Dejan

  • Dear Dejan,

    I have followed the configuration. 

    I build the nrf9160dk_nrf9160_ns board and failed to bind with mx25r6435f ("--ERROR: Flash device is not ready--“). Here is my files.3580.nrf9160dk_nrf9160_ns.overlay

    void NVSInit(){
    	printk("\nNVS init started...\n");
    
    	const struct device *dev_flash;
    	dev_flash = device_get_binding(DEVICE_DT_NAME(DT_NODELABEL(mx25r64)));
        	if (!dev_flash) {
            		printk("\n--ERROR: Flash device is not ready--\n");
            		return;
       	 }
    
    	err = flash_write(dev_flash,0,1,1);
    	if(err!=0){
    		printk("\n--ERROR: Failed to write data.-- \n\r");
    		exit(1);
    	}
    	err = 1;
    
    	err = flash_read(dev_flash,0,1,1);
    	if(err!=0){
    		printk("\n--ERROR: Failed to read data.-- \n\r");
    		exit(1);
    	}
    	err = 1;
    }

    I learned from other post. Should I build nrf9160dk_nrf52840 board first to open the external flash? 

    Thanks,

    Liza

Reply
  • Dear Dejan,

    I have followed the configuration. 

    I build the nrf9160dk_nrf9160_ns board and failed to bind with mx25r6435f ("--ERROR: Flash device is not ready--“). Here is my files.3580.nrf9160dk_nrf9160_ns.overlay

    void NVSInit(){
    	printk("\nNVS init started...\n");
    
    	const struct device *dev_flash;
    	dev_flash = device_get_binding(DEVICE_DT_NAME(DT_NODELABEL(mx25r64)));
        	if (!dev_flash) {
            		printk("\n--ERROR: Flash device is not ready--\n");
            		return;
       	 }
    
    	err = flash_write(dev_flash,0,1,1);
    	if(err!=0){
    		printk("\n--ERROR: Failed to write data.-- \n\r");
    		exit(1);
    	}
    	err = 1;
    
    	err = flash_read(dev_flash,0,1,1);
    	if(err!=0){
    		printk("\n--ERROR: Failed to read data.-- \n\r");
    		exit(1);
    	}
    	err = 1;
    }

    I learned from other post. Should I build nrf9160dk_nrf52840 board first to open the external flash? 

    Thanks,

    Liza

Children
Related