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

Flash memory

Hi

How many bytes of data can be written to flash memory at a time? I am trying to write an array of 10 elements of 16 bit data type , but only the first four elements are being written to the flash memory.

Thanks and Regards 

Vybhav

Parents
  • Hi Vybhav

    Have you read the nRF52840 product specification? Chapter 4 is very thorough on what to do and not to do when writing to and reading from flash memory. As for your inquiry, I quote the PS chapter 4.3.1:

    When write is enabled, full 32-bit words can be written to word-aligned addresses in the flash. As illustrated in Memory on page 20, the flash is divided into multiple pages. The same 32-bit word in the flash can only be written n WRITE number of times before a page erase must be performed. The NVMC is only able to write 0 to bits in the flash that are erased (set to 1). It cannot rewrite a bit back to 1. Only full 32-bit words can be written to flash using the NVMC interface. To write less than 32 bits, write the data as a full 32-bit word and set all the bits that should remain unchanged in the word to 1. Note that the restriction on the number of writes (nWRITE) still applies in this case. Only word-aligned writes are allowed. Byte or half-word-aligned writes will result in a hard fault.

    Best regards,

    Simon

Reply
  • Hi Vybhav

    Have you read the nRF52840 product specification? Chapter 4 is very thorough on what to do and not to do when writing to and reading from flash memory. As for your inquiry, I quote the PS chapter 4.3.1:

    When write is enabled, full 32-bit words can be written to word-aligned addresses in the flash. As illustrated in Memory on page 20, the flash is divided into multiple pages. The same 32-bit word in the flash can only be written n WRITE number of times before a page erase must be performed. The NVMC is only able to write 0 to bits in the flash that are erased (set to 1). It cannot rewrite a bit back to 1. Only full 32-bit words can be written to flash using the NVMC interface. To write less than 32 bits, write the data as a full 32-bit word and set all the bits that should remain unchanged in the word to 1. Note that the restriction on the number of writes (nWRITE) still applies in this case. Only word-aligned writes are allowed. Byte or half-word-aligned writes will result in a hard fault.

    Best regards,

    Simon

Children
No Data
Related