Hi:
i use SDK7.0 , i write data in flash (address:0x0003fc00)and the data is erased when SDK run.
and is there any way to protect the page that i want to write or other solution.thanks.
thank you for your answer.i used a softdevice(7.1).and i used"ble_flash_block_write" in ble_flash.c directly.the data was written right when the code run after "ble_flash_block_write".but when i continued running the code.and i watched memory was clear.maybe data was cleared by sdk or sd.and do you have any demo code or other solution for me.thanks
When the SoftDevice is enabled you should use sd_flash_page_erase() and sd_flash_write() functions. Please see Section 7 in the S110 SoftDevice Specification 2.0 for more information.
If the flash operation is succesful you will get a NRF_EVT_FLASH_OPERATION_SUCCESS event in sys_evt_dispatch(). I recommend you to have a flag that is set you do a flash operation, and is unset when you get NRF_EVT_FLASH_OPERATION_SUCCESS. Check the flag before you do a flash operation.
We also have a module for handling flash operations, Pstorage.