Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Writing data into the Internal Flash that's not word aligned

I'm using NRF52833 with SDK v16.0.0 along with mesh SDK v4.1.0. I want to know if it's possible to write data which is not word aligned into the internal flash (For example, overwriting one or two bytes at a particular location of the internal flash). I happened to come across NVMC (Non Volatile Memory Controller) driver but internally it just de-references the write address and assigns it the value to be written. But this comes at the restriction of not able to write '1' bits in the flash that are already cleared to '0'. I know that's how the flash works. But is there any flash driver/manager that can make this work? I don't have access to any external storage device so I've to rely on the internal flash to store the data.

Parents
  • Hello,

    The only way to update an data at an existing address is if you if you first back up the flash page you want to update, erase the page, and then finally restore it again from backup along with the updated data. This is basically how flash updates was handled in the now deprecated Persistent Storage Manager module. The main problem with this approach is the number of time costly page erases you have to perform just to update a small section in the flash page.

    For the nRF5 Mesh SDK I would recommend using the Flash manager. The 'Defragmentation' section of this documentation explains how data updates are handled.

    Best regards,

    Vidar

Reply
  • Hello,

    The only way to update an data at an existing address is if you if you first back up the flash page you want to update, erase the page, and then finally restore it again from backup along with the updated data. This is basically how flash updates was handled in the now deprecated Persistent Storage Manager module. The main problem with this approach is the number of time costly page erases you have to perform just to update a small section in the flash page.

    For the nRF5 Mesh SDK I would recommend using the Flash manager. The 'Defragmentation' section of this documentation explains how data updates are handled.

    Best regards,

    Vidar

Children
No Data
Related