Hello and thank you for your time. I seem to be getting some incorrect performance from the flash memory with NVS, in that NVS needs to be primed or something before it works properly. I have been testing with this code:
And I get the following results:
Write 0 4
Read 0 -2
Write 1 4
Read 1 -2
Write 2 4
Read 2 -2
Write 3 4
Read 3 -2
Write 4 4
Read 4 -2
Write 5 4
Read 5 -2
Write 6 4
Read 6 4
Write 7 4
Read 7 4
Write 8 4
Read 8 4
Write 9 4
Read 9 4
Write 10 4
Read 10 4
Write 11 4
Read 11 4
Write 12 4
Read 12 4
Flash ready took 13 tries
This happens consistently, where it takes 13 tries before the flash can be used properly. As near as I can tell, once we get that Flash ready then everything works fine until the next reset.
I initialize the flash with:
And it seems to work, I get the message
I: 2 Sectors of 4096 bytes
I: alloc wra: 0, f40
I: data wra: 0, 54
I have tried even comically large delays between initialising the flash and the first write, and between the write and read, and I still seem to have the error.
I am using the NRF5340 with SDK 2.5.0.
I doubt this is the expected behavior; do you have any suggestions what I am doing wrong?
Thanks!