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

Save a single byte onn flash is it possible?

Hi all,

I am trying to save an UART variable I am receiving. My case is very similar to the example Flash Write Example, but I would write few bytes instead of the whole flash page it is possible?

My application uses a nRF52 and requires SDk13

Thanks

Parents
  • Sure, you can write single word (32 bits) into the flash. Just make sure it's "empty" (= 0xFFFFFFFF aka all bits set to 1) before writing otherwise your write will probably result into wrong data (flash technology cannot change 0 bits to 1 unless you erase whole page). This is one of main added values of all the pstorage/fstorage/FDS libraries, they should manage page erase, backup etc. so you do just "logical" operations and leave dealing with "physical" addressing to lower layer functions and module logic.

Reply
  • Sure, you can write single word (32 bits) into the flash. Just make sure it's "empty" (= 0xFFFFFFFF aka all bits set to 1) before writing otherwise your write will probably result into wrong data (flash technology cannot change 0 bits to 1 unless you erase whole page). This is one of main added values of all the pstorage/fstorage/FDS libraries, they should manage page erase, backup etc. so you do just "logical" operations and leave dealing with "physical" addressing to lower layer functions and module logic.

Children
Related