You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updated estimated timing for rram storage using emds.
Also updated documentation and test to a more proper
indication of values for rram.
Signed-off-by: Ingar Kulbrandstad <[email protected]>
Copy file name to clipboardExpand all lines: doc/nrf/libraries/others/emds.rst
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,47 +7,47 @@ Emergency data storage
7
7
:local:
8
8
:depth: 2
9
9
10
-
Overview
11
-
********
12
-
The emergency data storage (EMDS) library provides persistent storage functionality designed to prevent the wear and tear of the flash memory.
10
+
The emergency data storage (EMDS) library provides persistent storage functionality designed to prevent the wear and tear of the flash memory or RRAM (persistent memory).
13
11
Its intended use is for storing of data undergoing frequent changes during runtime.
14
12
15
13
Implementation
16
-
==============
14
+
**************
17
15
The :kconfig:option:`CONFIG_EMDS` Kconfig option enables the emergency data storage.
18
16
19
-
The application must initialize the pre-allocated flash area by using the :c:func:`emds_init` function.
17
+
The application must initialize the pre-allocated storage area by using the :c:func:`emds_init` function.
20
18
The :kconfig:option:`CONFIG_EMDS_SECTOR_COUNT` option defines how many sectors should be used to store data.
21
19
22
20
The allocated storage space must be larger than the combined data stored by the application.
23
-
Allocating a larger flash area will demand more resources, but also increase the life expectancy of the flash.
24
-
The chosen size should reflect the amount of data stored, the available flash resources, and how the application calls the :c:func:`emds_store` function.
25
-
In general, it should not be necessary to allocate a large flash area, since only a limited set of data should be stored to ensure swift completion of writing the flash on shutdown.
21
+
Allocating a larger storage area will demand more resources, but also increase the life expectancy of the persistent memory.
22
+
The chosen size should reflect the amount of data stored, the available persistent memory and how the application calls the :c:func:`emds_store` function.
23
+
In general, it should not be necessary to allocate a large storage area, since only a limited set of data should be stored to ensure swift completion of writing the data on shutdown.
26
24
27
25
The memory location that is going to be stored must be added on initialization.
28
26
All memory areas must be provided through entries containing an ID, data pointer, and data length, using the :c:func:`emds_entry_add` function and the :c:macro:`EMDS_STATIC_ENTRY_DEFINE` macro.
29
27
Entries to be stored when the emergency data storage is triggered need their own unique IDs that are not changed after a reboot.
30
28
31
-
When all entries are added, the :c:func:`emds_load` function restores the entries into the memory areas from the flash.
29
+
When all entries are added, the :c:func:`emds_load` function restores the entries into the memory areas from the persistent memory.
32
30
33
-
After restoring the previous data, the application must run the :c:func:`emds_prepare` function to prepare the flash area for receiving new entries.
34
-
If the remaining empty flash area is smaller than the required data size, the flash area will be automatically erased to increase the available flash area.
31
+
After restoring the previous data, the application must run the :c:func:`emds_prepare` function to prepare the storage area for receiving new entries.
32
+
If the remaining empty storage area is smaller than the required data size, the storage area will be automatically erased to increase the available storage area.
35
33
36
34
The storage is done in deterministic time, so it is possible to know how long it takes to store all registered entries.
37
35
However, this is chip-dependent, so it is important to measure the time.
38
36
Find timing values under the "Electrical specification" section for the non-volatile memory controller in the Product Specification for the relevant SoC or the SiP you are using.
39
-
For example, for the nRF9160 SiP, see the `Electrical specification of nRF9160`_ page.
37
+
For example, for the nRF52840 SiP, see the `nRF52840 Product Specification`_ page.
When configuring these values, consider the time for erase when doing garbage collection in NVS.
45
+
When configuring these values, consider the time for erase when doing garbage collection in NVS using flash.
48
46
If partial erase is not enabled or supported, the time of a complete sector erase has to be included in the :kconfig:option:`CONFIG_EMDS_FLASH_TIME_BASE_OVERHEAD_US`.
49
47
When partial erase is enabled and supported by the hardware, include the time it takes for the scheduler to trigger, which is depending on the time defined in :kconfig:option:`CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE_MS`.
50
48
When changing the :kconfig:option:`CONFIG_EMDS_FLASH_TIME_BASE_OVERHEAD_US` option, it is important that the worst time is considered.
49
+
When configuring these values using RRAM, you do not need to consider garbage collection in the same way as for flash, as it can be written to regardless of value.
50
+
However, avoid the ERASEALL functionality, because that can increase the time before the EMDS store functions are called.
51
51
52
52
The application must call the :c:func:`emds_store` function to store all entries.
53
53
This can only be done once, before the :c:func:`emds_prepare` function must be called again.
@@ -64,7 +64,7 @@ The :c:func:`emds_is_ready` function can be called to check if EMDS is prepared
64
64
Once the data storage has completed, a callback is called if provided in :c:func:`emds_init`.
65
65
This callback notifies the application that the data storage has completed, and can be used to reboot the CPU or execute another function that is needed.
66
66
67
-
After completion of :c:func:`emds_store`, the :c:func:`emds_is_ready` function call will return error, since it can no longer guarantee that the data will fit into the flash area.
67
+
After completion of :c:func:`emds_store`, the :c:func:`emds_is_ready` function call will return an error, because it can no longer guarantee that the data will fit into the persistent memory area.
68
68
69
69
The above described process is summarized in a message sequence diagram.
70
70
@@ -90,7 +90,7 @@ The above described process is summarized in a message sequence diagram.
90
90
91
91
Requirements
92
92
************
93
-
To prevent frequent writes to flash memory, the EMDS library can write data to flash only when the device is shutting down.
93
+
To prevent frequent writes to persistent memory, the EMDS library can write data only when the device is shutting down.
94
94
EMDS restores the application data to RAM at reboot.
95
95
96
96
EMDS can store data within a guaranteed time, based on the amount of data being stored.
@@ -128,9 +128,9 @@ The :c:func:`emds_store_time_get` function estimates the required worst-case tim
where :math:`t_\text{base}` is the value specified by :kconfig:option:`CONFIG_EMDS_FLASH_TIME_BASE_OVERHEAD_US`, :math:`t_\text{entry}` is the value specified by :kconfig:option:`CONFIG_EMDS_FLASH_TIME_ENTRY_OVERHEAD_US` and :math:`t_\text{word}` is the value specified by :kconfig:option:`CONFIG_EMDS_FLASH_TIME_WRITE_ONE_WORD_US`.
131
-
:math:`s_i` is the size of the :math:`i`\ th entry in bytes and :math:`s_\text{block}` is the number of bytes in one word of flash.
131
+
:math:`s_i` is the size of the :math:`i`\ th entry in bytes and :math:`s_\text{block}` is the number of bytes in one word (4 bytes) of flash or the write-buffer size (16 bytes) of RRAM.
132
132
These can be found by looking at datasheets, driver documentation, and the configuration of the application.
133
-
:math:`s_\text{ate}` is the size of the allocation table entry used by the EMDS flash module, which is 8 B.
133
+
:math:`s_\text{ate}` is the size of the allocation table entry used by the EMDS, which is 8 B.
134
134
135
135
Example of time estimation
136
136
==========================
@@ -157,7 +157,7 @@ Calling the :c:func:`emds_store_time_get` function in the sample automatically c
157
157
158
158
Limitations
159
159
***********
160
-
The power-fail comparator for the nRF528xx cannot be used with EMDS, as it will prevent the NVMC from performing write operations to flash.
160
+
The power-fail comparator cannot be active when EMDS is used, as it will prevent the NVMC or RRAMC from performing write operations to persistent memory.
0 commit comments