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

flashwrite persistence

Using sdk12.3 on pca10040.

I wanted to test persistence so I modified the example from the SDK as follows:  log what's already there.  don't erase.  enter new data.  log it again.

Using the provided example /peripheral/flashwrite to get the starting address

pg_size = NRF_FICR->CODEPAGESIZE;
pg_num = NRF_FICR->CODESIZE - 1; // Use last page in flash
addr = (uint32_t *)(pg_size * pg_num);

I then say:

flash_word_write(addr, (uint32_t)patwr);
NRF_LOG_INFO("'%c' was written to flash at %08x\r\n", patwr, (unsigned long) addr);
patrd = (uint8_t)*addr;
NRF_LOG_INFO("'%c' %08x was read from flash at %08x\r\n\r\n", patrd, *addr, (unsigned long) addr);

Regardless of the value of patwr (a character from the console) written to 0007F000 the read value is 00000000.

(So the fact that it does not persist across a reset is not surprising.)

Causes could be that the address is wrong or that writing to flash is somehow being blocked.

Any suggestions pls.

Related