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

Mesh error 5 on button press.

Hello All,

I'm trying to create a client device that toggles LEDs on a server on and off using the NRF52840-DK.

My modified Client code is giving me Mesh error 5 when I press a button to send out a command.

Here is what's I'm seeing on the debug terminal:

<t:          0>, main.c,  326, ----- BLE Mesh Light Switch Client Demo -----
<t:      11363>, main.c,  297, Initializing and adding models
<t:      16282>, mesh_app_utils.c,   65, Device UUID (raw): 492190590C90BD4097E5070ABA14153B
<t:      16285>, mesh_app_utils.c,   70, Device UUID : 59902149-900C-40BD-97E5-070ABA14153B
<t:      53439>, main.c,  200, Button 0 pressed
<t:      53441>, main.c,  233, Sending msg: ONOFF SET 0
<t:      53444>, app_error_weak.c,  119, Mesh error 5 at 0x000266DB (C:\Users\shi.ch\Desktop\NRF\NRF_LATEST\nrf5SDKforMeshv310src\examples\userExamples\client\src\main.c:281)

Not entirely sure what Mesh error 5 refers to - could not find any references to it.

However, line 281 refers to the ERROR CHECK function in the button event handler.

I've posted code with all my changes to the light switch client example for NRF52840/S140/V6.1.0

static void button_event_handler(uint32_t button_number)
{

    ...

    switch(button_number)
    {
        case 0:
        case 1:
        case 2:
            if(set_params.on_off == APP_STATE_OFF){
              set_params.on_off = APP_STATE_ON;
            }
            if(set_params.on_off == APP_STATE_ON){
            set_params.on_off = APP_STATE_OFF;
            }
            default:

            break;
        case 3:
            set_params.on_off = APP_STATE_OFF;
            break;
    }
    
    ...
    
    switch (button_number)
    {
    //ALL USING UNACK MODEL//
        case 0:
            status = generic_onoff_client_set_unack(&m_clients[0], &set_params,
                                                    &transition_params, APP_UNACK_MSG_REPEAT_COUNT);
            hal_led_pin_set(BSP_LED_0, set_params.on_off);
        case 1:
                    status = generic_onoff_client_set_unack(&m_clients[1], &set_params,
                                                    &transition_params, APP_UNACK_MSG_REPEAT_COUNT);
            hal_led_pin_set(BSP_LED_1, set_params.on_off);
        case 2:
                    status = generic_onoff_client_set_unack(&m_clients[2], &set_params,
                                                    &transition_params, APP_UNACK_MSG_REPEAT_COUNT);
            hal_led_pin_set(BSP_LED_2, set_params.on_off);
        case 3:
            status = generic_onoff_client_set_unack(&m_clients[3], &set_params,
                                                    &transition_params, APP_UNACK_MSG_REPEAT_COUNT);
            hal_led_pin_set(BSP_LED_3, set_params.on_off);
            break;
    }
    
    ...
    
    switch (status)
    {
    
        ...

        default:
            ERROR_CHECK(status); //Line 281
            break;
    }
}

I've set the code to toggle the set_params.on_off bit when the button is pressed, with the fourth button turning the lights off.

Message is sent to  clients using unack model found in the example.

Any help on the matter would be appreciated.

Thanks all

Sincerely,

jdts

  • Hi. 

    Have you tried debugging your project to see exactly where you are running into this error?

     

    Not entirely sure what Mesh error 5 refers to - could not find any references to it.

    If you take a look in "nrf_error.h" you can see that Mesh error 5: 

     #define NRF_ERROR_NOT_FOUND                   (NRF_ERROR_BASE_NUM + 5)  /// <  Not found


    I've posted code with all my changes to the light switch client example for NRF52840/S140/V6.1.0

    The code you added, is that the only changes you made to the example?

    Best regards, 
    Joakim 

  • Hi Joakim,

    Yes, those are the only changes that I've made to the example.

    I believe that this has something to do with configurations - as it only appears when I press a button. I'm assuming that I did not initiate a button correctly, or that it's not bound properly in software.

    Thank you for letting me know about "nrf_error.h", I could not find any references in code or documentations to it.

    I've switched to not using hardware buttons at all now, and the problem no longer persists. 

    Best,

    jdts.

Related