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

flash update just 1 byte

Hi, I'm using nrf51 without ble.

I want to update flash but not want to delete PAGE every time.

	NRF_NVMC->ERASEPAGE = (uint32_t) page_address;

How can i do?

Parents
  • If the specific address you're writing to is already erased (i.e. its value is 0xFFFFFFFF) you don't need to erase the whole page before the write.

    If the address is not erased, you may be able to write to it a second time. The absolute maximum ratings of the nRF51 state that an address can be written to 2 times without an erase. However, I believe you would be you could only change '1's to '0's on the second write.

  • So you have a write address that has already been written to and you want to change the value? You could attempt a second write, but as I said above, it would likely only change the '1's to '0's, you couldn't change '0's to '1's without an erase. That's a physical limitation of flash.

    The solution is to move the physical address of the data every time you need to write it. That way you limit your erases. Then the problem is managing where variable actually is.

    You could take a look at some of the flash managing libraries from Nordic. See this answer

Reply
  • So you have a write address that has already been written to and you want to change the value? You could attempt a second write, but as I said above, it would likely only change the '1's to '0's, you couldn't change '0's to '1's without an erase. That's a physical limitation of flash.

    The solution is to move the physical address of the data every time you need to write it. That way you limit your erases. Then the problem is managing where variable actually is.

    You could take a look at some of the flash managing libraries from Nordic. See this answer

Children
No Data
Related