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 inside BLE event

Hello, i have read if not all posts about writing to FLASH while 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 is that 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. 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 response.

One way to get the response is to store the data somewhere, make a flag which is looked up in the main context. But that means that i am limited to the array 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?

I'm using nrf52832 with sdk 12.2

Thanks

Related