This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Flash write after flash erase, fails

Hi

I'm using sd_flash_erase to clear a page in flash. The event NRF_EVT_FLASH_OPERATION_SUCCESS comes to my sys_evt_dispatcher. After the event has arrived I continue with sd_flash_write.

Now two different things can happen, If the page was already empty, then the write operation works. I guess this is because there was no erase since it wasn't needed.

If the page wasn't empty then the write operation fails with return code: 0x00000010 which I interpret as NRF_ERROR_INVALID_ADDR.

Is there anything I need to do after the sd_flash_erase to make the flash accessable again?

Best regards /Håkan

  • That error code should only be returned in two cases: 1) Your flash address (p_dst) is out of the flash memory range; 2) Either of your p_src and p_dst pointers are not aligned to a 4 byte boundary. I do not believe that sd_flash_write checks that the page is empty before it writes. Can you verify in the failure case what the values of the pointers are?

    How do you know the page is empty or not when this failure occurs?

  • Hi,

    Thank yo for the answer.

    The values of my pointers are the same in both cases, sorry I forgot to write that in my initial question. I check the content of the flash with a memory window in the Keil-debugger. When I see only FF:s there the erase works, event triggers, write works and event triggers again. If I see something else but FF:s then the erase works and triggers its event, but the following write fails even though the pointer values are exactly the same as in the previous run.

    Best regards /Håkan

Related