This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Flash storage, unable to write and read 1024 and 2048 bytes

Hi, I am testing the flash storage of nrf52840 with NVS example from NCS v1.4.2

i have run the example code successfully. from the example code i have changed the

uint8_t longarray[128]; to uint8_t longarray[1024];

memset(&longarray , 'A',sizeof(longarray));

output log is

*** Booting Zephyr OS build v2.4.0-ncs2  ***

 rd - ID : 1 ; D :  ; L:16
No address found, adding 192.168.1.1 at id 1
 
wd - ID : 1 ; D : 192.168.1.1 ; L:12

write : O:f8000, D:192.168.1.1, L:12
write : O:f8ff0, D:, L:8
 rd - ID : 2 ; D : è ; L:8
No key found, adding it at id 2
 
wd - ID : 2 ; D : ÿþýüûúùø ; L:8

write : O:f800c, D:ÿþýüûúùø, L:8
write : O:f8fe8, D:, L:8
 rd - ID : 3 ; D :  ; L:4
No Reboot counter found, adding it at id 3
 
wd - ID : 3 ; D :  ; L:4

write : O:f8014, D:, L:4
write : O:f8fe0, D:, L:8
 rd - ID : 4 ; D : 192.168.1.1 ; L:16
Id: 4 not found, adding it
 
wd - ID : 4 ; D : DATA ; L:5

write : O:f8018, D:DATA, L:4
write : O:f8fd8, D:, L:8
 rd - ID : 5 ; D : Pa ; L:1024
Longarray not found, adding it as id 5

Query is

1. How to properly write and read the 1024 bytes,2048 bytes

2. I need to work in ble_his_keyboard example. where flash storage is initialized for pairing data storage. I need to store the sensor data . how to interface flash write into the main application of ble_hid_keyboard

  • Hi Sunil

    Sorry about the late reply, but I've been very busy, and when you comment on your own case, the activity keeps moving your case to the bottom of my case queue.

    1. Can you try moving the flash pages to a way lower address, as I think the Fxxxx pages are taken by the bootloader. I don't know where your application stops, but try using the flash pages just after that.

    2. I think this is related to what Einar explains here. You need to make sure that the partition slots fit the application after you've added the bootloader and then move the next slot to the correct place as well.

    Best regards,

    Simon

  • Hi Simon,

    I don't think so its bootloader page

    &flash0 {
    	/*
    	 * For more information, see:
    	 * https://docs.zephyrproject.org/latest/guides/dts/legacy-macros.html#legacy-flash-partitions
    	 */
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		boot_partition: partition@0 {
    			label = "mcuboot";
    			reg = <0x000000000 0x0000C000>;
    		};
    		slot0_partition: partition@c000 {
    			label = "image-0";
    			reg = <0x0000C000 0x00067000>;
    		};
    		slot1_partition: partition@73000 {
    			label = "image-1";
    			reg = <0x00073000 0x00067000>;
    		};
    		scratch_partition: partition@da000 {
    			label = "image-scratch";
    			reg = <0x000da000 0x0001e000>;
    		};
    
    		/*
    		 * The flash starting at 0x000f8000 and ending at
    		 * 0x000fffff is reserved for use by the application.
    		 */
    
    		/*
    		 * Storage partition will be used by FCB/LittleFS/NVS
    		 * if enabled.
    		 */
    		storage_partition: partition@f8000 {
    			label = "storage";
    			reg = <0x000f8000 0x00008000>;
    		};
    		sensor_partition: partition@f4000 {
    			label = "sensor";
    			reg = <0x000f4000 0x00003000>;
    		};
    	};
    };
    

    2. i have seen the page that ticket created by me. there problem is lag in flash memory. here there is no such issue and more over this error is during compiling only kindly check the previous attached files

  • Or Is it possible to store the user data in flash with DFU enabled process

    Please share any example or related documents

  • Hi simon, I can't able to reply on last message .

    And how to clear the flash error

Related