Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to create something akin to a thread in nRF SDK

I'm running OpenThread on a nrf52840-mdk from maker diary. I'm using the nRF SDK for thread and zigbee.

I would like to poll a sensor periodically. OpenThread does not offer this kind of service. Is there anything i can use in the SDK to accomplish this? I tried using an RTOS but i've been struggling to implement that.

Parents Reply Children
  • When I implement the code from that tutorial in my application - OpenThread doesn't start at all. The timer does seem to start for a few seconds, then stops. Here's my main function:

    int main(int argc, char *argv[])
    {
        nrf_gpio_init();
        nrf_gpiote_init();
        nrf_bsp_init();
        leds_init();
        lfclk_request();
        app_timer_init();
        create_timers();
        thread_instance_init();
        otIp6SetEnabled(thread_ot_instance_get(), true);
        thread_customCommands_init();
        thread_CoAP_init();
        thread_joiner_init();
        //starting thread happens in joiner_evt_handler function
        start_timers();
    
        while (true)
        {
            while (!thread_soft_reset_was_requested())
            {
                thread_process();
            }
            thread_instance_finalize();
        }
    }

    When I comment out start_timers() and create_timers(), the device seems to reboot every second. I think it restarts after thread is started in the joiner handler.

  • Never mind, I didn't follow the doc all the way to configure sdk_config.h.

    Thank you!

Related