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

  • And could you just quickly recompile the example (or actually there might be even HEX file provided in SDK), and run it? It might actually need small modification and instead of running it in endless loop (where you cannot control in which phase you halt it to read flash over SWD by SEGGER/nrfjprog) just run it once and then dump the entire memory. The last flash page should be full of writes. If this works then you have simply bug in your app. If it fails then please post here flash dump to see what's there (some Nordic employee might then take it as bug report and help you).

    Cheers

Reply
  • And could you just quickly recompile the example (or actually there might be even HEX file provided in SDK), and run it? It might actually need small modification and instead of running it in endless loop (where you cannot control in which phase you halt it to read flash over SWD by SEGGER/nrfjprog) just run it once and then dump the entire memory. The last flash page should be full of writes. If this works then you have simply bug in your app. If it fails then please post here flash dump to see what's there (some Nordic employee might then take it as bug report and help you).

    Cheers

Children
No Data
Related