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.

ZC Clone and NV Restore and PANID +1

Other Parts Discussed in Thread: CC2530, Z-STACK

Home 1.2.1 - CC2530

Hi,

I am trying to copy the Coordinator NV items in order to restore a Coordinator upon hardware failure.

I am able to start the ZC, osal_nv_write a predefined PANID to NV Ram and SystemReset(). Then start as normal and the ZC starts on the predefined PANID. Great!

The problem lies with trying to stop the ZC incrementing the PANID by 1 when starting and finding Routers around on the PANID in NV Ram.

From reading the datasheets and forum's it's simply a matter of backing up the zgItemTable but that is not possible. I do not have much backup storage space available off the CC2530 and so I need to keep the storage space requirements as low as possible. I am not using bindings or security, do not need to be ZigBee compliant and do not need the ZC to come on-line seamlessly so do not need to worry about the Association Table. 

So in an attempt to come up with the absolute minimum list of back-up requirements I am systematically going through the list in ZComDef.h.

The Question: I am reading ZCD_NV_PANID but it returns 0xFFFF even after a successful ZED join. Where does Z-Stack save the PANID during runtime? I would expect it writes to ZCD_NV_PANID after forming the network but it seems not to.

As an alternative, is there a way to stop the ZC sending out a beacon (and therefore avoid the PANID +1) if it needs to start on the same network as other routers? I guess not due to the ZigBee protocol.

Many thanks,

Andy

  • Hi Andy,

    I'm assuming you are using ZNP.

    ZCD_NV_PANID is for storing a default PAN ID. it is not used for storing the active one. The active PAN ID is stored together with other network information in the network-information-block.

    You can read the active PAN ID using MT_ZDO_EXT_NWK_INFO command.

    Best regards,

    OD

  • Hi OD,

    Thank you for your reply. That makes sense.

    I am using an Anaren A2530E24C with my application running on-board.

    I cannot seem to load the correct NV Ram data so that I can restore from to a known and previous network. 

    Here is what I am doing:

    1) Let the ZC start up as normal and when a ZED joins, Device Annce calls a function which outputs a serial stream of data which is read from NV Ram.

    2) I then copy this data manually into a table, and enable a function to run once on first boot from programming, which will copy this table back into the NV Ram, then:

    zgWriteStartupOptions( FALSE, ZCD_STARTOPT_DEFAULT_NETWORK_STATE );
    SystemReset();

    3) Upon next boot ZDOInitDevice(0) is called as normal. Everything is fine until NLME_RestoreFromNV() in ZDApp.c which fails and forces a New Network State.

    Can you tell me what NLME_RestoreFromNV()  does to fail my attempt at restoring from NV?

    Hopefully this isn't too large to display here, but this are my tables as they stand - I have played about with various configurations and am trying to get it to work with the bare minimum:

    /**************************************************************************************
     ** This table is used to define which NV items are copied to a local table for storing
     ** over SPI for Coordinator clone.
     **************************************************************************************/
    const uint16 clone_nv_id[] =
    {
        // OSAL NV item IDs
        ZCD_NV_EXTADDR,                     //length 8
    //    ZCD_NV_BOOTCOUNTER,               //length 0
        ZCD_NV_STARTUP_OPTION,              //length 1
        ZCD_NV_START_DELAY,                 //length 1
    
        // NWK Layer NV item IDs
        ZCD_NV_NIB,                         //length 110
       ZCD_NV_DEVICE_LIST,                  //length 170
    //    ZCD_NV_ADDRMGR,                   //length 286
    //    ZCD_NV_POLL_RATE,
    //    ZCD_NV_QUEUED_POLL_RATE,
    //    ZCD_NV_RESPONSE_POLL_RATE,
    //    ZCD_NV_REJOIN_POLL_RATE,
    //    ZCD_NV_DATA_RETRIES,
    //    ZCD_NV_POLL_FAILURE_RETRIES,
    //    ZCD_NV_STACK_PROFILE,
    //    ZCD_NV_INDIRECT_MSG_TIMEOUT,
    //    ZCD_NV_ROUTE_EXPIRY_TIME,
        ZCD_NV_EXTENDED_PAN_ID,             //length 8
    //    ZCD_NV_BCAST_RETRIES,
    //    ZCD_NV_PASSIVE_ACK_TIMEOUT,
    //    ZCD_NV_BCAST_DELIVERY_TIME,
        ZCD_NV_NWK_MODE,                    //length 1
        ZCD_NV_CONCENTRATOR_ENABLE,         //length 1
        ZCD_NV_CONCENTRATOR_DISCOVERY,      //length 1
        ZCD_NV_CONCENTRATOR_RADIUS,         //length 1
        ZCD_NV_CONCENTRATOR_RC,             //length 1
        ZCD_NV_NWK_MGR_MODE,                //length 1
    //    ZCD_NV_SRC_RTG_EXPIRY_TIME,
    //    ZCD_NV_ROUTE_DISCOVERY_TIME,
    //    ZCD_NV_NWK_ACTIVE_KEY_INFO,
    //    ZCD_NV_NWK_ALTERN_KEY_INFO,
        ZCD_NV_ROUTER_OFF_ASSOC_CLEANUP,    //length 1
    //    ZCD_NV_NWK_LEAVE_REQ_ALLOWED,
        ZCD_NV_NWK_CHILD_AGE_ENABLE,
    //    ZCD_NV_DEVICE_LIST_KA_TIMEOUT,
    
        // APS Layer NV item IDs
    //    ZCD_NV_BINDING_TABLE,
    //    ZCD_NV_GROUP_TABLE,
    //    ZCD_NV_APS_FRAME_RETRIES,
    //    ZCD_NV_APS_ACK_WAIT_DURATION,
    //    ZCD_NV_APS_ACK_WAIT_MULTIPLIER,
    //    ZCD_NV_BINDING_TIME,
        ZCD_NV_APS_USE_EXT_PANID,           //length 8
        ZCD_NV_APS_USE_INSECURE_JOIN,
        ZCD_NV_COMMISSIONED_NWK_ADDR,       //length 2
    
    //    ZCD_NV_APS_NONMEMBER_RADIUS,
    //    ZCD_NV_APS_LINK_KEY_TABLE,
    //    ZCD_NV_APS_DUPREJ_TIMEOUT_INC,
    //    ZCD_NV_APS_DUPREJ_TIMEOUT_COUNT,
        ZCD_NV_APS_DUPREJ_TABLE_SIZE,
    
        // ZDO NV Item IDs
    //    ZCD_NV_USERDESC,                  //length 0
    //    ZCD_NV_NWKKEY,                    //length 23460
        ZCD_NV_PANID,                       //length 2
        ZCD_NV_CHANLIST,                    //length 4
    //    ZCD_NV_LEAVE_CTRL,                //length 0
        ZCD_NV_SCAN_DURATION,               //length 1
        ZCD_NV_LOGICAL_TYPE,                //length 1
        ZCD_NV_NWKMGR_MIN_TX,               //length 1
    //    ZCD_NV_NWKMGR_ADDR,               //length 0
    
        ZCD_NV_ZDO_DIRECT_CB                //length 1
    
    };
    
    //AB DEBUG
    
    unsigned char clone_test_array[MAX_CLONE_ARRAY_SIZE] =
    {
    
    144,
    220,
    56,
    3,
    0,
    75,
    18,
    0,
    0,
    10,
    93,
    5,
    2,
    0,
    20,
    0,
    0,
    30,
    0,
    0,
    0,
    0,
    0,
    1,
    143,
    30,
    0,
    2,
    5,
    90,
    254,
    255,
    0,
    254,
    255,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    254,
    255,
    0,
    0,
    0,
    0,
    0,
    15,
    15,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    144,
    220,
    56,
    3,
    0,
    75,
    18,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    2,
    0,
    15,
    3,
    1,
    1,
    0,
    10,
    1,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    255,
    144,
    220,
    56,
    3,
    0,
    75,
    18,
    0,
    2,
    1,
    0,
    10,
    1,
    1,
    0,
    1,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    1,
    254,
    255,
    5,
    0,
    255,
    255,
    0,
    128,
    16,
    2,
    5,
    0,
    0,
    0
    
    };