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

Why I can not erasing the flash ?

6.1.4 Erasing a page in code region 1 When erase is enabled, the NVM can be erased page by page using the ERASEPAGE register or the ERASEPCR1 register. After erasing a NVM page all bits in the page are set to '1'. The time it takes to erase a page is specified by tPAGEERASE in the product specification. The CPU is halted while the NVMC performs the erase operation. See UICR chapter for more information.

I can write a data to flash only once, and can read it ok.

but I can not erasing the flash page, so I can not write some other data to the same flash address again.

I do it as that:

NRF_NVMC->ERASEPAGE=254; NRF_NVMC->ERASEPCR1=254; NRF_NVMC->ERASEUICR=1; while(NRF_NVMC->READY==0); //NRF_NVMC->ERASEALL=1; NRF_NVMC->CONFIG=2;//FOR DEL while(NRF_NVMC->READY==0);

I read the FICR ,and know that CODEPAGESIZE is 1024 CODESIZE is 256

and I know that region 0 is 108k ID=0X0087 region 1 is base 0x1b000, and is 148k . and I want to erasing the last 2 pages.

I try some times , somes the NRF_NVMC->ERASEPAGE is set before the NRF_NVMC->CONFIG=2;//FOR DEL somes the NRF_NVMC->ERASEPAGE is set after the NRF_NVMC->CONFIG=2;//FOR DEL and somes the NRF_NVMC->ERASEPAGE set before the NRF_NVMC->CONFIG=2;//FOR DEL, and set again after NRF_NVMC->CONFIG=2;//FOR DEL.

the result is same, when I use nRFgo Studio erase all, the firt time is all ok. the next time , I cannot write data to flash, but I can read it ok.

so, I think that I can not erasing the flash page, in the function.

Parents
  • 7.4 Register Details Table 14: CODEPAGESIZE Bit number 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Id A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A Reset 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Id RW Field Value Id Value Description A R CODEPAGESIZE Code memory page size Table 15: CODESIZE Bit number 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Id A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A Reset 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Id RW Field Value Id Value Description A R CODESIZE Code memory size in number of pages Total code space is: CODEPAGESIZE * CODESIZE Table 16: I read the FICR ,and know that CODEPAGESIZE is 1024 CODESIZE is 256

Reply
  • 7.4 Register Details Table 14: CODEPAGESIZE Bit number 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Id A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A Reset 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Id RW Field Value Id Value Description A R CODEPAGESIZE Code memory page size Table 15: CODESIZE Bit number 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Id A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A Reset 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Id RW Field Value Id Value Description A R CODESIZE Code memory size in number of pages Total code space is: CODEPAGESIZE * CODESIZE Table 16: I read the FICR ,and know that CODEPAGESIZE is 1024 CODESIZE is 256

Children
No Data
Related