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

nrf_fstorage_erase error

I try flash read, write and erase with flash_fstorage_example sdk 15 on nrf52 dk

On main.c i can write and read with nrf_fstorage functions.

When i try nrf_fstorage_erase function I take an error

    int pg_size = NRF_FICR->CODEPAGESIZE; 
    int pg_num = NRF_FICR->CODESIZE - 1; // Use last page in flash // Start address: addr = (uint32_t *)(pg_size* pg_num);


    uint32_t *addr = (uint32_t *)(pg_size* pg_num);

    rc = nrf_fstorage_erase(&fstorage, addr, 1, NULL);
    APP_ERROR_CHECK(rc);

It returns

\0x1b[20D\0x1b[J<error> nrf_fstorage: addr_is_within_bounds(p_fs, page_addr, (len * p_fs->p_flash_info->erase_unit)) check failed in nrf_fstorage_erase() with value 0x10.
\0x1b[20D\0x1b[J<error> app: Fatal error

Parents
  • Hi,

    You will see from the usage of NRF_FSTORAGE_DEF in the fstorage example that the flash area initialized for the fstorage instance is 0x3e000 to 0x3fff. On the nRF52 DK, which uses nRF52832 QFAA, CODEPAGESIZE and CODESIZE are 0x1000 and 0x80 respectively, which means you try to erase at address 0x7f000, i.e. outside of the range for which the fstorage instance was initialized.

    Please have a look at the Experimental: Flash Storage documentation, and also keep in mind the location of MBR, SoftDevice, application, etc. as applicable for your project.

    Regards,
    Terje

Reply
  • Hi,

    You will see from the usage of NRF_FSTORAGE_DEF in the fstorage example that the flash area initialized for the fstorage instance is 0x3e000 to 0x3fff. On the nRF52 DK, which uses nRF52832 QFAA, CODEPAGESIZE and CODESIZE are 0x1000 and 0x80 respectively, which means you try to erase at address 0x7f000, i.e. outside of the range for which the fstorage instance was initialized.

    Please have a look at the Experimental: Flash Storage documentation, and also keep in mind the location of MBR, SoftDevice, application, etc. as applicable for your project.

    Regards,
    Terje

Children
Related