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.

Parents Reply
  • Hi,

    Thanks for the reply. I tried making the changes to the mesh_stack.c file mentioned in the links above. I even tried calling mesh_opt_core_adv_set() function inside static void start(void) function only before mesh_stack_start() call and also in the mesh_stack.c between calls sd_nvic_critical_region_enter()/_exit().

    Adding these lines results in a Forbidden Command error 15 as shown below:

    I also added following lines in mesh_stack.c

    uint8_t is_nested;
    ERROR_CHECK(sd_nvic_critical_region_enter(&is_nested));

    mesh_opt_core_adv_set(CORE_TX_ROLE_ORIGINATOR, &net);

    ERROR_CHECK(sd_nvic_critical_region_exit(is_nested));

    Because I am using Mesh SDK 3.0.0, this solution isn't applicable. May be the support team know a better way to fix this issue.

    Thanks for your response pirast.

Children
Related