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

Bug: nrf_nvmc_write_bytes() writes to the same 32bit word too many times for nRF52840.

Hi,

In nRF5_SDK version 15.3.0_59ac345 with nRF52840, the function nrf_nvmc_write_bytes() writes to the same 32bit word too many times.

According to the datasheet:

"The same 32-bit word in the flash can only be written n WRITE number of times before a page erase must be performed."

and nrf_nvmc_write_bytes() is implemented like this:

void nrf_nvmc_write_bytes(uint32_t address, const uint8_t * src, uint32_t num_bytes)
{
    uint32_t i;
    for (i = 0; i < num_bytes; i++)
    {
       nrf_nvmc_write_byte(address + i,src[i]);
    }
}

However, for nRF52840 has Nwrite=2, so for any buffer with num_bytes>2 this function can exceed the number of writes permitted.

Instead this function should group the bytes together such that it only writes to each 32bit word once.

Thanks

Parents Reply Children
No Data
Related