developer.nordicsemi.com/.../a00935.html
The doc seems to provide only write functions. And, the flashwrite example doesn't show how to read from flash even after device rebooted. How can I read something later that has been stored in flash?
developer.nordicsemi.com/.../a00935.html
The doc seems to provide only write functions. And, the flashwrite example doesn't show how to read from flash even after device rebooted. How can I read something later that has been stored in flash?
You do not need NVMC hardware or API to read the flash memory. Just read it like any other memory.
for example, if you want to read 2 bytes of flash located at 0x21000 then the below code will do it
#define STORAGE_ADR 0x21000
uint16_t value = *(uint16_t *)ptr;
or If you want to compare it with some thing then better would be to do like below
if(*((uint16_t *)STORAGE_ADR) == 0xff)
{
do something;
}
You do not need NVMC hardware or API to read the flash memory. Just read it like any other memory.
for example, if you want to read 2 bytes of flash located at 0x21000 then the below code will do it
#define STORAGE_ADR 0x21000
uint16_t value = *(uint16_t *)ptr;
or If you want to compare it with some thing then better would be to do like below
if(*((uint16_t *)STORAGE_ADR) == 0xff)
{
do something;
}
But, since it's 'non volatile' memory, will this address be working even after complete hard reboot of the device?
I do not see why not!! The flash is initialized before the CPU starts executing code. So it should work, give it a try and let me know how it went.
Yes, the flash is working on restart. Thanks. :)
Thanks for coming back and updating this thread.