• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Low Power RF & Wireless Connectivity » Low Power RF ZigBee® Software & IEEE 802.15.4 Forum » Help with Zigbee Home Automation
Share
Low Power RF & Wireless Connectivity
  • Forums
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

Forums

Help with Zigbee Home Automation

This question is answered
1384432
Posted by 1384432
on Apr 05 2012 08:12 AM
Prodigy170 points

Hi,

I´m studying the Home Automation Profile in Zigbee Stack.

In fact I´m having some troubles to undertand the "Sample Light" and "Sample Switch" examples.

To send a data I have used the function:

AF_DataRequest(&dstAddr, srcEPT, ZCL_CLUSTER_ID_GEN_ON_OFF, 1, buffData, buffTransID, AF_DISCV_ROUTE, AF_DEFAULT_RADIUS);

Am I right?

I saw, with a packet sniffer, that the other device has ansewred with a ACK, but how can I use the received data on this device?

My goal is: When I press a button on device 1, for example, I wanna see that a LED on device 2 goes ON.

Which functions I have to use to send/receive data?

Regards.

packet sniffer CC2530 binding Coordinator end device code SmartRF05EB ZigBee 2007 AF_DATA_REQUEST IEEE 802.15.4 z_stack z_stack cc2530 CC2530 Z-Stack ZigBee
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • YiKai Chen
    Posted by YiKai Chen
    on Apr 05 2012 20:34 PM
    Mastermind9400 points

    Hi,

    You can use zclGeneral_SendOnOff_CmdOn and zclGeneral_SendOnOff_CmdOff to send this HA command.

    Regards!

    YK Chen

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • 1384432
    Posted by 1384432
    on Apr 11 2012 08:06 AM
    Prodigy170 points

    Thanks YK Chen, it works.

    Now I´m trying to send Data as you said in the other post. "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."

    By the way, to send secured messages i´ve set:
    - zgPreConfigKeys=TRUE (ZGlobals.c)
    - -DDEFAULT_KEY=..... (f8wConfig.cfg)
    - -DSECURE=1 (f8wConfig.cfg)
    I´ve tryed diferent Keys for different devices. I´d expected that the command doesn´t pass from one device to another. But, even with different keys, it has worked.

    Do you have any suggestion to enable secured mode?

    Regards.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • YiKai Chen
    Posted by YiKai Chen
    on Apr 11 2012 21:02 PM
    Mastermind9400 points

    It's great to hear that your project works fine. For security mode, we enable it in our project and there is one thing you need to know. Change -DDEFAULT_KEY in f8wConfig,cfg is not enough. TI has hard code defaultKey in nwk_globals.c so you also need to change defaultKey. I have no idea why TI keeps this obvious bug from very old Z-Stack version.

    Regards!

    YK Chen

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • 1384432
    Posted by 1384432
    on May 07 2012 13:11 PM
    Prodigy170 points

    Hi YiKai,

    For defalutKey I can use/change the default key in f8wConfig.cgf:

    -DDEFAULT_KEY="{0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0D}"

    If DEFAULT_KEY is defined it will be used in nwk_globals.c, don´t you agree?

    Meanwhile I didn´t arrive to use a secure network.

    I´ve set:

    -DSECURE=1 (f8wconfig.cfg)

    zgPreConfigKeys = TRUE; (ZGlobals.c)

    and -DDEFAULT_KEY="{......}"

    As far as I´m concerned if the coordinator DEFAULT_KEY is different from end device DEFAULT_KEY they won´t communicate.

    If DEFAULT_KEY is the same they can communicate.

    Am I right?

    But up to now I didn´t set the secure mode.

    Is there another thing to do?

    Best Regards,

    Marconi.

    zigbee CC2530 ZStack home automation DEFAULT_KEY secure mode
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • YiKai Chen
    Posted by YiKai Chen
    on May 08 2012 00:14 AM
    Mastermind9400 points

    Hi Marconi,

    Yes, that's all you need to do to enable secure mode. Could you describe more specifically what's your problem is? Is that your Zigbee ED or router can not join coordinator after you enable secure mode or something else?

    Regards!

    YK Chen

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • 1384432
    Posted by 1384432
    on May 08 2012 09:20 AM
    Prodigy170 points

    Hi YK Chen,



    If  "zgPreConfigKeys = TRUE" my end device joins the network and suddenly leave it.

    Even if DEFAULT_KEY="{......}" is the same for end device and coordinador I can´t exchange messages with coordinator.



    I expect that if "zgPreConfigKeys = TRUE" and DEFAULT_KEY="{......}" is different for end device and coordinator they couldn´t communicate.

    But if "zgPreConfigKeys = TRUE" and DEFAULT_KEY="{......}" is the same they could communicate in secure mode.

    Is It clear?

    Br,

    Marconi.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • YiKai Chen
    Posted by YiKai Chen
    on May 08 2012 20:58 PM
    Mastermind9400 points

    Hi Marconi,

    Let's start from non-secure mode first. If you set -DSECURE=0, does everything work fine? Do both joining and communication work well?

    Regards!

    YK Chen

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • 1384432
    Posted by 1384432
    on May 10 2012 13:54 PM
    Prodigy170 points

    Hi YK Chen,

    Yes. In non secure mode it works.

    When I set the secure mode my packets would be encrypted, that´s right?

    Meanwhile, when I see the packets with a packet sniffer they aren´t encrypted.

    So, my question is: What a Secure mode means? What I would expect in this mode? How to send encrypted package?

    Br,

    Marconi

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • YiKai Chen
    Posted by YiKai Chen
    on May 10 2012 21:10 PM
    Verified Answer
    Verified by 1384432
    Mastermind9400 points

    Hi Marconi,

    If the non secure mode works, I suggest you can try "-DSECURE=1" and "zgPreConfigKeys = FALSE" first. Under these defines, there will be a secure zigbee network without pre-config key.

    YK Chen

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • 1384432
    Posted by 1384432
    on May 16 2012 14:00 PM
    Prodigy170 points

    Hi YK Chen,

    I´ve, in other posts, that other people have the same problem as me.

    I´ve made a lit change on ZigBee stack in order to use secure mode with pre-defined key and it works.

    Now I would like to read my end devices IEEE address.

    Meanwhile I´m getting some trouble to find the Binding table.

    How my coordinator can be informed every time that a device has joined the network?

    Before the device has joined the network is it possible to ask my coordinator if it want it?

    How can I access the biding table?

    Best regards.

    Marconi.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • YiKai Chen
    Posted by YiKai Chen
    on May 17 2012 01:11 AM
    Mastermind9400 points

    When a device joins zigbee network, there is end node announcement and you can add the following codes in ZDApp_InMsgCB() of ZDApp.c to get IEEE address and short address of a new-joined device.

    ZDO_DeviceAnnce_t devAnnce;

    if ( inMsg->clusterID == Device_annce )
      {
        ZDO_ParseDeviceAnnce( inMsg, &devAnnce );
      }

    When a device joins the network, it is impossible to ask coordinator if it wants it. The only way is that coordinator use NLME_LeaveReq() to ask the device to leave after it joins the network.

    For access the binding table, you can have a look at BindingTable.h.

    Regards!

    YK Chen

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • 1384432
    Posted by 1384432
    on Jun 19 2012 08:56 AM
    Prodigy170 points
    Hi,
    
    I´ve read on Z-Stack Developer´s guide the following information
    (chapter 10.4 - Key Updates):
    
    "The Trust Center can update the common Network key at its discretion.
    Application developers have to modify the
    Network key update policy. The default Trust Center implementation can
    be used to suit the developer's specific
    policy. An example policy would be to update the Network key at regular
    periodic intervals. Another would be to
    update the NWK key upon user input (like a button-press). The ZDO
    Security Manager (ZDSecMgr.c) API provides
    this functionality via  ZDSecMgrUpdateNwkKey() and
    ZDSecMgrSwitchNwkKey().  ZDSecMgrUpdateNwkKey()
    allows the Trust Center to broadcast a new Network key  to all devices
    on the network. At this point the new
    Network key is stored as an alternate key in all devices. Once the
    Trust Center calls  ZDSecMgrSwitchNwkKey(), a
    network wide broadcast will trigger all devices to use their alternate
    key."
    
    I have used the ZDSecMgrUpdateNwkKey() and ZDSecMgrSwitchNwkKey()
    functions to change my network key.
    Both functions has returned ZSuccess, meanwhile it doesn´t work, my End
    Device doesn´t change the nwk key.
    
    Is there another thing to do, as set any DEFINE?
    How can I change the network key on all devices?
    How can I be informed that all devices has changed the key?
    
    Regards.
    
    Marconi.
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • 1384432
    Posted by 1384432
    on Jun 19 2012 08:58 AM
    Prodigy170 points
    Continuing,

    For a normal message the option AF_ACK_REQUEST can be used as described on Z-Stack Developer´s Guide (chapter 8). I´ve tried this option and now I know if the message was delivered to a specific device or not. Meanwhile this message is an APSDE_DataReq(&req) format. (see function AF_DataRequest) To change/switch the network key the format is APSME, not APSDE. (see functions: ZDSecMgrUpdateNwkKey and ZDSecMgrSwitchNwkKey) So, the question remains: how to know if a specific device has received the network change/switch key command? Regards, Marconi.
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use