This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Unable to commission DFU client example when autocommissioning is set to false

I have nrf52840 development boards, when I ran DFU example (from NRF SDK for thread and zigbee v4.0.0) on autocommissioning true on 2 boards and was able to run it successfully i.e. I could see they have created their own thread network. DFU process is based on Thread Secure OTA DFU Example which includes setting up of mbr and bootloader.

 Now My requirement is to set autocommissioning = false in code and commission the device on my existing thread network. For this I have changed DFU client code,

1. set .autocommissiong = false 

2. I have added  the joiner thread code.

void start_joiner(otJoinerCallback joinerCallback) {
    otError error = otJoinerStart(thread_ot_instance_get(),
                                  "J01NTHREAD",
                                  EMPTY_VALUE,
                                  "NordicSemiconductor",
                                  EMPTY_VALUE,
                                  EMPTY_VALUE,
                                  EMPTY_VALUE,
                                  joinerCallback,
                                  thread_ot_instance_get());

    NRF_LOG_INFO("Joiner error: %d", error);
    ASSERT(error == OT_ERROR_NONE);
    if(error==OT_ERROR_NONE)
        NRF_LOG_INFO("joiner started");
    error = otJoinerGetState(thread_ot_instance_get());
    NRF_LOG_INFO("Joiner state: %d", error);
    NRF_LOG_FLUSH();
}
static void joiner_callback(otError error, void *p_context) {
    NRF_LOG_INFO ("JOINER EEROR : %d", error);
    if (error == OT_ERROR_NONE) {
        NRF_LOG_INFO("Commissioning done\n\r");
        otThreadSetEnabled(thread_ot_instance_get(), true);
    } else {
        NRF_LOG_INFO("UnCommissioned\n\r");
        start_joiner(joiner_callback);
    }
}
//code added in main
main()
{
...
 if (!otDatasetIsCommissioned(thread_ot_instance_get())) {
        otIp6SetEnabled(thread_ot_instance_get(), true);
        NRF_LOG_INFO("\n\rStart Joiner");
        start_joiner(joiner_callback);
    } else {
    
        otThreadSetEnabled(thread_ot_instance_get(), true);
        
    }

}

When at border router I haven't enabled the commissioner, my joiner call back gets called with the error code  23 i.e.  OT_ERROR_NOT_FOUND = 23

Now when I start commissioner at border router, joiner call back function gets called with error code 8 i.e.  OT_ERROR_SECURITY = 8

Now to test further, I have copied the above code in your simple_coap_client example with autocommissioning set to false.

I could successfully autocommissiong it in my thread network. The joiner call back function gets called with error code 0 , i.e.  OT_ERROR_NONE = 0 and Commissioning done gets printed.

So I am unable to understand why DFU is unable to get commission with autocommissioning set to false.

Do I need to use some additional APIs and am I missing something which is required in DFU code.

How the commissioning process for DFU and simple coap client is different ?

  • Hi,

    I think you already got some answers to your questions from Gaurav but I will paste the answer from the developers here as well:

    "It turns out that in SDK 2.0.0 examples were using heap memory given by the OpenThread stack while in SDK 4.0.0 the Memory Manager has been used for the same purpose. Thread Commissioning is not the only user of this memory - its size is not sufficient for the customers' application.

    The solution proposed by the customer is very good. Our plan is to align the Memory Manager configuration of the DFU Client with other Thread Applications in the next release."

    Best regards,

    Marjeris

Related