This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Write to FLASH after BLE init

I am working in sdk14 nrf52832 I want to write flash after BLE initializing ,but write flash it has no action

while(sd_flash_page_erase(64) != NRF_SUCCESS){} //address = 0x40000
while(sd_flash_write((uint32_t *)0x40000,(uint32_t *)&ptr,((sizeof(TypedefBle)+3)/4))){}
NVIC_SystemReset();
Parents
  • Hi,

    Putting the function call inside a loop won't guarantee that the flash operation is finished after the loop.

    As in the documentation of sd_flash_page_erase and sd_flash_write, you need to wait for the flash callback event :

    NRF_EVT_FLASH_OPERATION_SUCCESS - The command was successfully completed.
    NRF_EVT_FLASH_OPERATION_ERROR - The command could not be started.
    

    Before you proceed to the next command. If you want to reset after you write, you need to wait for the NRF_EVT_FLASH_OPERATION_SUCCESS callback event of the write command.

  • Could you tell what exactly you did for testing with your my_fs ? Seems like you are using fs_event_handler() from the fds ? You should define your own handler. Have you tried to follow the example code in the link to fstorage documentation above ?

Reply Children
No Data
Related