This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

mesh_config_event.h MESH_CONFIG_STRATEGY_ON_POWER_DOWN

Hi,

We are looking at using the key:value store functionality defined in mesh_config.h. Can you provide some additional detail on

HW and or SW configuration required to use the  MESH_CONFIG_STRATEGY_ON_POWER_DOWN strategy.

Per the nRF52840 PSv1.1, the NVIC doesn't permit writing to FLASH once a brownout is detected (or at least that is our understanding).

How should we trigger the FLASH write? Do we need to monitor a voltage level over a CAP or similar outside of the SoC?

Our device is line-powered. Mesh SDK v3.0 and Nordic SDK 15.2. We see the mesh_config is used to persist a few Mesh Stack variables, but

weren't able to find any that are rapidly changing or use the power down strategy.

Erik

  • Hi,

    The mesh config APIs themselves are unaware of the brown out state or power availability. To use `MESH_CONFIG_STRATEGY_ON_POWER_DOWN` strategy, user should generate some kind of external interrupt using power monitoring hardware to signal the application to trigger flash writes by calling `mesh_config_power_down()` API. User should design a system with sufficiently large backup capacitor such that enough power is available to finish all flash writes. The time required to store all mesh config entries can be obtained by calling `mesh_config_power_down_time_get()`API.

  • Mttrinh,

    Yes, understand the SW piece. Our question is on nRF SoC HW capability. Product spec section 5.3.1.6 "Power-fail comparator" describes a POWERWARN event that can optionally be enabled. From the text it however seems that initiating a FLASH write is explicitly blocked by NVMC, ie this event can't be used to trigger mesh_config_power_down().  Is it correct that the only possible design is to have either an external circuit that triggers a non-maskable interupt on a separate pin before the VCC level reaches the threshold defined in the POFCON register, or dedicate the single nRF onboard comparator  to monitor an external analog level?

    If a FLASH write has initiated before crossing the POFCON threshold, will writing a batch of parameters be allowed to complete, or are we better off never enabling POFCON such that can discharge CAP for longer?

  • Yes, your understanding is correct. You need to have an external circuit that triggers the interrupt on a separate gpio pin before the VCC level drops significantly causing failure of flash writes. It is best to not use POFCON functionality since mesh_config functionality does not take any action to allow or disallow writing. If flash area is available, it will always try to finish pending writes. System designer should ensure that sufficient power backup is available to complete these writes.

    To minimize capacitor size you can also disable the mesh completely by calling `nrf_mesh_disable()` after receiving the interrupt.

Related