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.

Send data over Zigbee

Other Parts Discussed in Thread: CC2531

Hi,

I´m working with Home Automation Profile and I´ve sent the ON/OFF command to the light.

Now I need to send Data, so which function should I use? In fact I need to read the current and voltage levels and send then to the coordinator.

I think that the function to handle these Data must be implemented by me. However which function from the ZCL should I use to send them?

Regards.

  • Dears,

    There is no standard command to send current and voltage levels. You can define your proprietary ZCL_CLUSTER_ID/ATTRID and use zcl_SendReportCmd() to send out current /voltage levels.

    Regards!

    YK Chen

  • Hi,  I am also trying to get the HA profile to work.  Can you shed some light on the configuration, and setup you used to get the light application working please.

     

    Thanks.  KB

  • Hi, you can modify SampleLight project a little as the followings to make it work.

    First, Open SampleLight project and choose coordinator configuration. Build the coordinator, burn it into your EVB, and start the coordinator.

    Secondly, Change the SampleLight configuration to Router and add "if ( keys & HAL_KEY_SW_1 ) { zclGeneral_SendOnOff_CmdToggle(SAMPLELIGHT_ENDPOINT, &zclSampleLight_DstAddr, false, 0 );}"  insides zclSampleLight_HandleKeys(). Then, build the router and burn it into your anther EVB. Start the router and it should join coordinator.

    After these two steps, you can trigger SW1 on router EVB and it will send out a toggle command to coordinator and you will see the LED is toggled.

    Regards!

    YK Chen

  • Thanks Mr.Chen,

    Following your directions I edited the file and placed your code, but I receive the error:

    Error[Pe020]: identifier "zclSampleLight_DstAddr" is undefined

    C:\Texas Instruments\ZStack-EXP5438-2.5.0\Projects\zstack\HomeAutomation\SampleLight\Source\zcl_samplelight.c 268 
     

    Any Ideas?

     

    Thanks.  KB

  • Hi Ken,

    Yes, you need to declare zclSampleLight_DstAddr first and assign the destination address. It looks like the followings:

    afAddrType_t zclSampleLight_DstAddr;

    zclSampleLight_DstAddr.addrMode = afAddr16Bit;
    zclSampleLight_DstAddr.endPoint = YOUR_ENDPOINT;
    zclSampleLight_DstAddr.addr.shortAddr = DESTINATION_SHORT_ADDRESS;

    Regards!

    YK Chen


  • Thanks YK,

    I am trying to learn.  When I searched for a good place to put these commands I found:

    // Set destination address to indirect
      //zclSampleLight_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
      //zclSampleLight_DstAddr.endPoint = 0;
      //zclSampleLight_DstAddr.addr.shortAddr = 0;

    in zclSampleLight_Init(  )

    Is this the same idea?  Is this used when I do not want to assign addresses, but let coordinator do it?

     

    Ken

  • Hi YK,  it does not appear to have removed the error:

    Warning[Pe550]: variable "zclSampleLight_DstAddr" was set but never used C:\Users\Ken\Desktop\ZStack-LSR2.3.0-1.4.0\Projects\zstack\HomeAutomation\SampleLight\Source\zcl_samplelight.c 167

    Error[Pe020]: identifier "zclSampleLight_DstAddr" is undefined C:\Users\Ken\Desktop\ZStack-LSR2.3.0-1.4.0\Projects\zstack\HomeAutomation\SampleLight\Source\zcl_samplelight.c 274

    Error while running C/C++ compiler

  • Hi Ken,

    From your log, I see you use zclGeneral_SendOnOff_CmdToggle() at line 274 of your zcl_samplelight.c. Please declare zclSampleLight_DstAddr just before line 274 and assign all values in this data structure.

    Regards!

    YK Chen

  • Thanks YK,

    That did the trick. It compiled fine. I still cant get the radios to communicate. It may be my board config, as I am using two different dev boards. I can see the coordinator send messages when i press btn1 (on sniffer), but there is no ack from the router. The router keeps sending beacon. 

    Ken

  • Hi Ken,

    That's good news. For the router, please make sure it has joined the network of coordinator first. Then, make sure zclSampleLight_DstAddr.endPoint and zclSampleLight_DstAddr.addr.shortAddr is the endpoing and short address of router.If these are correct, it should work.

    Regards!

    YK Chen

  • Thanks again YK, can these values be any number, are they arbitrary? KB
  • Hi Ken,

    No, you have to specify the end point and short address correctly. When the router joins coordinator network, the coordinator will receive a end node announcement which contains the end point and address information. You can keep and use them on coordinator to send toggle command.

    Regards!

    YK Chen

  • Hi YK,

    I picked up another exp430f5438 board so they are identical.  I loaded software as you suggested, and it compiled fine.  I am unclear what values to include, as I was under the impression the coordinator picked the short address if this was set to "0".  Otherwise, for short address I can say for example "3" or 0x0003, and for end point I am unclear what to use since it is a router?

     

    Thanks.  Ken

  • Hi Ken,

    The default short address of coordinator is 0x0000. For router or end device, coordinator will receive end node announcement which contains the short address when any device joins the coordinator. So, you can use the short address from end node announcement to send toggle command. For end point, please use the same end point number inside your coordinator and router for your convenience and do not use 0x0 because it is reserved for system usage.

    Regards!

    YK Chen

  • Hi Ken,

    It seems that as you are starting up with your HA setting you might want to use a decent sniffer that can shorten your development time (this is what I did when setting up my ZigBee networks in its different profiles...).

    I'd suggest you to take a look at Perytons (www.perytons.com). They provide a 30 days free evaluation of their SW and also support the CC2531 USB dongle if you have the standard sniffer FW  set on it.
    When I use it I found it to be very informative since it also provides you information on packets updating information shown (like short addresses association, etc.) and they are pretty complete.

    They support ZHA including E@H as well as a nice list of the other ZigBee profiles out there.

    Good Luck!

  • Hi Avi,

    Do you have a price table about Perytons Zigbee Sniffer SW? I am interested in this tool.

    Regards!

    YK Chen

  • Dear YK,

    I have followed your suggestions, and still not been able to get the simple light connection to function.  When I use the sniffer, I can see both devices, but the router seems to only send out a continuous beacon.  Do you have any more advice, or can you point me to proper literature to set up the addressing?

     

    Thanks.  KB

  • Hi YK,

      Well we bought a single channel license with diversity (two dongles) quite a long time ago - called Peryton-D.

    I suggest you drop their support an e-mail and get the required info from them - support@perytons.com

  • Hi YK Chen,

    Here I am.

    I´ve stoped to work with ZigBee these last days.

    I´m reading the ZigBee Home Automation and Smart Energy profiles. And I was thinking about our last talk when you´ve said: "There is no standard command to send current and voltage levels. You can define your proprietary ZCL_CLUSTER_ID/ATTRID and use zcl_SendReportCmd() to send out current /voltage levels."

    Musn´t I use the ZCL_CLUSTER_ID_SE_SIMPLE_METERING (zcl.h) to make the voltage and current measurements?

    If so, do you know wich ATTR_ID can I use? Must I implement my own ATTR?

    Do you know what 'Application Groups' on zcl_general.h means and how must I use it?

    /*** Application Groups ***/
    #define APP_GROUP_AI                                        0x00 // Analog Input
    #define APP_GROUP_AO                                        0x01 // Analog Output
    #define APP_GROUP_AV                                        0x02 // Analog Value
    #define APP_GROUP_BI                                        0x03 // Binary Input
    #define APP_GROUP_BO                                        0x04 // Binary Output
    #define APP_GROUP_BV                                        0x05 // Binary Value
    #define APP_GROUP_MI                                        0x0D // Multistate Input
    #define APP_GROUP_MO                                        0x0E // Multistate Output
    #define APP_GROUP_MV                                        0x13 // Multistate Value

    Regards.

    Marconi.

  • Hi Marconi,

    Since Home automation and Smart Energy profile are different profiles, you can only use either one on your Zigbee devices. If you use home automation profile, There is no standard command to send current and voltage levels. You can define your proprietary ZCL_CLUSTER_ID/ATTRID and use zcl_SendReportCmd() to send out current /voltage levels. If you use smart energy profile, yes, you can use ZCL_CLUSTER_ID_SE_SIMPLE_METERING/ATTRID_SE_CURRENT_SUMMATION_DELIVERED/ATTRID_SE_INSTANTANEOUS_DEMAND to send out power consumption. For voltage and current, there is still no definition in Smart Energy profile.

    By the way, I do not know what 'Application Groups' on zcl_general.h means.

    Regards!

    YK Chen

  • Hi Kent,

    In my experience, the router should not send out a continuous beacon after it joins a zigbee network. There might be something wrong with your Zigbee network. Could you check your short address of router inside sniffer first? If the router has a correct short address, try to use AF_DataRequest() to send something to coordinator. Then, check if you can see the packet in sniffer.

    Regards!

    YK Chen