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.

Source Address assignment

Other Parts Discussed in Thread: CC2530, Z-STACK

Hi Friends,

                  I am trying to assign Source Address in coordinator.

                  Give some idea about assign Source Address. 

  • What do you mean trying to assign source address? Do you mean you want to assign short address to a device when it joins coordinator's network? If so, I would tell you that you can't do that.

  • Hi,

    as Yikai said, ZigBee Pro relies on stochastic addressing scheme, ie the address is assigned by the parent randomly to the device joining. In case of an address conflict, there's a procedure called address conflict resolution that takes place.

    Only coordinators have fixed addresses, and that address is 0x0.

    Thanks,

    TheDarkSide

  • Hi Friend,

                   Thanks for your replay and Sorry to ask the last question.

                    I want to send data to a particular ED from my coordinator,So i want to know how to assign                        destination address in coordinator in cc2530 using z stack.

  • When ZED joins ZC, It will broadcast end node announcement with its short address. You should keep it and use it as destination address for your application later.

  • Hi Yikai,

                     Thanks for your answer.

    I am beginner in Z stack,actually i have two cc2530 in our own board,and i changed the key settings for my board.Because i want to press S4 Switch on any one of the board,And i download the ZC and ZED code in either boards.And using packet sniffer i saw the packets.

    when i on the two boards

    1.ZC send Beacon request.

    2.ZED also send Beacon request.

    3.Zc sending some DATA packets (in APS frame i saw it's broadcast some data)

    4.ZED sending DATA request continuosly.

    5.After pressing SW4 the ZC send some super frame with GTS field also.

    6.And when i pressing SW4 ZC sending some different DATA packets.

    -From this packet i saw both of them running in same pan id 

    1.My Question is these two devices ZC and ZED are joined or not.

    2.How can i know from Packet Sniffer.

  • 1. ZC shouldn't send beacon.

    2. If ZED joins ZC, you should see ZED doing polling.

  • Hi YiKai chean,

                              How to i assign the short address for the end device before compiling.

      

  • Hi Siva,

              This question is already answered, You cannot assign short address of End Device. As End device joins to Network, ZC will broadcast the Short Address. Then your Application can know the Short Address by End node announcement by End Device.

     The Same thing is Yikai also told "When ZED joins ZC, It will broadcast end node announcement with its short address. You should keep it and use it as destination address for your application later."

  • Hi Sivasankar,

    You can't assign short address. I think TheDarkSide had given you the following answer.

    ZigBee Pro relies on stochastic addressing scheme, ie the address is assigned by the parent randomly to the device joining. In case of an address conflict, there's a procedure called address conflict resolution that takes place.

    Only coordinators have fixed addresses, and that address is 0x0.

  • Hi Friend,

                   Then how can i get the short address by coding.

  • Hi YiKai Chen,

                            In my project we are try to using one ZC and Many ZED device,So i will send Af Datarequest function like       address mode =ADD16bit and short address = end device short address.

    So how to i get the ZED address to put my code (or) Please send any link to Example code for sending data to particular ZED. 

  • So your Question is, how can you identified what short address is assigned to particular End Devices. So that you can include that address if you want to send data to particular End device. Right.

      If Yes, Then there are different Method for it. One of the Method is, Each Device Identity will be in the Simple Descriptor table. So as End Node announce came put a query for Simple Desc. Then you can Store those address for further communication.

     For Example, There is a Network with 1 ZC and 4 ZED. After End Node Announcement, End node announce will have short Address. Since you don't know. Whose Address is that. Then with that short Address, you can ask Simple Desc Req(Asking That Device to tell it's Identity). Then it will respond with Simple Dec rsp. (If ZED 1 has Temperature Sensor, then there Should be Cluster ID of Temp Sensor in the Simple Desc Table. Check the Cluster ID, If it is Temperature you can Store that Address as ZED1 Address). Like wise you need to do for Every End node Announcement.

    Short Flow Steps:

                  ZC Create N/w-> ZED joins the N/w->ZC Assign Short Address and BroadCast(Ex 0x12AB)->ZED tells/broadcast the shortAddress(0x12AB) to ZC after it receive from it->ZC sends Simple Desc Req to that Short Address(0x12AB)->ZC will get Response from ZED(0x12AB)->Check Cluster ID/End Points/Device Type etc..->If Matches, Store the address.

      Like wise you will get 5 Announcement if you have 5 ZED.

    Note:-

             Make Sure End device should have at least any one field as Unique in Simple Desc Table. So that your application can differentiate

  • hi

    I meet a problem ,could you give some ideas

    the coordinator setup a net ,all Dev join the net ,then power down the coordinator ,when I turn on the coordinator again 。the PANID changed 。

    I want to keep the former PANID 。

    best wishes

  • Hi Wade,

             If u want to fix your PAN ID, you can change in a file f8wConfig.cfg.

    /* Define the default PAN ID.
     *
     * Setting this to a value other than 0xFFFF causes
     * ZDO_COORD to use this value as its PAN ID and
     * Routers and end devices to join PAN with this ID
     */
    -DZDAPP_CONFIG_PAN_ID=0xFFFF

  • Hi Wade,

    I think you need to define NV_RESTORE in your projects to retain PANID after you turn off the power.

  • Hi sivasankar,

    I have answered how to get end node announcement in coordinator in http://e2e.ti.com/support/wireless_connectivity/f/158/p/291987/1020107.aspx#1020107

  • hi YiKai

    thanks for your help.

    now I define  NV_RESTORE  ,the problem  still exists,but I  change another  cc2530 , The PANID fixed .

    I think that the fash of  the former CC2530 perhaps is bad. 

    What is your opinion?

  • Hi Wade,

    If the fash of  the former CC2530 perhaps is bad, the CC2530 shouldn't run any application. My opinion is to check the source code to find out the root cause. You can try to set a breakpoint at "if ( networkStateNV == ZDO_INITDEV_RESTORED_NETWORK_STATE )" in ZDOInitDevice() and check the networkStateNV status.

  • hi

    I can not find ZDOInitDevice()     in zstack -2.5.1a

    edit ->find and replace->find in files

  • Hi Wade,

    ZDOInitDevice is in ZDApp.c.

  • Hi Friend,

                    According to your replay you mean that 

    1.ZC Assign Short Address and BroadCast

    2.ZC sends Simple Desc Req to that Short Address

    3.ZC will get Response from ZED

    These are happen automatic (specially ZC sends Simple Desc Req to that Short Address) or we will code for that.

    If yes where we write the code.

  • Hi sivasankar,

    1. It should be ZC assigns short address to device. Then, device will broadcast its short address.

    2. Simple description request is not sent automatically. You need to send the request by your application.

    To receive end node announcement in your coordinator, you need to register Device_annce by "ZDO_RegisterForZDOMsg(task_id, Device_annce);" in your init function and add "case Device_annce:" in XXX_ProcessZDOMsgs like the followings:

    case Device_annce:
    {

    ZDO_DeviceAnnce_t devAnnce;

    ZDO_ParseDeviceAnnce(inMsg, &devAnnce);
    //devAnnce.nwkAddr is the short address of device announced.

    //You can send Simple Description request here.

  • Hi YiKai Chen,

     

                           From your replay i put my code like this

    ZDO_DeviceAnnce_t devAnnce;

    switch(inMsg->clusterID)

    {

    case Device_annce:
    {
    ZDO_ParseDeviceAnnce( inMsg, &devAnnce );
      ZDP_SimpleDescReq(&dstAddr,devAnnce.nwkAddr, epInt, 0);
    }
    break;

    }

    I will try to send but i don't know how to assign

    ZDO_ParseDeviceAnnce( inMsg, &devAnnce ); ? So what is  devAnnce.nwkAddr=? 

    and 

    ZDP_SimpleDescReq(&dstAddr,devAnnce.nwkAddr, epInt, 0);

    in that function dstAddr=?,devAnnce.nwkAddr=?, epInt=?

  • Hi YiKai Chen,

     According to your replay my knowledge about ZC and ZED short address:

     1.We can't assign Short address and we can get only by Device announce by ZED ie ZC send the random nwk.address

         to ZED ,And ZED send the Device announce to ZC,In that Device announce are stored in ZC Binding table.

    2.And ZC send ZDO_ParseDeviceAnnce(inMsg, &devAnnce) function.

    3.And send ZDP_SimpleDescReq(&dstAddr,devAnnce.nwkAddr, epInt, 0) function

    My Question:

    1.I don't know the ZED nwk.address then how can i send the devAnnce.nwkAddr argument value?

    2.And I don't know the ZED nwk.address then how can i send the &dstAddr argument value?

    Please replay me.

     

  • 1. After you call ZDO_ParseDeviceAnnce( inMsg, &devAnnce ),  the short address will be store in deviance.nwkAddr.

    2. Before you can call ZDP_SimpleDescReq, you need to use ZDP_ActiveEPReq to request active end point first. The  parameters are describe in Z-Stack API.pdf 

  • Hi YiKai Chen,

                      afStatus_t ZDP_ActiveEPReq( zAddrType_t *dstAddr, uint16 NWKAddrOfInterest, byte SecuritySuite );

    1.I saw that function and actually what is different between dstAddr and short address  and why we need 2 different argument ,because dstAddr object also having address mode and network short address also.

    2.dstAddr.addrMode = (afAddrMode_t)AddrNotPresent;

       dstAddr .endPoint = 0;

      dstAddr .addr.shortAddr = xxxxx;


    So hear also we gave the shortAddr value and why we give network address as a 2nd argument because all of them same.

     

  • In general, parameter NWKAddrOfInterest is the same one in dstAddr.addr.shortAddr. I don't have source code of Z-Stack so no idea why these API need it. From my point of view, dstAddr is must but NWKAddrOfInterest is not needed.

  • Yes, in practice NWKAddrOfInterest is the same as destAddr.addr.shortAddr field (by the way, I noticed that the address mode in this structure was probably wrong, as it must be set to destAddr.addrMode = Addr16Bit).

    Now, to answer the question why we we have twice the same parameter, which seems to be redundant.

    This is because in theory ZigBee, service discovery can be done unicast or broadcast.

    In case it is done 'broadcast', then the address mode must be set to broadcast (and the short address field is irrelevant). In which case, the field NWKAddrOfInterest is relevant to identify a targeted device to respond to this request. From ZigBee specification, Device and Service Discovery overview chapter

    "Service Discovery: Provides the ability for a device to determine servicesoffered by other devices on the PAN.

    • Service Discovery messages can be used in one of two ways:


    Broadcast addressed: Due to the volume of information that could be
    returned, only the individual device or the primary discovery cache shall
    respond with the matching criteria established in the request. The primary
    discovery cache shall only respond in this case if it holds cached
    discovery information for the NWKAddrOfInterest from the request

    Unicast addressed: Only the specified device responds. 

    Now, in practice, discovery cache support is an optional feature in typical ZigBee implementations and what happens is that, since messages like Active_EP_Req are sent unicast, they two fields are in practice the same and seem redundant.

    As a stack provider however, we must support both broadcast and unicast address and with all the consequential modes (ie supporting NWKAddrOfInterest )

    I know it may sound redundant and in this case cumbersome, but we are basically enabling all possible options the ZigBee spec accounts for.

    Thanks,

    TheDarkSide

     

  • Hi ,

    It is great to have these clear explanation.

  • Hi YiKai Chen,

                            I am beginner in Z Stack and in my company they gave one simple task is send one data from ZC to ZED and ZED to ZC,SO i am putting so many function like(ZDP_SimpleDescReq,ZDO_ParseDeviceAnnce,ZDP_ActiveEPReq)

    from your suggestion only.

    Even i don't know what are the function need to add.So how can i know that ?

    And i read many pdfs like Zstack API,Zstack ZCL API,Simple SampleApplication and developers Guide.

    Or where to see the similar examples in cc2530 Z Stack?

  • Hi Siva,

    if you want to find an example on how to use the service discovery process (like what happens in gateway, where the device first discovers the endpoints available and then the endpoint descriptors to see the services of the remote node), please take a look at the SampleBridge application in Z-stack Lighting, file zll_samplebridge.c

    However, if you simply wants to send data between two devices you can also use the EZ mode feature of Home Automation 1.2.0, where service discovery is done through matching cluster discovery (and not through endpoint discovery).

    The Sample Light/Sample switch application in Z-stack Home 1.2.0 can serve as an example of a way to discover matching clusters as everything is already implemented. Chapter 7 in Z-stack Home Developer's guide can provide additional details on EZ mode, though i would recommend you start by taking a look at the examples there.

    Thanks,

    TheDarkSide

  • Hi Friend,

                   Thanks for your replay,but in my office my manager told to me don't use the Home Automation for some other reason but i don't know the reason.So he give the task only doing in the Generic App only.

    So please give any suggestion how to do the simple task in Generic App only.

    My Simple task is;

    1.ZC send data to one ZED

    2.ZED send data to ZC

    I know it's easy for you,but as a beginner what are the functions need use because each and every time Ti forum suggest add so many function.So please give any sample code or what are the function we use in that project from the Z Stack pdf API's.

  • Even though i am not really sure i fully understand the rationale of why you can't simply look at existing examples of Home Automation or LightLink as reference to do what you want to do, I'll give you a list of simple API your application would need to use. 

    If you can control all the nodes in your network, just create the an application task on the coordinator and end node that has the same endpoint number, for the sake of simplicity.

    In your coordinator code, please put the following:

    1. ZDO_RegisterForZDOMsg( your_application_taskid, Device_annce ) // This is so your application can receive callbacks from ZDO layer when a device announce message is received
    2. In your processing function, process ZDO_CB_MSG messages from ZDO and create a function like YOUR_APPLICATION_ProcessZDOMsg( (zdoIncomingMsg_t *)pMsg ). In that function, add a case for  
      1. case Device_annce:
    3. In case a Device_annce is received, call ZDO_ParseDeviceAnnce( inMsg, &devAnnce ) to retrieve the nwk address of the device that registers to the network through the coordinator

    Once you have that device address, then simply if you want to send data call AF_DataRequest() with address mode Addr16Bit and shortAddr equal to the destination address. In case of data that must be sent by the ED to the coordinator, the shortAddr is 0x0 as coordinator has fixed address. In case of data from coordinator to end device, please use the address you retrieved from ZDO_ParseDeviceAnnce API. As for endpoint number, if you control the application on both ends, please use the same for simplicity.

    So in the end, if you want to do a simple data send between two nodes, you just need to use 3 API (register to get ZDO messages, parse the Device_annce ZDP message and send data) and create a function that parses the messages from the ZDO layer in your task processing loop.

    These API are documented in the Z-stack API document, as you requested. I still recommend you to take a look at our examples of sample applications in our products (Home 1.2.0, Lighting 1.0.2 and Energy 1.1.0) so you can take a look at how those APIs are called and interlaced with application node. 

    I hope it is clear now.

    Thanks,

    TheDarkSide

  • Hi sivasankar,

    What is your question?

  • Hi Friends,

                     Thanks for your replays and from your ideas only i can get the these packets in my packet sniffer.

    1.i)First image ZED send Association req

    ii)Again ZED send Data request

    iii)ZC send Short addre association status =successful 

    2. i)Second image ZED send some data.

       ii)And ZC send some data.

      iii)After that ZED send Data Request continuously .

    My Question:

    1.   I want to know i am going correct way or not.

     2. If the data Request continuously come by the reason of AF_DataRequest() reason or not.

  • 1. From your sniffer snapshot, your ZED joins ZC without problem.

    2. The continuous data request comes from polling rate settings.

  • Hi YiKai Chen,

         1.I send the "Hello world" message in AF_DataRequest() function where can i see the message in Packet  Sniffer frame fields because there is so many fields in Packet Sniffer capturing data.

          

  • Hi YiKai Chen,

                           Thanks for your all replays and now i can send data from ZC to single ZED and ZED to ZC.

    And my manager give the task send data from ZED to ZED.So i want to know how the one ZED device know the another ZED short address.

     

  • You can use binding to do it.

  • hi YiKai Chen

    another problem 

    in my project , i define  NWK_MAX_DEVICE_LIST  is 40 (#define NWK_MAX_DEVICE_LIST  40). this means 

    Maximum number of devices in the Assoc/Device list is 40 . but,

    in nwk_globals.c ,

    uint8 CskipRtrs[MAX_NODE_DEPTH+1] = {6,6,6,6,6,0};
    uint8 CskipChldrn[MAX_NODE_DEPTH+1] = {20,20,20,20,20,0};

    the total number of devices  is more than 40 . what is the difference of them?

    Please replay me.

     thank you very much 

                                                                                                                      WADE

     

  • NWK_MAX_DEVICE_LIST=40 means the maximum association device count of ZC or ZR is 40 not the the count of all devices in the network.

  • thank  you!!!!

  • Hi,

    as Yikai said NWK_MAX_DEVICE_LIST defines the number of devices in the association device list (which again does not mean the total number of devices in the network)

    The arrays you are mentioning (CskipChldrn, CskipRtrs) are relvant for tree addressing, which is an addressing  and routing scheme that is used in ZigBee non-Pro and not relevant fro ZIgBee Pro, which is the most popular ZigBee core profile nowadays. As a stack provider we support both Pro and non-Pro so this is the reason why you see these arrays but you won't need to use them.

    Thanks,

    TheDarkSide

  • hi  TheDarkSide

    Thank you very much for your back   !

  • Hi  

              do you have the sample code of IAS_ZONE , IAS_WD , IAS_CIE(Homeautomation 1.21 profile)

             i have request TI for serval weeks,but there is not any Msg for me。

             could you please give me a hand ?

             

             if you don not have the complete code ,could you please show me the flow chart generally?

    thanks