Hello,
I am using nrf52840, SDK 17.0.2, softdevice s140 and also implemented OTA DFU in my application.
I want to save some data lets say admin code in flash. Once I burn the firmware to device it should be like below
uint8_t ADMIN_CODE[6] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
During my application is running I want to change it to lets say ADMIN_CODE[6] = {0x12, 0x56,0xFF,0xAA,0xFA,0xCD}. Then this becomes my admin code and when I power off and back on my ADMIN_CODE[6] should not go back to {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF} but instead should remain same ie: {0x12, 0x56,0xFF,0xAA,0xFA,0xCD} And when I do reset then it should go back to {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}.
I saw some questions like this already on forum, some suggested to use flash write using NVMC or UICR and some suggests to use pstorage or FDS. I am confused what is the best approach in my scenario. Also if you can guide to some example code of right approach, that would be great!