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.

How to move one network from one dongle to another one.

Other Parts Discussed in Thread: SYSCONFIG, Z-STACK

Hi!

I have a simple question, picture this scenario.

I have a dongle, create a network, pair my devices and then after some period of time I decide to change the dongle.

Is there any way to move the network from one dongle to another one? So I don't have to pair my devices again?

Best Regards,

Ayman Hammou

  • Hi YiKai.

    Thanks for the link.

    I have a SonOff Dongle and the Cloning Tool doesn't seem to recognize them. It is probably due to the UARTToUSB Chip inside it.

    Any idea on how to get around this?

  • Make sure you have ZNP running on your dongle and baudrate is set properly 

  • I do have ZNP running on it.

    It doesn't identify the dongles.

  • Maybe you should use TI LaunchPad to test this first.

  • After some modifications to the python code I got it running. The UARTToUSB chip is the cause of it to not work.

    The writing procedure goes all right until it has to write ZCD_NV_EX_TCLK_TABLE. Any idea on why?

  • Hi Ayman,

    Your ZNP must have MT_SYS_KEY_MANAGEMENT defined.

    Regards,
    Ryan

  • How do I check if it has it?

  • It will typically be defined in either Project Properties -> CCS Build -> Arm Compiler -> Predefined Symbols or Stack/Config/znp_cnf.opts.  It is not enabled in most default builds.

    Regards,
    Ryan

  • Well. I have sent over 200 Dongles to clients without the MT_SYS_KEY_MANAGEMENT flag defined.

    Is it necessary or I can clone the dongle without it?

  • The Trust Center Link Key Table, ZCD_NV_EX_TCLK_TABLE, includes the TX/RX frame counters, extended address, key attributes/type, and the seed shift index of the corresponding devices added to the network.  Like other NV memory required content, this information is necessary to retain devices from the existing network.

    Regards,
    Ryan

  • This is the CLI Output of a reading:

    Success: Data Read for ZCD_NV_PANID
    Success: Data Read for ZCD_NV_EXTADDR
    Success: Data Read for ZCD_NV_EXTENDED_PAN_ID
    Success: Data Read for ZCD_NV_BDBNODEISONANETWORK
    Success: Data Read for ZCD_NV_NIB
    Failure: Could not read ZCD_NV_NWK_ACTIVE_KEY_INFO (610802)
    Failure: Could not read ZCD_NV_NWK_ALTERN_KEY_INFO (610802)
    Failure: Could not read from: ZCD_NV_EX_NWK_SEC_MATERIAL_TABLE
    Failure: Could not read from: ZCD_NV_EX_TCLK_TABLE
    Failure: Could not read from: ZCD_NV_EX_TCLK_IC_TABLE
    Failure: Could not read ZCD_NV_GROUP_TABLE (610802)

    Seems like the problem is also for other NV Elements.

  • This definition will affect access to most key-related NV items.

    Regards,
    Ryan

  • Well, I've added "-DMT_SYS_KEY_MANAGEMENT" to the config file, built the hex and flashed it, but doesn't seem to work.

  • Make sure to clean the project before rebuilding, test with a LaunchPad, and erase all flash memory before re-programming. 

    Regards,
    Ryan

  • Made no difference.

  • Do you test this with LaunchPad first?

  • Nope.

    I don't have one.

  • These are the flag enabled.

    -DMAC_CFG_APP_PENDING_QUEUE=TRUE
    -DMAC_CFG_TX_DATA_MAX=5
    -DMAC_CFG_TX_MAX=8
    -DMAC_CFG_RX_MAX=5
    
    -DOSAL_NV_EXTENDED
    -DADDRMGR_NV_SINGLES
    -DBINDINGTABLE_NV_SINGLES
    -DASSOCLIST_NV_SINGLES
    
    -DZSTACK_DEVICE_BUILD="(DEVICE_BUILD_COORDINATOR | DEVICE_BUILD_ROUTER | DEVICE_BUILD_ENDDEVICE)"
    
    -DNWK_AUTO_POLL
    
    -DZNP_UART_BAUD=HAL_UART_BR_115200
    
    -DZIGBEEPRO
    -DZIGBEE_FRAGMENTATION
    -DINTER_PAN
    
    -DMT_UTIL_FUNC
    
    -DMT_SYS_FUNC
    
    -DMT_AF_FUNC
    
    -DMT_ZDO_CB_FUNC
    -DMT_ZDO_FUNC
    -DMT_ZDO_MGMT
    -DMT_ZDO_EXTENSIONS
    
    -DMT_GP_CB_FUNC
    
    -DMT_APP_CNF_FUNC
    
    -DMT_SYS_KEY_MANAGEMENT

  • Please add -DFEATURE_NVEXID (and possibly turn off optimizations from your CCS Compiler for a better debugging experience) before rebuilding.  Note that ZCD_NV_EX_TCLK_IC_TABLE will not be read if Install Codes are not used, and ZCD_NV_GROUP_TABLE should be renamed ZCD_NV_EX_GROUP_TABLE in config_nv_regions.txt and be located at Item ID 0x0008, Sys ID 0x01, Sub ID 0x0000, and Entries equivalent to SysConfig -> Z-Stack -> MAx Table Sizes -> Group Table Size.  Attached is an example obtained after making the necessary changes.

    read_content.txt
    NV Region                            : Item ID      : Sys ID     : Sub ID      : Length      : Data
    ZCD_NV_PANID*                        : 0x0083                                  : 0x02        : 11de
    ZCD_NV_EXTADDR*                      : 0x0001                                  : 0x08        : 00124b001ca15a05
    ZCD_NV_EXTENDED_PAN_ID*              : 0x002D                                  : 0x08        : 00124b001ca15a05
    ZCD_NV_BDBNODEISONANETWORK*          : 0x0055                                  : 0x01        : 01
    ZCD_NV_NIB*                          : 0x0021                                  : 0x74        : 0000093b000000010a000001030f0000000000000000000000000000000000000000000000000000000000000000000000000100124b001ca15a0500000000010000000100040f0f00000800000811de00000000000000000000000b0000001e05020007008f0105010000001e00150f1502054e
    ZCD_NV_NWK_ACTIVE_KEY_INFO*          : 0x003A                                  : 0x11        : 2e55d742bb393d3b30fc184e7869032200
    ZCD_NV_NWK_ALTERN_KEY_INFO*          : 0x003B                                  : 0x11        : 2e55d742bb393d3b30fc184e7869032200
    ZCD_NV_EX_NWK_SEC_MATERIAL_TABLE*    : 0x0007       : 0x01       : 0x0000      : 0x0c        : 00124b001ca15a0500000db0
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0000      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0001      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0002      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0003      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0004      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0005      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0006      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0007      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0008      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0009      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x000A      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x000B      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x000C      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x000D      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x000E      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x000F      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0010      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0011      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0012      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0013      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0014      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0015      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0016      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0017      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0018      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0019      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x001A      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x001B      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x001C      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x001D      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x001E      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x001F      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0020      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0021      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0022      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0023      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0024      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0025      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0026      : 0x14        : 000000ff00000000000000000000000000000000
    ZCD_NV_EX_TCLK_TABLE*                : 0x0004       : 0x01       : 0x0027      : 0x14        : 0003000200124b0014f9c269000000000000002c
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x0000      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x0001      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x0002      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x0003      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x0004      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x0005      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x0006      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x0007      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x0008      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x0009      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x000A      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x000B      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x000C      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x000D      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x000E      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    ZCD_NV_EX_GROUP_TABLE*               : 0x0008       : 0x01       : 0x000F      : 0x14        : ffffffffffffffffffffffffffffffffffffffff
    

    Regards,
    Ryan

  • Ryan. 

    Thanks for the suggestion, now the reading works, but when it comes to cloning I get this result:

    Success: Data Read for ZCD_NV_PANID
    Success: Data Read for ZCD_NV_EXTADDR
    Success: Data Read for ZCD_NV_EXTENDED_PAN_ID
    Success: Data Read for ZCD_NV_BDBNODEISONANETWORK
    Success: Data Read for ZCD_NV_NIB
    Success: Data Read for ZCD_NV_NWK_ACTIVE_KEY_INFO
    Success: Data Read for ZCD_NV_NWK_ALTERN_KEY_INFO
    Success: Data Read for  ZCD_NV_EX_NWK_SEC_MATERIAL_TABLE
    Success: Data Read for  ZCD_NV_EX_TCLK_TABLE
    Failure: Could not read from: ZCD_NV_EX_TCLK_IC_TABLE
    Success: Data Read for  ZCD_NV_EX_GROUP_TABLE
    Read Complete. Refer to read_content.txt to view results.
    Success: Formed the Network
    Failure: Could not write to: ZCD_NV_PANID (Empty Return)
    Failure: Could not write to: ZCD_NV_EXTADDR (Empty Return)
    Failure: Could not write to: ZCD_NV_EXTENDED_PAN_ID (Empty Return)
    Failure: Could not write to: ZCD_NV_BDBNODEISONANETWORK (Empty Return)
    Failure: Could not write to: ZCD_NV_NIB (Empty Return)
    Failure: Could not write to: ZCD_NV_NWK_ACTIVE_KEY_INFO (Empty Return)
    Success: Wrote ZCD_NV_NWK_ALTERN_KEY_INFO to Memory
    Success: Wrote ZCD_NV_EX_NWK_SEC_MATERIAL_TABLE to Memory
    Success: Wrote ZCD_NV_EX_TCLK_TABLE to Memory
    Success: Wrote ZCD_NV_EX_GROUP_TABLE to Memory

    Is it ok if these many sys_nv_write fails?

  • This is not the expected result.  Make sure that your first ZNP/ZC has a valid network formed.  Then the second ZNP/ZC should have all of its memory erased before flashing a new image.  Next use the TI Zigbee Network Cloning Tool's "Tools" -> "Form Network" option to initialize the second ZNP's NV information before using "Clone Content" to successfully copy over all pertinent NV memory, such as with my example:

    While in operation this window will be frozen until completion.
    2022-12-19 12:41:55.781855
    Success: Data Read for ZCD_NV_PANID
    Success: Data Read for ZCD_NV_EXTADDR
    Success: Data Read for ZCD_NV_EXTENDED_PAN_ID
    Success: Data Read for ZCD_NV_BDBNODEISONANETWORK
    Success: Data Read for ZCD_NV_NIB
    Success: Data Read for ZCD_NV_NWK_ACTIVE_KEY_INFO
    Success: Data Read for ZCD_NV_NWK_ALTERN_KEY_INFO
    Success: Data Read for  ZCD_NV_EX_NWK_SEC_MATERIAL_TABLE
    Success: Data Read for  ZCD_NV_EX_TCLK_TABLE
    Failure: Could not read from: ZCD_NV_EX_TCLK_IC_TABLE
    Success: Data Read for  ZCD_NV_EX_GROUP_TABLE
    Read Complete. Go to [View -> Read File] to see content
    Success: Wrote ZCD_NV_PANID to Memory
    Success: Wrote ZCD_NV_EXTADDR to Memory
    Success: Wrote ZCD_NV_EXTENDED_PAN_ID to Memory
    Success: Wrote ZCD_NV_BDBNODEISONANETWORK to Memory
    Success: Wrote ZCD_NV_NIB to Memory
    Success: Wrote ZCD_NV_NWK_ACTIVE_KEY_INFO to Memory
    Success: Wrote ZCD_NV_NWK_ALTERN_KEY_INFO to Memory
    Success: Wrote ZCD_NV_EX_NWK_SEC_MATERIAL_TABLE to Memory
    Success: Wrote ZCD_NV_EX_TCLK_TABLE to Memory
    Success: Wrote ZCD_NV_EX_GROUP_TABLE to Memory
    Please Power Cycle/Restart the new ZC to complete the procedure.
    Ensure to do a physical reset if it is the first time restarting the device after
    programming with an XDS110. If using a LaunchPad the reset button may be pressed.
    2022-12-19 12:41:56.701965
    Window is now operational.

    Regards,
    Ryan

  • Well, I discovered what caused the Failed Write and fixed it.

    A list of suggestions:

    • Modify the script and the tool to accept also dongles that have Bridges Chip like the SonOff Dongle.
    • A lot of dongles after the network formation send a 0x00; the script check after reading 2 bytes if the first byte is 0xfe and decide to continue. after the network formation the first packet is 0x00FE and it  is a valid packet but has the 0x00 from the network formation, which causes the script to not detect the packet. The remaining parts of the packet cause the writes to fail.
      • Proposed Fix: 
        def read_response(port):
            buf_hex = []
            try:
                buf = port.read(2)  # Read the SOF and LEN
                buf = buf.hex()  # Convert read data to a hexadecimal string
                if buf[0:2] == 'fe':  # Verify the SOF byte
                    buf2 = port.read(int(buf[2:4], 16) + 3)  # Read the rest of the frame + CMD0/CMD1/FCS
                    buf_hex = buf + buf2.hex()  # Append the rest of the frame
                    buf_hex = buf_hex[2: len(buf_hex)]  # Remove the SOF byte
                elif buf[0:2] == "00" and buf[2:4] == "fe":
                    length = port.read(1)
                    ll=int.from_bytes(length, byteorder = "big")
                    buf2 = port.read(ll + 3)
                    buf_hex = buf + buf2.hex()
                    buf_hex = buf_hex[3:len(buf_hex)]
            except ValueError:        
                buf_hex = []
            return buf_hex