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

the APP_ERROR in the simple message

I created a simple message mode based on the simple_on_off modle,when I debuged the codes in simple message client,I got an error(app_error),I never changed the codes for this.And there is no trouble when I debugged the simple_on_off modle.Could you tell me some efficacious methods for this problem?

<t: 0>, main.c, 487, ----- BLE Mesh Light Switch Client Demo -----
<t: 0>, nrf_mesh_sdk.c, 187, Initializing softdevice
<t: 0>, nrf_mesh_sdk.c, 122, Initializing SoftDevice...
<t: 2>, nrf_mesh_sdk.c, 131, Ram base: 0x200019C0
<t: 14>, nrf_mesh_sdk.c, 197, Initializing mesh stack
<t: 333>, nrf_mesh_sdk.c, 205, Enabling mesh stack
<t: 337>, main.c, 191, Setting up access layer and models
<t: 356>, nrf_mesh_sdk.c, 72, APP_ERROR: F:\nrf5_SDK_for_Mesh_v1.0.1_src\examples\light_switch\client\src\main.c:212 code 14

Thanks in advance.

Parents Reply Children
  • Thanks for your valuable reply.

    I find the error by following your words.

    #define NRF_ERROR_NULL                        (NRF_ERROR_BASE_NUM + 14) ///< Null Pointer

    But I could not understand the means of the error and I don't know why.Maybe that's the point.I tried my best to solve this problem by myself,but I have to ask for your help after tried many methods.

    Sorry to disturb you again.

  • Please let us know what is the function in that line 212 in main.c, usually in the description of the function you can find why it throw NRF_ERROR_NULL                        

  • Maybe I know the reason of the error.the codes:

    ERROR_CHECK(simple_message_client_init(&m_clients[i], i));

    and the function is defined as :

    uint32_t simple_message_client_init(simple_message_client_t * p_client, uint16_t element_index)
    {
    if (p_client == NULL ||
    p_client->status_cb == NULL|| p_client->set_cb == NULL)
    {
    return NRF_ERROR_NULL;
    }

    access_model_add_params_t init_params;
    init_params.model_id.model_id = simple_message_CLIENT_MODEL_ID;
    init_params.model_id.company_id = ACCESS_COMPANY_ID_NORDIC;
    init_params.element_index = element_index;
    init_params.p_opcode_handlers = &m_opcode_handlers[0];
    init_params.opcode_count = sizeof(m_opcode_handlers) / sizeof(m_opcode_handlers[0]);
    init_params.p_args = p_client;
    init_params.publish_timeout_cb = NULL;
    return access_model_add(&init_params, &p_client->model_handle);
    }


    /** Forward declaration. */
    typedef struct __simple_message_client simple_message_client_t;

    but I don't understand the mean of the parameters in this function.Did the pointer means the number of the servers?when I debugged I just used one board as the client and there is no server, the error is theNRF_ERROR_NULL,but I don't know which parameter is NULL. 

    Could you help me?

    Thanks.

  • Most likely one of this was failed: 

    if (p_client == NULL ||
    p_client->status_cb == NULL|| p_client->set_cb == NULL)

     

    Have you check if all of the above are not NULL when you call the function ? 

  • Sorry to reply too late.I have checked it and it shows  the error happens because of set_cb == NULL.And the simple_message_set_cb_t is defined as: 


    typedef bool (*simple_message_set_cb_t)(const simple_message_client_t * p_self,nrf_mesh_address_t src,nrf_mesh_address_t dst, uint8_t *data, uint8_t length);

    /** Simple Message Client state structure. */
    struct __simple_message_client
    {

    /** Status callback called after status received from server. */
    simple_message_set_cb_t set_cb;

    };

    so I think it's a value of bool.In the function,I valued it as true:

    for (uint32_t i = 0; i < CLIENT_COUNT; ++i)
    {
    m_clients[i].set_cb = true;
    m_clients[i].status_cb = client_status_cb;
    ERROR_CHECK(simple_message_client_init(&m_clients[i], i));
    }

    the error is eliminated.I don't know whether it is correct and  I still don't understand the principle of it works.

Related