Hi,
do sd_flash_page_erase or sd_flash_write provide any guarantees that the command has executed successfully or should I do a manual check to verify if the page was really erased or the data was written correctly?
Thanks, Marius
Hi,
do sd_flash_page_erase or sd_flash_write provide any guarantees that the command has executed successfully or should I do a manual check to verify if the page was really erased or the data was written correctly?
Thanks, Marius
Yes, after you exceed the spec, i.e. more than 10 000 Write/erase cycles, you have no "100%" guarantees anymore. See this post.
We use NOR flash in our devices, and in general, NOR flash is reliable and does not require any error correction in software/firmware. (I also believe the underlying NOR HW flash algorithm does verification, i.e it tries to write a number of times until the flash has been verified to have been written properly)
@Sigurdon, can you please give some more information on the underlying HW flash algorithm? Does it really verify? Or can you point me to the HW spec of the actual NVM part used in the nRF52832 boards?
Hi Sigurd, if you can provide any info on this, it would be appreciated! :)
Embedded NOR flash typically implements a kind of programming "state-machine". Verify operation typically consist in controlling the memory cells under program, and checks if they have reached the target threshold voltage. If the target voltage inside the memory cell is not reached, it will typically retry the write operation. See this book chapter from Springer. Nordic is not the company designing the flash used inside our chips, so HW flash algorithms are Intellectual property (IP) owned by the flash vendor company.
What happens when you exceed the spec is that the probability of bit flipping happening gradually increases. In the latest FDS drivers, we have implemented CRC checks on read and write, so that you can verify that the data you once wrote, is matching the one you read back later. See this link.
But again, note that NOR flash is very reliable, and does not generally need any error correction in software/firmware
Thanks Sigurd. I have another question then. Maybe I should make a new question, but it seems to be related to the discussion. In the nrf_nvmc.c driver file, we have code such as
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {;}
This seems like it could go into an infinite loop when NRF_NVMC->READY is always == to NVMC_READY_READY_Busy due to some error in the FLASH HW . Do you think its possible that this statement can cause the code to go into an infinite loop? Is there some sort of to prevent it if it can go into an infinite loop?