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

how can I write 10kb of flash using a loop with 32bit word write with each iteration

I'm trying to write 32bit word on flash memory every 25ms, but when I read the memory using nrfjprog I noticed that it write only 16 words (32 bits), in this code saveToFlash is set every 25 ms. according to datasheet, time to write is 46us,

why it writes only 16 words? how can I 10kb of memory using a loop?

the code is in the attachement main.c

   while (true)
        {
            if ((*addr > 0x00001000) && (saveToFlash)){
                flash_word_write(addr, flashCounter);
                addr --;
                flashCounter++;
                saveToFlash = false;
            }
        }

image description

Parents
  • If you don't use SD then your code should work (beside fact that going from address 16kB down to 0 will probably erase soon your test app which is located in the same NVM area;). Have you tried SDK example which is writing whole one flash page (1024B) word by word and should be working out of the box? It's located at .\examples\peripheral\flashwrite\.

    Cheers Jan

Reply
  • If you don't use SD then your code should work (beside fact that going from address 16kB down to 0 will probably erase soon your test app which is located in the same NVM area;). Have you tried SDK example which is writing whole one flash page (1024B) word by word and should be working out of the box? It's located at .\examples\peripheral\flashwrite\.

    Cheers Jan

Children
Related