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

Mesh: clearing configuration data does not work

I need to make a reset of mesh device with clearing its configuration.

For this I tried to use model_config_file_clear() or mesh_stack_config_clear() functions.

However I get an assert error by calling any of these functions. Please see screenshots below.

I tried to add delay loop after calling one of these functions and before the reset of the device. Also tried to call stop_proxy().

Clearing model function fails all the time, clearing stack config fails half of the times. Functions are called from main loop.

Also I am not sure which one is the right function to use.

Call stack (similar to both functions):

Failed Assert:

  • Hi,

    Did you find a solution?

    For what it's worth, the SDK examples typically solves this the following way:

    Triggering a reset, e.g. through button press, it runs the following:

    /* Clear all the states to reset the node. */
    if (mesh_stack_is_device_provisioned())
    {
    #if MESH_FEATURE_GATT_PROXY_ENABLED
        (void) proxy_stop();
    #endif
        mesh_stack_config_clear();
        node_reset();
    }
    else
    {
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "The device is unprovisioned. Resetting has no effect.\n");
    }

    In the above, node_reset() is implemented as:

    static void node_reset(void)
    {
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- Node reset  -----\n");
        /* This function may return if there are ongoing flash operations. */
        model_config_file_clear();
        mesh_stack_device_reset();
    }

    Note that the order of operations, as well as flash activity and priority levels, might affect these operations.

    Let me know if you are still seeing issues, and that approach does not work for your application. The particular code was taken from the Light CTL Server of nRF5 SDK for Mesh v5.0.0.

    Regards,
    Terje

Related