The System on Chip (SoC) flash memory API provides the application with flash write, flash erase, and flash protect support through the SoftDevice. Asynchronous flash memory operations can be safely performed during active BLE connections using the Flash memory API of the SoC library.
The flash memory accesses are scheduled to not disturb radio events. See Flash API timing for details. If the protocol radio events are in a critical state, flash memory accesses may be delayed for a long period resulting in a time-out event. In this case, NRF_EVT_FLASH_OPERATION_ERROR will be returned in the application event handler. If this happens, retry the flash memory operation. Examples of typical critical phases of radio events include: connection setup, connection update, disconnection, and impending supervision time-out.
The probability of successfully accessing the flash memory decreases with increasing scheduler activity (i.e. radio activity and timeslot activity). With long connection intervals there will be a higher probability of accessing flash memory successfully. Use the guidelines in Table 1 to improve the probability of flash operation success.
BLE activity | Flash write/erase (flash write size is assumed to be four bytes) |
---|---|
High Duty cycle directed advertising |
Does not allow flash operation while advertising is active (maximum 1.28 seconds). In this case, retrying flash operation will only succeed after the advertising activity has finished. |
All possible BLE roles running concurrently (connections as a central, peripheral, advertiser, and scanner). |
Low to medium probability of flash operation success Probability of success increases with:
|
8 high bandwidth connections as a central 1 high bandwidth connection as a peripheral All active connections fulfill the following criteria:
|
High probability of flash write success. Medium probability of flash erase success. (High probability if the connection interval is > 107 ms) |
8 high bandwidth connections as a central All active connections fulfill the following criteria:
|
High probability of flash operation success. |
8 low bandwidth connections as a central All active connections fulfill the following criteria:
|
High probability of flash operation success. |
1 connection as a peripheral All active connections fulfill the following criteria:
|
High probability of flash operation success. |
Connectable Undirected Advertising Nonconnectable Advertising Scannable Advertising Connectable Low Duty Cycle Directed Advertising |
High probability of flash operation success. |
No BLE activity |
Flash operation will always succeed. |