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

Able to write only one time in NVMC

Hi ,

Here is my code used to write in to non volatile memory.

#include "nrf.h" //#include "uicr_config.h" #include <stdint.h> #include <stdbool.h> #include "nrf_nvmc.h"

int main(void) {

			uint32_t     address   =  0x10001088;
			uint32_t     value       =  0x13345652;
			uint32_t     b            =   0;
			nrf_nvmc_write_word(address,	value);

			b = *(uint32_t *)address;
			
			//nrf_nvmc_write_word(address+12,	b);
			while (true)
			{
						/* Do nothing */
			}

}

But for first time i able to see the data whatever i have written in memory.

But if i change the value, i cant see the changed data. it remains as old data.

means i am not able to write one more time.

i check by reset the device also , but not able to write.

but if increase address value to 4 more bytes, i am able to write data in new address.

Kindly suggest me, where i am wrong.

Regards Balaji

Parents
  • When erasing flash, all bits are set back to 1, and when then writing, the needed bits are set to 0. To set a bit back to 1, you must erase the address again.

    This means that it isn't possible to write to bytes successively to flash, if the change needs to set bits back to one. In other words, you can first write 0b10101111 to an address, and then 0b10100101, but you can't write 0b1010000 and then write 0xb10100101.

Reply
  • When erasing flash, all bits are set back to 1, and when then writing, the needed bits are set to 0. To set a bit back to 1, you must erase the address again.

    This means that it isn't possible to write to bytes successively to flash, if the change needs to set bits back to one. In other words, you can first write 0b10101111 to an address, and then 0b10100101, but you can't write 0b1010000 and then write 0xb10100101.

Children
No Data
Related