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 Children
  • instead of running it in the for-loop you could create an interrupt that triggers whenever the sensor detects motion.

    That was the first thing that I did if you can see the question that I posted, I tried to send a generic level message upon receiving an indication from the sensor using UART that motion is detected.

    Might be that the messages are being sent too fast, can you try waiting for the NRF_MESH_EVT_TX_COMPLETE before sending a new message?

    I might have taken it that way already if the program crashes while sending the second message after successfully transmitting the first. But, I am unable to transfer the first message itself. 

    I also tried another thing, used the EnOcean switch example, instead of sending generic OnOff messages, I tried sending generic Level messages. They are transmitted without any error inside the app_switch_debounce().

    Why can these messages be transmitted from app_switch_debounce() in EnOcean example, but not from the main() in any example?

Related