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 ?

  • update on above issue from  my side..

    I have tried setting autocommissioing to false in thread dfu client example of SDK v2.0.0 and start the joiner it worked. The dfu client example got commissioned on my network.

    But the same change, i.e. auto commissioning set to false in thread dfu client example don't work for nrf sdk thread and zigbee v4.0.0

    However same SDK's simple coap client example works with autocommisioning set to false.

    So I compared both the examples, thread dfu client and thread simple coap client of nrf sdk v4.0.0

    In the sdk_config file of thread dfu client, I changed the following parameters..

    MEMORY_MANAGER_SMALL_BLOCK_COUNT 8 to MEMORY_MANAGER_SMALL_BLOCK_COUNT 64

    MEMORY_MANAGER_SMALL_BLOCK_SIZE 128 to MEMORY_MANAGER_SMALL_BLOCK_SIZE 64

    MEMORY_MANAGER_MEDIUM_BLOCK_COUNT 4 to MEMORY_MANAGER_MEDIUM_BLOCK_COUNT 16

    MEMORY_MANAGER_LARGE_BLOCK_COUNT 2 to MEMORY_MANAGER_LARGE_BLOCK_COUNT 4

    MEMORY_MANAGER_LARGE_BLOCK_SIZE 1024 to MEMORY_MANAGER_LARGE_BLOCK_SIZE 512

    After these changes, when I compiled the thread dfu client example, it got commissioned on my network with autocommissioning set to false.

    Kindly suggest what kind of effect these parameters have on the system and why they are different in simple_coap_client and thread dfu client.

    Awaiting your reply as it is quite urgent on my side.

  • Hi,

    Any update on this.

    Have you tried recreating the issue, or commissioning DFU example with auto-commissioning set to false.

  • Hi,

    Sorry for the late reply, I will need to consult with our Thread experts about this and will come back to you as soon as possible.

    Best regards,

    Marjeris

  • Hi again,

    From what I understood, adjusting the memory manager settings resolve the issue for you right?

    The Memory manager is used to allocate and free memory in the RAM. What seems to have been the issue here is that the mbedtls needs heap to perform commissioning, and this DFU client code had too small amount of RAM.

    Best regards,

    Marjeris

  • Hi,

    Thanks for the update.

    Is there any specific reason for which DFU client has these memory manager settings changed.

    Also NRF sdk for thread and zigbee V2.0.0 has same memory manager settings as of V4.0.0 but that still gets commissioned.

    My major concern is that how these memory manager changes are effecting other functioning of the DFU client.

    Why in the first place these settings are different from simple_coap_client and how these changes will affect my application.

Related