This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2530: Automatic new network commissioning on startup

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK

Hi. I need to implement automatic commissioning on a router device, so that no pressing of a button to start commissioning is needed. I'd like it to work with touchlink, too.

Please help me turn the following pseudo-code into an actual code:

void zclMyApp_Init( byte task_id ) {

...

if ("previously connected to a coordinator or touchlink") {

    bdb_StartCommissioning("rejoin");

    if ("could not find the network anymore") {

        bdb_StartCommissioning("join another touchlink or coordinator");

    }

} else {

    bdb_StartCommissioning("join touchlink or coordinator");

}

...

}

  • You only need to call bdb_StartCommissioning in init function and Z-Stack would take care of rejoin case or new join case.

  • Hi Ra,

    You can check ZCD_NV_BDBNODEISONANETWORK to determine whether the device supposedly has network information stored in non-volatile memory, as this will be checked when setting BDB_COMMISSIONING_MODE_NWK_STEERING inside bdb_StartCommissioning.  This function should be called at the end of zcl*_Init and you should also confirm that NV_INIT and NV_RESTORE are defined.

    Regards,
    Ryan

  • Thanks, Ryan. This resolved the issue partially. What should I do to rejoin another network if the network previously connected to is no longer available?

  • We usually don’t try to join another network when previous network is no longer available since devices don’t have intelligence to know this. Basically, you can add button login such as hold device button for 3 seconds to factory reset previous network information on device itself and start joining new network.

  • Alongside YK's advice, you can set some logic (user input, timer expiration, etc.) to determine when to give up on the old network, clear the NV contents, and attempt to join a different network.

    Regards,
    Ryan