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

simple coap example and Thread network

Dear nordic,

I have some doubts in this example based on thread. Thread says one node join to the network using by commissioning.

1. In this example where we start commissioning? its confusing me i checked this example node can join any time in this network but how its possible where this commissioning happen?

2. And i am little bit confusing in Preshared key in open thread. How this PSK generated and HOW this PSK used to Authenticate for commissioning?

3.For generation of PSK network name and pan id is used . Is it possible to set PSK manually?

  • Hi.

    All of the examples in the SDK are pre-commissioned, that means that the Master Key and Mesh Local Prefix is hardcoded by default.

    Could you take a look at this section in the documentation?

    Best regards,

    Andreas

  • Thanks for your replay sir, but i have doubt in this example i think this example is not related to border router. Its just start commissioning first time and start a thread network after another device enter to this network. but my question is where in this example(simple coap server and simple coap client start commissioning how this work ) can you describe how the device join in this network?

    where start commissioning?

    where start joiner joining to network?

    I think the first device turn to leader and start thread network. the remaining device enter to this network but where the leader start commissioning(i searched in that code i didn't find anywhere)?

  • Hi Alan.

    I'm waiting on response from the development team on this question.

    Best regards,

    Andreas

  • Hello ,

    First of all, thank you for using nRF5 SDK for Thread and Zigbee. In the beginning, I would encourage you to switch to the newest version (3.0.0) just recently released.

    What I pulled out from your description is that you are using simple_coap_client and simple_coap_server examples. Those examples are configured to be pre-commissioned. The rationale behind this decision was to enable prototyping application without a need of time costly commissioning each time. By pre-commissioned, I mean that device just after first boot receives hard-coded configuration that includes e.g.:
    PHY Channel, Pan ID, Master Key etc. Effectively you don't see the commissiong process in those examples because it is skipped, and normal network attachment starts.

    All SDK examples use the generic thread_utils module that exposes API for specifying if pre-commissioning should be done or not. In case this option is disabled, the normal commissioning has to be performed.

    See this link to get more details about commissioning in Thread.

    There are two main in-band ways on how to commission a device to the network. The first one is to use an external commissioner (phone). The example on how to do that is well described here: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.thread_zigbee.v3.0.0%2Fthread_border_router.html&cp=5_2_2_6_0_6&anchor=br_commissioning

    The native commissioning, where the commissioner is one of the nodes in the network, you can test using two CLI nodes as follow:

    Node 1 (Commissioner - pre-commissioned):

    > factoryreset
    > panid 0xabcd
    Done
    > channel 13
    Done
    > masterkey 00112233445566778899aaaaaaaaaaaa
    Done
    > ifconfig up
    Done
    > thread start
    Done
    > state
    Leader (wait for this state)
    > commissioner start

    Node 2 (Joiner)

    > eui64
    aabbccddeeff1122


    Node 1 (Commissioner - pre-commissioned):

    > commissioner joiner add aabbccddeeff1122 PSKd123
    Done

    Node 2 (Joiner)

    > ifconfig up
    Done
    > joiner start PSKd123
    Done
    Join Successful!
    > thread start
    Done
    > state
    Child

    You can inspect code related with above commands here, so you can apply it with your project.

    In the end, you can also check our nfc_meshcop example which shows how to commission a device with the help of NFC which is used to retrieve EUI64 and PSK of the device. 

    When it comes to OpenThread and PSK generation. The PSK for the device (PSKd) is generated manually by the device itself (this is one of the parameters of this joiner function). More complicated is the second Pre-Shared Key type for Commissioner (PSKc). Indeed in order to create it you need information about Extended Pan Id and Network Name. You can read section 8.4.1.2.1 Derivation of PSKc for all details. This derivation happens automatically if you use an external commissioner (mobile phone with Thread Commissioning application). Although if you want to generate PSKc manually, there is a nice tool written in C++ for that - here.

    I hope that helps. Let me know if you need more information about commissioning a new device to the Thread network.

  • Hi, 

    I'm looking for the location of this hardcoding. I found the location of panid and channel setting but not the location of the network key hardcoding. Could you help me ? 

    By pre-commissioned, I mean that device just after first boot receives hard-coded configuration that includes e.g.:
    PHY Channel, Pan ID, Master Key etc. Effectively you don't see the commissiong process in those examples because it is skipped, and normal network attachment starts.
Related