Light LC Example with Scenes, Node reset error.

Hello,

SDK Version - 17.0.2

Mesh Version - 5.0.0

I'm using nRF52840 DK to build mesh example(light_lc_server & scene_client).

I try to save the scene of the LC Device through the Scene Device and erase the scene with a node reset.

But, when performing a node reset while the scene is stored, a mesh assert occurs in model_config_file_clear().

(This situation occurs when three or more scenes are stored.)

When resetting a node, how do I erase all stored scenes?

(Only LC Device without Scene Device)

  • Hi,

    What assert do you get, and where? The model_config_file_clear function dosn't seem to have any asserts in itself, so it must be in one of the other calls?

    Unfortunately I do not have time to reproduce today, and will be out-of-office rest of the week due to public holiday. Therefore I will get back to you next week. In the meantime, any further information on where it fails and how, as well as steps to reproduce, are appreciated.

    Regards,
    Terje

  • Hi,

    I think it's too simple, so I'll write it down in more detail.

    * Each device is provisioned through the nrf mesh app.

    1. Scene_Client has 4 stores of Scene.


    2. The __LOG of the node reset of Light_lc_server was changed to two as shown below.

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

    3. When performing a node reset in this situation, a mesh assert occurs as follows.

    4. Additionally, the mesh assert appears to occur in the mesh_config_file_clear function within the model_config_file_clear function.

    5. I checked 4. through Debug log as below. (model_config_file.c, mesh_config.c)

    When I checked, a mesh assert occurred between Debug Point 3 and 4.

    void model_config_file_clear(void)
    {
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- Debug Point 1  -----\n");
        model_config_clear();
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- Debug Point 2  -----\n");
        m_status.is_metadata_stored = 0;
        m_status.is_load_failed = 0;
        mesh_config_file_clear(MESH_OPT_MODEL_FILE_ID);
    }

    void mesh_config_file_clear(uint16_t file_id)
    {
        const mesh_config_file_params_t * p_file = file_params_find(file_id);
    
        if (p_file == NULL)
        {
            /* If certain file is not found, there is no use for the clear call, silently return. */
            return;
        }
    
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- Debug Point 3  -----\n");
        FOR_EACH_ENTRY(p_params)
        {
            if (p_params->p_id->file != file_id)
            {
                continue;
            }
            for (uint32_t j = 0; j < p_params->max_count; ++j)
            {
                if (p_params->p_state[j] & MESH_CONFIG_ENTRY_FLAG_ACTIVE)
                {
                    mesh_config_entry_id_t id = *p_params->p_id;
                    id.record += j;
    
                    if (p_params->callbacks.deleter)
                    {
                        p_params->callbacks.deleter(id);
                    }
                    listeners_notify(p_params, MESH_CONFIG_CHANGE_REASON_DELETE, id, NULL);
    
                    p_params->p_state[j] &=  /* no longer active and request to the entry processor does not have sense. */
                                        (mesh_config_entry_flags_t)~(MESH_CONFIG_ENTRY_FLAG_ACTIVE | MESH_CONFIG_ENTRY_FLAG_DIRTY);
                }
            }
        }
    
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- Debug Point 4  -----\n");

    Regards,

    SunJ

Related