This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Thread network commissionning (with Bluetooth)

Hello

I would like to commission my Thread network but my Thread network is isolated (I have no wifi) but I have bluetooth which works in parallel to the Thread network (app based on the "ble_thread_dyn_mtd_coap_cli_pca10056_s140" example ).

Would it be possible to use bluetooth to commission the Thread network (add a new device to the Thread network)? If yes, what do you advise me to be able to do that?

Thank you

Parents
  • Hello,

    As far as I know there are no standardized methods of providing the provision keys for openthread. Are you able to close the network, only allowing certain devices that contain the correct keys to join? 

    What I am really asking is whether this is the question, or whether the question is if we have any suggestions on how to transfer the keys over BLE.

    Best regards,

    Edvin

  • Hi Edvin,

    I just wanted to know if there was a good way to commission a new device to join an existing Thread network using Bluetooth.

    For example, I was thinking of doing one of the following:
    - connect in Bluetooth to the new device (to add to the Thread network) and send it all the credentials of the Thread network
    - or, connect in Bluetooth to a device in the Thread network and send it a command to activate the "commissioner" by providing it with the uid64 of the device to be added and its pskd. Then, I will connect in Bluetooth to the new device to activate the "joiner" to start the commissioning.

    So the question is: is this a good way to do it?

    I started by testing the second solution but I can't start the "Commissioner".
    My application is based on the example "ble_thread_dyn_mtd_coap_cli_pca10056_s140" but when I run the function "otCommissionerStart (...)" it returns "OT_ERROR_ALREADY" (Commissioner is already started).
    So I ignore this error and I run "otCommissionerAddJoiner (...)" but it returns "OT_ERROR_INVALID_STATE" (The commissioner is not active).
    Do you have any idea on how to fix this problem?

    Thank you

  • There is no standardized way to do it in Thread 1.1 (which is what we currently support). I believe Thread 1.2. is planned, but I don't have any details about the timeline here. In Thread 1.2. this will be part of the solution. 

    However, if you don't want to wait for this, then I suggest that you first try to do this without BLE, but hardcode some keys that will only allow certain devices to join, and when you have that working, then you can look into sending these keys over BLE.

    I believe you have to call otCommissionerAddJoiner() before otCommissionerStart(), or alternatively call otCommissionerStop() -> otCommissionerAddJoiner() -> otCommissionerStart().

    BR,
    Edvin

  • Thank you very much for all this advices.

    Unfortunately, for my test I always have the same error when inverting... But that's normal, in the documentation (

    https://openthread.io/reference/group/api-commissioner#otcommissioneraddjoiner), they said to start the commissioner before to add a joiner.

    Do you have another idea?

    Thank you
Reply Children
  • Hello,

    Do you happen to have a project that I can run on a DK and test this on? If not, I can look into it next week, but it will be quicker if it is easily reproducible.

    Best regards,

    Edvin

  • Hello Edvin,

    Yes you can test this on the example "ble_thread_dyn_mtd_coap_cli_pca10056_s140".

    For example, after initializing the thread by auto-commissioning, execute the following functions to create a new network and commission a new device:

    otError error = OT_ERROR_NONE;  
    
    //Creation of a new dataset:
    error = otDatasetCreateNewNetwork(thread_ot_instance_get(), &sDataset);
    ASSERT(error == OT_ERROR_NONE);
    
    //Active the new dataset:
    error = otDatasetSetActive(thread_ot_instance_get(), &sDataset);
    ASSERT(error == OT_ERROR_NONE);
    
    error = otIp6SetEnabled(thread_ot_instance_get(), true);
    ASSERT(error == OT_ERROR_NONE);
    error = otThreadSetEnabled(thread_ot_instance_get(), true);
    ASSERT(error == OT_ERROR_NONE);
    
    error = otCommissionerStart(thread_ot_instance_get(), NULL, NULL, thread_ot_instance_get());
    ASSERT((error == OT_ERROR_NONE) || (error == OT_ERROR_ALREADY)); 
    
    uint8_t eui64[8];  
    for(int i=0; i<8; i++)
    {
        eui64[i]=i;
    }
    error = otCommissionerAddJoiner(thread_ot_instance_get(), &eui64, "N0RD1C", 120);
    ASSERT(error == OT_ERROR_NONE);

  • Hello,

    I see. I also struggle with the return values of these calls. I did some other changes to the project, such as disabling autostart by setting .autostart_disable = true in thread_instance_init():

    static void thread_instance_init(void)
    {
        thread_configuration_t thread_configuration =
        {
            .radio_mode            = THREAD_RADIO_MODE_RX_OFF_WHEN_IDLE,
            .autocommissioning     = true,
            .poll_period           = 2500,
            .default_child_timeout = 10,
            .autostart_disable     = true
        };
    
        thread_init(&thread_configuration);
        thread_state_changed_callback_set(thread_state_changed_callback);
    }

    I see that it makes a difference if I call otCommissionerStart() or not, because it gives a different callback to thread_state_changed_callback(), but it still returns the error, and so does otCommissionerAddJoiner().

    I have forwarded this to our Thread team. I'll let you know when I hear from them.

    Best regards,

    Edvin

  • Ok I await your response.

    Thank you very much for your help.

  • Hi,

    Sorry for hijacking this thread but I have similar issue and I want to know answer of original question of thread.

    I am facing similar issue. I am using ble_thread_dyn_proximity_uart_pca10056_s140 as I want to use COAP server as commissioner. as this project included optimized FTD Open thread library by default and I want it to be a commissioner so I removed it and added FTD library. and modified code as I understand commissioning process.    

    When I call otCommissionerStart() it returns OT_ERROR_ALREADY and another thing is that if I call otInstanceFactoryReset(thread_ot_instance_get()); it jumps to error handler.

    I am attaching my code for your review. What I want to do is commission a new device to a  network.,ble_thread_dyn_proximity_SR_COAP_Server.rar

    Regards,

    Hardik Harpal      

Related