Internal Flash Page Erase is not working for nrf 52840 using nrf connect sdk

We have made 2 partition of Internal flash. One is for running Application and Other for storing some configuration. I am trying to erase the page of 2nd partition, and it is not working properly.

2nd partition Id is storage.

flash_area_open(FLASH_AREA_ID(storage), &fa);
flash_area_read(fa,3840,array,256);
flash_area_erase(fa, 3840, 256); //erasing only one page of the storage sector
flash_area_write(fa,3840,array1,256);
Is the above steps are correct?. As I am not able to erase the page properly and working only first time.
Parents
  • Hello,

    Could you explain the context a bit more? Which SDK version and Nordic chip are you using?

    You mentioned having two partitions, with one reserved for configuration storage. You should ensure that the partition boundaries are correctly defined in your pm_static.

    Are there any log messages indicating the issue or error? Have you considered using the NVS file system from Zephyr?

    Kind Regards,

    Abhijith

Reply
  • Hello,

    Could you explain the context a bit more? Which SDK version and Nordic chip are you using?

    You mentioned having two partitions, with one reserved for configuration storage. You should ensure that the partition boundaries are correctly defined in your pm_static.

    Are there any log messages indicating the issue or error? Have you considered using the NVS file system from Zephyr?

    Kind Regards,

    Abhijith

Children
  • SDK Version : 2.6.0

    Chip : NRF52840 DK

    Created Overlay File as Below:

    &flash0 {
        partitions {
            compatible = "fixed-partitions";
            #address-cells = <1>;
            #size-cells = <1>;

            slot0_partition: partition@ba000 {
                label = "image-0";
                reg = <0x000ba000 0x00040000>;
            };

            storage_partition: partition@fa000 {
                label = "storage";
                reg = <0x000fa000 0x00004000>;
            };
           
        };
    };
    Using memory address 0 to 0x000ba000 for some other application. BLE stack using slot0_partition. 
    I am using storage_partiotion to store configuration items and facing issue to erase page.
     
Related