I have a question with flash writing of nRF 52.
Once written, you can not write it for the second time. It will not cause an error, but is there any way?
Write the source code below.
-----------------------------------------------------------------
NRF_FSTORAGE_DEF (nrf_fstorage_t fstorage) =
{
/ * Set a handler for fstorage events. * /
.evt_handler = fstorage_evt_handler,
/ * These below are the boundaries of the flash space assigned to this instance of fstorage.
* You must set these manually, even at runtime, before nrf_fstorage_init () is called.
* The function nrf5_flash_end_addr_get () can be used to retrieve the last address on the
* last page of flash available to write data. * /
.start_addr = 0x76000,
.end_addr = 0x76 FFF,
};
#define GSM_APN_SETTING_SIZE 0x40
#define GSM_APN_SETTING_OFFSET 0x110
flash_update (gsm_apn_config, GSM_APN_SETTING_SIZE, GSM_APN_SETTING_OFFSET, true);
void flash_update (const uint8_t * p_dest, uint32_t size, uint32_t offset, bool isString)
{
ret_code_t rc;
rc = nrf_fstorage_write (& fstorage, fstorage.start_addr + offset, p_dest, size, NULL);
APP_ERROR_CHECK (rc);
}