This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sd_flash_write in BLE event

Hello, i have read all posts about writing to FLASH when using BLE. But could not find the desirable method.

What i would like to do is to write to flash from characteristic write as it comes. The problem: sd_flash_write is asynchronous

So i have to block the device until the write has finished or else the writen data may get corrupted. And here comes the problem. The only way to know that the sd_flash_write had finished is to wait for NRF_EVT_FLASH_OPERATION_SUCCESS inside sys_evt_handler. But as some other post mentioned if you call the flash command inside the ble event you don't get the SUCCESS response. The one way to get the response is to make store the data somewhere and make a flag which is call from the main thread. But that means that i am limited to the buffer size i am storing data in.

Isn't there a way to write directly synchronous from the BLE event or at least to somehow block the further execution untill i get the event?

Thanks

Related