-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emds: Revise rram related timing in emds #19275
emds: Revise rram related timing in emds #19275
Conversation
CI InformationTo view the history of this post, clich the 'edited' button above Inputs:Sources:sdk-nrf: PR head: 070328ff05fba447099208af1cd3700df1fb978e more detailssdk-nrf:
Github labels
List of changed files detected by CI (4)
Outputs:ToolchainVersion: b77d8c1312 Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds. Note: This comment is automatically posted by the Documentation Publish GitHub Action. |
9d09608
to
780cf30
Compare
780cf30
to
0eeab6e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny nitpicks left
doc/nrf/libraries/others/emds.rst
Outdated
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`. | ||
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`. | ||
When changing the :kconfig:option:`CONFIG_EMDS_FLASH_TIME_BASE_OVERHEAD_US` option, it is important that the worst time is considered. | ||
When configuring these values using RRAM there is not a need to consider garbage collection in the same way as for flash, as it can be written to regardless of value. But the ERASEALL functionality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the ERASEALL functionality should be avoided
How can you 'avoid' eraseall functionality? EMDS storage page erase anyway needed upon the next reboot right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RRAMC provides functionality to protect the device against the erase all function.
See https://docs.nordicsemi.com/bundle/ps_nrf54L15/page/rramc.html#ariaid-title7
doc/nrf/libraries/others/emds.rst
Outdated
These can be found by looking at datasheets, driver documentation, and the configuration of the application. | ||
:math:`s_\text{ate}` is the size of the allocation table entry used by the EMDS flash module, which is 8 B. | ||
:math:`s_\text{ate}` is the size of the allocation table entry used by the EMDS flash/RRAM module, which is 8 B. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:math:`s_\text{ate}` is the size of the allocation table entry used by the EMDS flash/RRAM module, which is 8 B. | |
:math:`s_\text{ate}` is the size of the allocation table entry used by the EMDS flash/RRAM module, which is 8 B if NVS is used, else it is 16 B for ZMS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ate size is 8 regardless of ZMS or NVS. It is defined in emds_flash.c.
doc/nrf/libraries/others/emds.rst
Outdated
@@ -142,7 +144,7 @@ The following values can be inserted into the formula: | |||
This is the worst case overhead when a store is triggered in the middle of an erase on nRF52840 with :kconfig:option:`CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE` enabled in the sample by default, and should be adjusted when using other configurations. | |||
* Set :math:`t_\text{entry}` = 300 µs and :math:`t_\text{word}` = 41 µs. *Note: These values are valid only for this specific chip and configuration, and should be computed for the specific configuration whenever using EMDS.* | |||
* The sample uses two entries, one for the RPL with 255 entries (:math:`s_i` = 2040 B) and one for the lightness state (:math:`s_i` = 3 B). | |||
* The flash write block size :math:`s_\text{block}` in this case is 4 B, and the ATE size :math:`s_\text{ate}` is 8 B. | |||
* The flash/RRAM write block size :math:`s_\text{block}` in this case is 4 B, and the ATE size :math:`s_\text{ate}` is 8 B. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* The flash/RRAM write block size :math:`s_\text{block}` in this case is 4 B, and the ATE size :math:`s_\text{ate}` is 8 B. | |
* The flash/RRAM write block size :math:`s_\text{block}` in this case is 4 B, and for NVS backend the ATE size :math:`s_\text{ate}` is 8 B. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ate size is 8 regardless of ZMS or NVS. It is defined in emds_flash.c.
doc/nrf/libraries/others/emds.rst
Outdated
Overview | ||
******** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overview | |
******** |
doc/nrf/libraries/others/emds.rst
Outdated
Implementation | ||
============== | ||
The :kconfig:option:`CONFIG_EMDS` Kconfig option enables the emergency data storage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation | |
============== | |
The :kconfig:option:`CONFIG_EMDS` Kconfig option enables the emergency data storage. | |
Implementation | |
************** | |
The :kconfig:option:`CONFIG_EMDS` Kconfig option enables the emergency data storage. |
0eeab6e
to
a646365
Compare
subsys/emds/Kconfig
Outdated
@@ -68,8 +73,7 @@ config EMDS_FLASH_TIME_BASE_OVERHEAD_US | |||
worst case scenario, before starting storing entries. This value | |||
is dependent on the chip used, and should be checked against the chip | |||
datasheet. | |||
For RRAM-based flash drivers, the time is defined by the erasing block size. | |||
The default erasing block size is 4096 bytes. | |||
For RRAM-based flash drivers, ERASEPROTECT should be used and we can disregard the SOC_FLASH_NRF_PARTIAL_ERASE_MS parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For RRAM-based flash drivers, ERASEPROTECT should be used and we can disregard the SOC_FLASH_NRF_PARTIAL_ERASE_MS parameter. | |
For RRAM-based flash drivers, use ERASEPROTECT and disregard the SOC_FLASH_NRF_PARTIAL_ERASE_MS parameter. |
doc/nrf/libraries/others/emds.rst
Outdated
@@ -128,9 +128,9 @@ The :c:func:`emds_store_time_get` function estimates the required worst-case tim | |||
t_\text{store} = t_\text{base} + \sum_{i = 1}^n \left(t_\text{entry} + t_\text{word}\left(\left\lceil\frac{s_\text{ate}}{s_\text{block}}\right\rceil + \left\lceil\frac{s_i}{s_\text{block}}\right\rceil \right)\right) | |||
|
|||
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`. | |||
: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. | |||
: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, while for RRAM the write-buffer size i number of 128-bit words (16 bytes). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: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, while for RRAM the write-buffer size i number of 128-bit words (16 bytes). | |
: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, while for RRAM the write-buffer size ``i`` number of 128-bit words (16 bytes). |
doc/nrf/libraries/others/emds.rst
Outdated
@@ -64,7 +64,7 @@ The :c:func:`emds_is_ready` function can be called to check if EMDS is prepared | |||
Once the data storage has completed, a callback is called if provided in :c:func:`emds_init`. | |||
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. | |||
|
|||
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. | |||
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 persistent memory area. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 persistent memory area. | |
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. |
doc/nrf/libraries/others/emds.rst
Outdated
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`. | ||
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`. | ||
When changing the :kconfig:option:`CONFIG_EMDS_FLASH_TIME_BASE_OVERHEAD_US` option, it is important that the worst time is considered. | ||
When configuring these values using RRAM there is not a need to consider garbage collection in the same way as for flash, as it can be written to regardless of value. But the ERASEALL functionality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When configuring these values using RRAM there is not a need to consider garbage collection in the same way as for flash, as it can be written to regardless of value. But the ERASEALL functionality | |
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 the value. | |
However, avoid the ERASEALL functionality, |
doc/nrf/libraries/others/emds.rst
Outdated
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`. | ||
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`. | ||
When changing the :kconfig:option:`CONFIG_EMDS_FLASH_TIME_BASE_OVERHEAD_US` option, it is important that the worst time is considered. | ||
When configuring these values using RRAM there is not a need to consider garbage collection in the same way as for flash, as it can be written to regardless of value. But the ERASEALL functionality | ||
should be avoided as that can increase the time before the EMDS store functions are called. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be avoided as that can increase the time before the EMDS store functions are called. | |
because that can increase the time before the EMDS store functions are called. |
a646365
to
e216aee
Compare
How about a changelog entry? Is this important enough to add one? |
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]>
e216aee
to
070328f
Compare
This is not something new, so I think it is not important enough to add a changelog entry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a minor question.
@@ -68,8 +73,7 @@ config EMDS_FLASH_TIME_BASE_OVERHEAD_US | |||
worst case scenario, before starting storing entries. This value | |||
is dependent on the chip used, and should be checked against the chip | |||
datasheet. | |||
For RRAM-based flash drivers, the time is defined by the erasing block size. | |||
The default erasing block size is 4096 bytes. | |||
For RRAM-based persistent memory driver, use ERASEPROTECT and disregard the SOC_FLASH_NRF_PARTIAL_ERASE_MS parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ERASEPROTECT
what does it mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... it is not clear why is ERASE PROTECT
required for emds? Seems this is up to the application whether it uses or doesn't.
Updated estimated timing for rram storage using emds. Also updated documentation and test to a more proper indication of values for rram.