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

Issue with Sending generic level messages from main()

Hi,

I am working with a motion sensor which sends a message when it detects a motion. I am communicating between the nRF52 DK and the sensor via UART. I am able to receive messages correctly. I am using the experimental_dimming_client example and I tried to send a generic level message whenever the sensor detects the motion. I added the UART library and added the functionality to send generic level messages upon detecting motion in the main() as follows:

for (;;)
    {
        uint8_t cr;
        while(app_uart_get(&cr) != NRF_SUCCESS);
        while(app_uart_put(cr) != NRF_SUCCESS);

        if(cr == 'M')
        {
            button_event_handler(1);
        }

        (void)sd_app_evt_wait();
    }

M indicates motion and button event handler sends the generic level messages.

Here comes the issue:

I haven't provisioned the board yet. When a motion is detected, the board is able to execute the the button_event_handler function for case 1 which is sending a set message.

Now I provisioned the device(didn't set the publication address). For these two situations, output looks like this:

When I add the publication address, it asserts an error: 

app_error_weak.c,  108, Mesh assert at 0x0002AEC6 (:0)

After this, I went back to the stock SDK and tried to send generic level messages from the main function (without UART) which resulted in a Mesh error 15 (Forbidden Command)

I have been trying to debug and find why I am unable to publish messages to an address from the main() but I am not successful yet.

What might be the reason? Any ideas on how to resolve it?

Thank you.

  • Hi,

    Which function are giving you this error? Which nRF5 SDK and Mesh SDK are you using?

  • Hi Martin,

    I have been using 15.2.0 SDK and  3.0.0 Mesh SDK.

    Which function are giving you this error?

    I have been trying to debug the error but it was showing an error from the access_model_reliable_publish() function that is executed before sending the generic level message. If I dig deep into the function, it shows an error at a different function each time I start a new debug stint. 

    If I try to send an unacknowledged generic level delta_set message, it results in a mesh error 15 i.e, forbidden command.

    Can't we send the generic level messages from the main() but send them by pressing the buttons on the board? How?

    Thank you.

  • I'm little bit confused. Which error code do you get from access_model_reliable_publish()? Or do you get mesh error 15 from this function? You should be able to send messages from main(), seems like the issue is elsewhere.

  • May be you can try this issue by just calling button_event_handler() function in the main() of the dimming client example something like this:

    for (;;)
        {
            
            button_event_handler(1);
    
            (void)sd_app_evt_wait();
        }

    Later after provisioning using app and applying a publication address, 

    I was getting a mesh_assert when sending acknowledged messages and mesh error 15 when sending unacknowledged messages.

  • Hi, 

    I was trying a similar thing with light_switch example. In the light switch client, I did something similar:

    int main(void)
    {
        initialize();
        start();
    
        for (;;)
        {
            button_event_handler(1);
            nrf_delay_ms(2000);
            (void)sd_app_evt_wait();
        }
    }

    Initially, I already setup a mesh with a Mesh switch(CLIENT) publishing to an address and Mesh light(SERVER) subscribed to that address. When I run the example after adding button_event_handler in the main(), I see the following forbidden command error:

    Any idea on why this error is occuring?

Related