SlideShare una empresa de Scribd logo
1 de 10
Descargar para leer sin conexión
W H I T E            PA P E R
                                  Zin Kyaw,
                Systems Application Engineer
                            Texas Instruments



                                                Creating a ZigBee® Smart Energy
                                                Device with the MSP430F54xx and
Introduction
This paper describes how to create a ZigBee
                                                the CC2530-ZNP
Smart Energy Device using the MSP430F54xx       (ZigBee Pro Network Processor)
as the host application processor to the
CC2530-ZNP (ZigBee Pro Network Proces-
sor). The physical interface between the
MSP430 and the CC2530-ZNP is discussed,         Physical interface and development platform
as well as the software application frame-      Although the CC2530-ZNP supports UART, USB, and SPI interfaces, we’ll be discussing

work used to drive the CC2530-ZNP. This         use of the SPI interface. Table 1 shows the recommended pin connection between the host

paper assumes that the reader is familiar       processor and the CC2530-ZNP, which matches the interconnect used by the EXP430F5438

with basic ZigBee concepts and terminology.     Experimenter Board where the MSP430F5438 USCI B0 is used in 3-wire SPI mode.

  The CC2530-ZNP contains the core
ZigBee Pro stack and exposes API interfac-       MSP430F5438           Direction                  CC2530-ZNP                Direction
                                                 P3.0                  Out                        P1.4 (SS)                 In
es to the host processor for configuration of
                                                 P3.1 (UCB0SIMO)       Out                        P1.6 (MOSI)               In
the stack and data transfer. In the sample
                                                 P3.2 (UCB0SOMI)       In                         P1.7 (MISO)               Out
application installer that is provided by TI,    P3.3 (UCB0CLK)        Out                        P1.5 (SCLK)               In
these APIs are abstracted by an application      P1.2                  Out                        RESET_N                   In

framework called the ZAP (ZigBee Applica-        P1.4                  In                         P0.4 (SRDY)               Out

tion Processor) framework, which makes it        P1.6                  Out                        P0.3 (MRDY)               In
                                                                                                  P2.0 (CFG1, driven HIGH
easy for an application developer to write       P8.2                  Out
                                                                                                  for SPI transport)        In

sophisticated ZigBee Smart Energy applica-       N/C                   Configured as input with   P1.2 (CFG0)               In
                                                                       pull-up
tions, among others (e.g., Home Automa-
                                                Table 1. MSP430F5438 to CC2530-ZNP interconnect.
tion and manufacturer-specific profiles).
TI has provided an extensive framework to
make application development easy and             To test this connection, one can obtain a CC2530EMK [which contains 2× CC2530 evalu-

thus re-use of this application framework       ation modules (EMs)] and 2× EXP430F5438 Experimenter Boards separately. This setup is

is highly encouraged. However, for appli-       shown in Figure 1 on the following page. One will also need the SmartRF05EB board which

cation developers that choose to use the        is used to program the CC2530EM modules. The SmartRF05EB board comes included with

CC2530-ZNP but still want to build their        either the CC2530DK, CC2530ZDK, or CC2520DK.

application framework from the ground up,
the ZigBee Smart Energy sample applica-
tion suite serves as great reference code
of how to interface with the CC2530-ZNP.
2    Texas Instruments




                                        Figure 1. Development platform for MSP430F54xx/CC2530-ZNP


             Software application       The software application framework is built upon the OSAL (Operating System Abstraction Layer) operat-
                      framework         ing system (see reference [2] for more information) from TI. OSAL provides services for task management,
                                        power management, non-volatile memory, dynamic memory management, software timers, event generation,
                                        inter- and intra-task messaging (or message queues), and a seamless interface to the layer that abstracts
                                        the board support package (BSP) called the Hardware Abstraction Layer (HAL). The ZAP framework re-uses
                                        the architecture of the ZigBee® application framework on TI’s ZigBee stack (Z-Stack™). Each layer of the
                                        application framework is organized as a task within OSAL, and the HAL task is always given top priority, as
                                        shown in the system diagram of OSAL ZAP services in Figure 2. The HAL task is the first task that runs and


                                                                                                              HAL


                                                       main                                                                                     Tasks serviced in this order
                                                                                                              ZAP



                                                                                                              ZCL

                                                 osal_init_system
                                                                                                          Application




                                                osal_start_system



                                        Figure 2. System diagram of OSAL ZAP services



    Creating a ZigBee® Smart Energy Device with the MSP430F54xx and the CC2530-ZNP                                                     January 2010
    (ZigBee Pro Network Processor)
Texas Instruments 3




                                                                        Application                           OSAL

                                                                ZigBee Cluster Library (ZCL)                  Task
                                                                                                           management
                                                                       Smart Energy

                                                                                                            Dynamic
                                                                             General                        memory
                                                                                                           management
                                                                        Foundation

                                                                              ZAP                           Timers and
                                                                                                              events

                                                        App           Phy              ZNP     Sys
                                                                                                           Non-volatile
                                                                                                            memory
                                                         AF           Util             ZDO     CBKE


                                                                 INTER-PAN              ZMAC                 Power
                                                                                                           management

                                                                              HAL

                                                                                                              Task
                                                        SPI           LED              LCD     Flash
                                                                                                            messaging

                                                       Timers         ADC           Keys       DCO


                                    Figure 3. Layers of the ZAP framework


                                    after each subsequent task runs to completion, a branch is always taken back to the HAL task to see if it
                                    needs to be serviced. The tasks in the diagram shown are typical of a ZAP implementation.
                                      The ZAP layer shown in Figure 3 acts as a translation layer between Z-Stack™ APIs and ZNP APIs. There-
                                    fore, a customer application written for the full ZigBee® stack will work as is when used on a ZAP platform
                                    that TI supports. This saves the customer from having to learn a different application development philosophy
                                    when using the CC2530-ZNP. In the sections ahead, we’ll examine how the ZAP layer takes care of translat-
                                    ing application API calls to ZNP API calls for configuration and data exchanges. For this purpose we use the
                                    Smart Energy Sample Application Project which can be found in
                                    C:Texas InstrumentsZAP-MSP430-1.0.0 ProjectszstackZAPSE-SampleAppEXP5438 after installing the
                                    ZAP installer package.


                   ZNP startup      The macro HAL_SPI_INIT() takes care of initializing the SPI interface of the MSP430™. The function
                                    zapPhyInit() is used to initialize the ZNP hardware control signals and allow the CC2530-ZNP to run by de-
                                    asserting the RESET_N pin. Once the ZNP has finished its internal initialization sequence, it signals comple-
                                    tion to the host processor by asserting the SRDY signal. The zapPhySpiPoll() process will then retrieve the
                                    SYS_RESET_IND command. Subsequently, the zapSysResetInd() function is called to alert the ZAP layer that
                                    it has received the reset indication and that it can now go ahead and configure the ZNP. From now on, we’ll
                                    call this the “ZNP sync event”.


Creating a ZigBee® Smart Energy Device with the MSP430F54xx and the CC2530-ZNP                                                       January 2010
(ZigBee Pro Network Processor)
4    Texas Instruments



                ZNP configuration        The first thing the user has to do is decide whether to restore the network state of the ZNP device every time
                                        a ZNP sync event occurs. This is selectable by the compile option ZAP_NV_RESTORE. If ZAP_NV_RESTORE
                                        is set to FALSE, the network state of the ZNP will be cleared, and default configuration used. zapAfSync() and
                                        zapZdoSync() are used to register application endpoints and ZDO callbacks, respectively. The host application
                                        must do this upon every ZNP sync event since application endpoint and callback information are not saved in
                                        ZNP non-volatile memory.
                                          The application then makes a series of calls using znp_nv_write for the items ZCD_NV_LOGICAL_TYPE,
                                        ZDAPP_CONFIG_PAN_ID, DEFAULT_CHANLIST to configure the logical device type (coordinator, router, or
                                        end device), PAN ID, and scan channel mask, respectively. The default values from the zap.cfg configura-
                                        tion file are taken as values. When the compile option TC_LINKKEY_JOIN is defined, zapCertSync() is called
                                        to configure test certificate data for ZigBee® CBKE (Certificate Based Key Establishment) security. Note that
                                        since these configuration items are declared as global variables within the ZNP, a reset of the ZNP is not
                                        required to change these items at runtime. Note that this configuration of ZNP has been automated if the
                                        ZAP_AUTO_CFG compile option is set to TRUE in zap.cfg.
                                          Once all the configuration changes are made, the host processor can then start the device by calling
                                        ZDOInitDevice which in turn calls the ZDO_STARTUP_FROM_APP ZNP API function. The compile option
                                        ZAP_ZDO_STARTUP_AREQ is used to allow the ZDO_STARTUP_FROM_APP command to be sent as an
                                        asynchronous request (AREQ) because the device startup process (which includes scanning for networks)
                                        could take > 400 msec. Therefore, this allows the application to service other tasks instead of having to wait
                                        for the synchronous response (SRSP). The status of this request will be queued for the host processor as a
                                        ZDO_STATE_CHANGE_IND command. This indication is then passed up to the application task to notify it that
                                        the device has a valid ZigBee network address. The application then processes this event as:


                                              case ZDO_STATE_CHANGE:
                                                     if ((DEV_END_DEVICE == (devStates_t)(MSGpkt->hdr.status)) ||
                                                         (DEV_ROUTER == (devStates_t)(MSGpkt->hdr.status)))
                                                     {
                                                           // device is on the ZigBee network


                                          Note that this network startup of ZNP has been automated if the ZAP_AUTO_START compile option is set
                                        to TRUE in zap.cfg.


          Registering application       Part of the application’s initialization function is to register for the SE endpoint and desired ZDO callbacks. For
              endpoints and ZDO         example, the function zclSE_Init registers the SE endpoint description with the ZNP.
                       callbacks




    Creating a ZigBee® Smart Energy Device with the MSP430F54xx and the CC2530-ZNP                                                         January 2010
    (ZigBee Pro Network Processor)
Texas Instruments 5




                                          // register for SE endpoint
                                              zclSE_Init( &simpleMeterSimpleDesc );


                                      This translates into a ZAP proxy function called znp_afRegisterExtended() which uses the AF_REGISTER
                                    ZNP API to register this endpoint with the ZNP.
                                      The application can also register for certain ZDO callback notifications. The Energy Service Portal (ESP)
                                    example registers for the following ZDO callbacks:


                                          // register for end device annce and simple descriptor responses
                                          ZDO_RegisterForZDOMsg( espTaskID, Device_annce );
                                          ZDO_RegisterForZDOMsg( espTaskID, Simple_Desc_rsp );


                                      The ZDO_RegisterForZDOMsg() function then calls the ZAP proxy function znp_ZDO_RegisterForZDOMsg(),
                                    which sends the ZDO_MSG_CB_REGISTER command to the ZNP. When the ZAP layer receives an incoming
                                    ZDO command, the function zapZdoProcessIncoming is called. The command is then processed in the case
                                    handler for MT_ZDO_MSG_CB_INCOMING. This command handler then calls ZDO_SendMsgCBs in order to
                                    parse and determine which application task should receive the callback.
                                      The ESP application uses the end device announce to detect when other devices join the SE network.
                                    The ESP then uses the ZDO simple descriptor request to query the device for what type of device it is. Both
                                    callbacks are processed as follows:


                                          static void esp_ProcessZDOMsg( zdoIncomingMsg_t *inMsg )
                                          {
                                              ZDO_DeviceAnnce_t devAnnce;


                                              switch ( inMsg->clusterID )
                                              {
                                                  case Device_annce:
                                                   {
                                                       ZDO_ParseDeviceAnnce( inMsg, &devAnnce );
                                                       simpleDescReqAddr.addrMode = (afAddrMode_t)Addr16Bit;
                                                       simpleDescReqAddr.addr.shortAddr = devAnnce.nwkAddr;


                                                       // set simple descriptor query event
                                                       osal_set_event( espTaskID, SIMPLE_DESC_QUERY_EVT );




Creating a ZigBee® Smart Energy Device with the MSP430F54xx and the CC2530-ZNP                                                     January 2010
(ZigBee Pro Network Processor)
6    Texas Instruments




                                                  }
                                                  break;


                                                case Simple_Desc_rsp:
                                                  {
                                                      ZDO_SimpleDescRsp_t *pSimpleDescRsp; // pointer to received simple desc response
                                                      pSimpleDescRsp = (ZDO_SimpleDescRsp_t *)osal_mem_alloc( sizeof( ZDO_
                                           SimpleDescRsp_t ) );
                                                 ………




                     Initiating key     When full ZigBee® CBKE security is used with the Certicom Elliptic Curve Cryptography (ECC) library, in order
                    establishment       to establish an application link key with the ESP, the function zclGeneral_KeyEstablish_InitiateKeyEstablishment
                                        is called. This in turn sends the UTIL_ZCL_KEY_EST_INIT_EST command to the ZNP. As the entire ECC pro-
                                        cess could take up to 20 seconds, zapPhyWait(zapAppPort, ZCL_KEY_EST_INIT_EST_WAIT) is called to tell
                                        the low-level SPI driver to wait at least 30 seconds before timing out on the SRSP. When the key establish-
                                        ment process completes, the zapUtilProcessIncoming function will notify the application via the MT_UTIL_
                                        ZCL_KEY_ESTABLISH_IND handler. The application can then decide to use this indication to determine that it
                                        can start to communicate with the ESP. For example, in the simple meter example we have:


                                                  case ZCL_KEY_ESTABLISH_IND:
                                                       if ((MSGpkt->hdr.status) == TermKeyStatus_Success)
                                                       {
                                                           osal_start_timerEx( simpleMeterTaskID, SIMPLEMETER_REPORT_ATTRIBUTE_EVT,
                                                           SIMPLEMETER_REPORT_PERIOD );
                                                       }




                   Sending Smart        Once the key establishment procedure is complete, sending application commands is straightforward. The
                    Energy profile       ZCL layer provides API functions to send correctly formatted SE commands, such as the following, which is
                      commands
                                        used in the simple meter example to send a report attribute command to the ESP:


                                              zcl_SendReportCmd( SIMPLEMETER_ENDPOINT, &ESPAddr,
                                                                 ZCL_CLUSTER_ID_SE_SIMPLE_METERING, pReportCmd,
                                                                 ZCL_FRAME_SERVER_CLIENT_DIR, 1, 0 );



    Creating a ZigBee® Smart Energy Device with the MSP430F54xx and the CC2530-ZNP                                                       January 2010
    (ZigBee Pro Network Processor)
Texas Instruments 7



                                      These commands are translated into AF_DATA_REQUEST commands that are sent to the ZNP.
                                      In the Smart Energy Sample Application Project, there are also other device configurations such as the
                                    In-Premise Display and Load Control Device that show examples of how to use commands related to Pricing
                                    and Demand Response and Load Control, respectively.


              Receiving Smart       Any incoming over-the-air message is extracted by the host processor (as an AF_INCOMING_CMD) and then
                Energy profile       passed up to the ZCL layer. The application registers callbacks for each command that it wishes to process
                   commands
                                    on the receive side. As the ESP has to support all SE commands, all SE callbacks are registered by the ESP
                                    application:


                                          static zclSE_AppCallbacks_t esp_SECmdCallbacks =
                                          {
                                              esp_GetProfileCmdCB,                         // Get Profile Command
                                              esp_GetProfileRspCB,                         // Get Profile Response
                                              esp_ReqMirrorCmdCB,                         // Request Mirror Command
                                              esp_ReqMirrorRspCB,                         // Request Mirror Response
                                              esp_MirrorRemCmdCB,                         // Mirror Remove Command
                                              esp_MirrorRemRspCB,                         // Mirror Remove Response
                                              esp_GetCurrentPriceCB,                      // Get Current Price
                                              esp_GetScheduledPriceCB,                    // Get Scheduled Price
                                              esp_PublishPriceCB,                         // Publish Price
                                              esp_DisplayMessageCB,                       // Display Message Command
                                              esp_CancelMessageCB,                        // Cancel Message Command
                                              esp_GetLastMessageCB,                       // Get Last Message Command
                                              esp_MessageConfirmationCB,                   // Message Confirmation
                                              esp_LoadControlEventCB,                     // Load Control Event
                                              esp_CancelLoadControlEventCB,               // Cancel Load Control Event
                                              esp_CancelAllLoadControlEventsCB,           // Cancel All Load Control Events
                                              esp_ReportEventStatusCB,                    // Report Event Status
                                              esp_GetScheduledEventCB,                    // Get Scheduled Event
                                          };


                                      For example when the ESP receives a Get Current Price command from an In-Premise Display, the
                                    esp_GetCurrentPriceCB callback function is called and the Publish Price command is sent back:




Creating a ZigBee® Smart Energy Device with the MSP430F54xx and the CC2530-ZNP                                                     January 2010
(ZigBee Pro Network Processor)
8    Texas Instruments




                                             static void esp_GetCurrentPriceCB( zclCCGetCurrentPrice_t *pCmd,
                                                                            afAddrType_t *srcAddr, uint8 seqNum )
                                             {
                                             #if defined ( ZCL_PRICING )
                                                 // On receipt of Get Current Price command, the device shall send a
                                                 // Publish Price command with the information for the current time.
                                                 zclCCPublishPrice_t cmd;


                                                 osal_memset( &cmd, 0, sizeof( zclCCPublishPrice_t ) );


                                                 cmd.providerId = 0xbabeface;
                                                 cmd.priceTier = 0xfe;


                                                 // copy source address of display device that requested current pricing info so
                                                 // that esp can send messages to it using destination address of IPDAddr


                                                 osal_memcpy( &ipdAddr, srcAddr, sizeof ( afAddrType_t ) );


                                                 zclSE_Pricing_Send_PublishPrice( ESP_ENDPOINT, srcAddr, &cmd, false, seqNum );
                                             #endif // ZCL_PRICING
                                             }




                         Conclusion     This paper has described how to create a ZigBee® Smart Energy device using the MSP430F54xx as the host
                                        application processor to the CC2530-ZNP (ZigBee Pro Network Processor). A typical smart meter application
                                        that would benefit most from this type of architecture would be a gas or water meter since extended battery
                                        life of 10 years or greater is a key requirement for these devices. The MSP430F54xx and CC2530-ZNP
                                        combination provides a low-power and low-cost solution that meets this requirement. The ZAP software ap-
                                        plication framework provides an easy-to-use development environment that accelerates ZigBee development
                                        for smart meter applications.




    Creating a ZigBee® Smart Energy Device with the MSP430F54xx and the CC2530-ZNP                                                   January 2010
    (ZigBee Pro Network Processor)
Texas Instruments 9



                    References                 [1] CC2530-ZNP Interface Specification, SWRA312
                                               [2] OSAL API document, SWRA194
                                               [3] Z-Stack™ API document, SWRA195
                                               [4] ZCL API document, SWRA197
                                               [5] Z-Stack Smart Energy Developer’s Guide, SWRA216




                                            For more information on Smart Metering devices from TI, visit www.ti.com/metering, or
                                            e-mail: metering@ti.com




 Important Notice: The products and services of Texas Instruments Incorporated and its subsidiaries described herein are sold subject to TI’s standard terms and
 conditions of sale. Customers are advised to obtain the most current and complete information about TI products and services before placing orders. TI assumes no lia-
 bility for applications assistance, customer’s applications or product designs, software performance, or infringement of patents. The publication of information regard-
 ing any other company’s products or services does not constitute TI’s approval, warranty or endorsement thereof.

MSP430 and Z-Stack are trademarks of Texas Instruments Incorporated. All other trademarks are the property of their respective owners.




© 2010 Texas Instruments Incorporated                                                                                                                             SLYY022
IMPORTANT NOTICE
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements,
and other changes to its products and services at any time and to discontinue any product or service without notice. Customers should
obtain the latest relevant information before placing orders and should verify that such information is current and complete. All products are
sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment.
TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI’s standard
warranty. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where
mandated by government requirements, testing of all parameters of each product is not necessarily performed.
TI assumes no liability for applications assistance or customer product design. Customers are responsible for their products and
applications using TI components. To minimize the risks associated with customer products and applications, customers should provide
adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right, copyright, mask work right,
or other TI intellectual property right relating to any combination, machine, or process in which TI products or services are used. Information
published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a
warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual
property of the third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied
by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive
business practice. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional
restrictions.
Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all
express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice. TI is not
responsible or liable for any such statements.
TI products are not authorized for use in safety-critical applications (such as life support) where a failure of the TI product would reasonably
be expected to cause severe personal injury or death, unless officers of the parties have executed an agreement specifically governing
such use. Buyers represent that they have all necessary expertise in the safety and regulatory ramifications of their applications, and
acknowledge and agree that they are solely responsible for all legal, regulatory and safety-related requirements concerning their products
and any use of TI products in such safety-critical applications, notwithstanding any applications-related information or support that may be
provided by TI. Further, Buyers must fully indemnify TI and its representatives against any damages arising out of the use of TI products in
such safety-critical applications.
TI products are neither designed nor intended for use in military/aerospace applications or environments unless the TI products are
specifically designated by TI as military-grade or "enhanced plastic." Only products designated by TI as military-grade meet military
specifications. Buyers acknowledge and agree that any such use of TI products which TI has not designated as military-grade is solely at
the Buyer's risk, and that they are solely responsible for compliance with all legal and regulatory requirements in connection with such use.
TI products are neither designed nor intended for use in automotive applications or environments unless the specific TI products are
designated by TI as compliant with ISO/TS 16949 requirements. Buyers acknowledge and agree that, if they use any non-designated
products in automotive applications, TI will not be responsible for any failure to meet such requirements.
Following are URLs where you can obtain information on other Texas Instruments products and application solutions:

Products                                                               Applications
Amplifiers                      amplifier.ti.com                       Audio                         www.ti.com/audio
Data Converters                 dataconverter.ti.com                   Automotive                    www.ti.com/automotive
DLP® Products                   www.dlp.com                            Communications and            www.ti.com/communications
                                                                       Telecom
DSP                             dsp.ti.com                             Computers and                 www.ti.com/computers
                                                                       Peripherals
Clocks and Timers               www.ti.com/clocks                      Consumer Electronics          www.ti.com/consumer-apps
Interface                       interface.ti.com                       Energy                        www.ti.com/energy
Logic                           logic.ti.com                           Industrial                    www.ti.com/industrial
Power Mgmt                      power.ti.com                           Medical                       www.ti.com/medical
Microcontrollers                microcontroller.ti.com                 Security                      www.ti.com/security
RFID                            www.ti-rfid.com                        Space, Avionics &             www.ti.com/space-avionics-defense
                                                                       Defense
RF/IF and ZigBee® Solutions www.ti.com/lprf                            Video and Imaging             www.ti.com/video
                                                                       Wireless                      www.ti.com/wireless-apps


                                  Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
                                                 Copyright © 2010, Texas Instruments Incorporated

Más contenido relacionado

La actualidad más candente

Wireless Communication And Mobile Network - ZigBee
Wireless Communication And Mobile Network - ZigBeeWireless Communication And Mobile Network - ZigBee
Wireless Communication And Mobile Network - ZigBeeXaver Y.R. Chen
 
14.) wireless (hyper dense wi fi)
14.) wireless (hyper dense wi fi)14.) wireless (hyper dense wi fi)
14.) wireless (hyper dense wi fi)Jeff Green
 
Networking Course in bangalore | CCNA training Institute
Networking Course in bangalore | CCNA training InstituteNetworking Course in bangalore | CCNA training Institute
Networking Course in bangalore | CCNA training InstituteNetworking Training
 
LoRaWAN class module and subsystem
LoRaWAN class module and subsystemLoRaWAN class module and subsystem
LoRaWAN class module and subsystemJian-Hong Pan
 
COMPARISON OF SHORT RANGE WIRELESS NETWORKS (PAN’ s)
COMPARISON OF SHORT RANGE WIRELESS NETWORKS (PAN’ s) COMPARISON OF SHORT RANGE WIRELESS NETWORKS (PAN’ s)
COMPARISON OF SHORT RANGE WIRELESS NETWORKS (PAN’ s) Zarnigar Altaf
 
19.) security pivot (policy byod nac)
19.) security pivot (policy byod nac)19.) security pivot (policy byod nac)
19.) security pivot (policy byod nac)Jeff Green
 
16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)Jeff Green
 
Proxy Mobile IPv6 (PMIPv6)
Proxy Mobile IPv6 (PMIPv6)Proxy Mobile IPv6 (PMIPv6)
Proxy Mobile IPv6 (PMIPv6)Peter R. Egli
 
Bluetooth Reinvented. Smart connectivity in consumer devices: Bluetooth Low ...
Bluetooth Reinvented.  Smart connectivity in consumer devices: Bluetooth Low ...Bluetooth Reinvented.  Smart connectivity in consumer devices: Bluetooth Low ...
Bluetooth Reinvented. Smart connectivity in consumer devices: Bluetooth Low ...CSR
 
What is LoRaWAN_Tom Zamir_IoT Expert
What is LoRaWAN_Tom Zamir_IoT ExpertWhat is LoRaWAN_Tom Zamir_IoT Expert
What is LoRaWAN_Tom Zamir_IoT ExpertGuy Vinograd ☁
 
Voice communication using zigbee
Voice communication using zigbeeVoice communication using zigbee
Voice communication using zigbeeWaqar Memon
 
CCNA4 Verson6 Chapter3
CCNA4 Verson6 Chapter3CCNA4 Verson6 Chapter3
CCNA4 Verson6 Chapter3Chaing Ravuth
 
Extending Bluetooth with Mesh Networking
Extending Bluetooth with Mesh NetworkingExtending Bluetooth with Mesh Networking
Extending Bluetooth with Mesh NetworkingSilicon Labs
 

La actualidad más candente (20)

Wireless Communication And Mobile Network - ZigBee
Wireless Communication And Mobile Network - ZigBeeWireless Communication And Mobile Network - ZigBee
Wireless Communication And Mobile Network - ZigBee
 
14.) wireless (hyper dense wi fi)
14.) wireless (hyper dense wi fi)14.) wireless (hyper dense wi fi)
14.) wireless (hyper dense wi fi)
 
Zigbee technology2
Zigbee technology2Zigbee technology2
Zigbee technology2
 
Zigbee
ZigbeeZigbee
Zigbee
 
Main document
Main documentMain document
Main document
 
Networking Course in bangalore | CCNA training Institute
Networking Course in bangalore | CCNA training InstituteNetworking Course in bangalore | CCNA training Institute
Networking Course in bangalore | CCNA training Institute
 
Summer training on CCNA
Summer training on CCNASummer training on CCNA
Summer training on CCNA
 
LoRaWAN class module and subsystem
LoRaWAN class module and subsystemLoRaWAN class module and subsystem
LoRaWAN class module and subsystem
 
COMPARISON OF SHORT RANGE WIRELESS NETWORKS (PAN’ s)
COMPARISON OF SHORT RANGE WIRELESS NETWORKS (PAN’ s) COMPARISON OF SHORT RANGE WIRELESS NETWORKS (PAN’ s)
COMPARISON OF SHORT RANGE WIRELESS NETWORKS (PAN’ s)
 
19.) security pivot (policy byod nac)
19.) security pivot (policy byod nac)19.) security pivot (policy byod nac)
19.) security pivot (policy byod nac)
 
16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)
 
acl configuration
acl configurationacl configuration
acl configuration
 
Proxy Mobile IPv6 (PMIPv6)
Proxy Mobile IPv6 (PMIPv6)Proxy Mobile IPv6 (PMIPv6)
Proxy Mobile IPv6 (PMIPv6)
 
Bluetooth Reinvented. Smart connectivity in consumer devices: Bluetooth Low ...
Bluetooth Reinvented.  Smart connectivity in consumer devices: Bluetooth Low ...Bluetooth Reinvented.  Smart connectivity in consumer devices: Bluetooth Low ...
Bluetooth Reinvented. Smart connectivity in consumer devices: Bluetooth Low ...
 
What is LoRaWAN_Tom Zamir_IoT Expert
What is LoRaWAN_Tom Zamir_IoT ExpertWhat is LoRaWAN_Tom Zamir_IoT Expert
What is LoRaWAN_Tom Zamir_IoT Expert
 
Voice communication using zigbee
Voice communication using zigbeeVoice communication using zigbee
Voice communication using zigbee
 
CCNA4 Verson6 Chapter3
CCNA4 Verson6 Chapter3CCNA4 Verson6 Chapter3
CCNA4 Verson6 Chapter3
 
Extending Bluetooth with Mesh Networking
Extending Bluetooth with Mesh NetworkingExtending Bluetooth with Mesh Networking
Extending Bluetooth with Mesh Networking
 
Final presentation
Final presentationFinal presentation
Final presentation
 
LoRaWAN vs Haystack
LoRaWAN vs HaystackLoRaWAN vs Haystack
LoRaWAN vs Haystack
 

Destacado

Thesis Final PresentationV2
Thesis Final PresentationV2Thesis Final PresentationV2
Thesis Final PresentationV2Onur Kayikci
 
The A2530x24xx AIR Module for ZigBee Standard Applications
The A2530x24xx AIR Module for ZigBee Standard ApplicationsThe A2530x24xx AIR Module for ZigBee Standard Applications
The A2530x24xx AIR Module for ZigBee Standard ApplicationsAnaren, Inc.
 
Zig bee程式與韌體開發設計
Zig bee程式與韌體開發設計Zig bee程式與韌體開發設計
Zig bee程式與韌體開發設計casiolike0531
 
Introduction to zigbee
Introduction to zigbeeIntroduction to zigbee
Introduction to zigbeeAmit Dixit
 
Introduction to Ti wireless solution: ZigBee
Introduction to Ti wireless solution: ZigBeeIntroduction to Ti wireless solution: ZigBee
Introduction to Ti wireless solution: ZigBeeChiu-Hao Chen (Ted)
 
21 Błędów w 21 Miesięcy - w drodze do rentowności
21 Błędów w 21 Miesięcy - w drodze do rentowności21 Błędów w 21 Miesięcy - w drodze do rentowności
21 Błędów w 21 Miesięcy - w drodze do rentownościFilip Duszczak
 
26 Disruptive & Technology Trends 2016 - 2018
26 Disruptive & Technology Trends 2016 - 201826 Disruptive & Technology Trends 2016 - 2018
26 Disruptive & Technology Trends 2016 - 2018Brian Solis
 

Destacado (8)

Thesis Final PresentationV2
Thesis Final PresentationV2Thesis Final PresentationV2
Thesis Final PresentationV2
 
The A2530x24xx AIR Module for ZigBee Standard Applications
The A2530x24xx AIR Module for ZigBee Standard ApplicationsThe A2530x24xx AIR Module for ZigBee Standard Applications
The A2530x24xx AIR Module for ZigBee Standard Applications
 
Zig bee程式與韌體開發設計
Zig bee程式與韌體開發設計Zig bee程式與韌體開發設計
Zig bee程式與韌體開發設計
 
ZigBee CC2530
ZigBee CC2530 ZigBee CC2530
ZigBee CC2530
 
Introduction to zigbee
Introduction to zigbeeIntroduction to zigbee
Introduction to zigbee
 
Introduction to Ti wireless solution: ZigBee
Introduction to Ti wireless solution: ZigBeeIntroduction to Ti wireless solution: ZigBee
Introduction to Ti wireless solution: ZigBee
 
21 Błędów w 21 Miesięcy - w drodze do rentowności
21 Błędów w 21 Miesięcy - w drodze do rentowności21 Błędów w 21 Miesięcy - w drodze do rentowności
21 Błędów w 21 Miesięcy - w drodze do rentowności
 
26 Disruptive & Technology Trends 2016 - 2018
26 Disruptive & Technology Trends 2016 - 201826 Disruptive & Technology Trends 2016 - 2018
26 Disruptive & Technology Trends 2016 - 2018
 

Similar a Creating a ZigBee Smart Energy Device with the MSP430F54xx and the CC2530-ZNP

200701043 report
200701043 report200701043 report
200701043 reportMindTree
 
International Refereed Journal of Engineering and Science (IRJES)
International Refereed Journal of Engineering and Science (IRJES)International Refereed Journal of Engineering and Science (IRJES)
International Refereed Journal of Engineering and Science (IRJES)irjes
 
International Refereed Journal of Engineering and Science (IRJES)
International Refereed Journal of Engineering and Science (IRJES)International Refereed Journal of Engineering and Science (IRJES)
International Refereed Journal of Engineering and Science (IRJES)irjes
 
Clock Gating of Streaming Applications for Power Minimization on FPGA’s
 	  Clock Gating of Streaming Applications for Power Minimization on FPGA’s 	  Clock Gating of Streaming Applications for Power Minimization on FPGA’s
Clock Gating of Streaming Applications for Power Minimization on FPGA’sIRJET Journal
 
Implementation of CAN on FPGA for Security Evaluation Purpose
Implementation of CAN on FPGA for Security Evaluation PurposeImplementation of CAN on FPGA for Security Evaluation Purpose
Implementation of CAN on FPGA for Security Evaluation PurposeIRJET Journal
 
Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...
Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...
Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...IRJET Journal
 
AN DYNAMIC ENERGY MANAGEMENT ON FPGA FOR WIRELESS SENSOR NETWORK
AN DYNAMIC ENERGY MANAGEMENT ON FPGA FOR WIRELESS SENSOR NETWORKAN DYNAMIC ENERGY MANAGEMENT ON FPGA FOR WIRELESS SENSOR NETWORK
AN DYNAMIC ENERGY MANAGEMENT ON FPGA FOR WIRELESS SENSOR NETWORKcsijjournal
 
IRJET- Review on Dynamic Reconfiguration of Filters for Signal Processing
IRJET- Review on Dynamic Reconfiguration of Filters for Signal ProcessingIRJET- Review on Dynamic Reconfiguration of Filters for Signal Processing
IRJET- Review on Dynamic Reconfiguration of Filters for Signal ProcessingIRJET Journal
 
Benefits of a relay barrier
Benefits of a relay barrierBenefits of a relay barrier
Benefits of a relay barrierrns-usa
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)ijceronline
 
Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...
Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...
Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...IRJET Journal
 
Nt1310 Unit 5 Algorithm
Nt1310 Unit 5 AlgorithmNt1310 Unit 5 Algorithm
Nt1310 Unit 5 AlgorithmAngie Lee
 

Similar a Creating a ZigBee Smart Energy Device with the MSP430F54xx and the CC2530-ZNP (20)

200701043 report
200701043 report200701043 report
200701043 report
 
Streams on wires
Streams on wiresStreams on wires
Streams on wires
 
Fpg as 11 body
Fpg as 11 bodyFpg as 11 body
Fpg as 11 body
 
International Refereed Journal of Engineering and Science (IRJES)
International Refereed Journal of Engineering and Science (IRJES)International Refereed Journal of Engineering and Science (IRJES)
International Refereed Journal of Engineering and Science (IRJES)
 
International Refereed Journal of Engineering and Science (IRJES)
International Refereed Journal of Engineering and Science (IRJES)International Refereed Journal of Engineering and Science (IRJES)
International Refereed Journal of Engineering and Science (IRJES)
 
Clock Gating of Streaming Applications for Power Minimization on FPGA’s
 	  Clock Gating of Streaming Applications for Power Minimization on FPGA’s 	  Clock Gating of Streaming Applications for Power Minimization on FPGA’s
Clock Gating of Streaming Applications for Power Minimization on FPGA’s
 
Implementation of CAN on FPGA for Security Evaluation Purpose
Implementation of CAN on FPGA for Security Evaluation PurposeImplementation of CAN on FPGA for Security Evaluation Purpose
Implementation of CAN on FPGA for Security Evaluation Purpose
 
Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...
Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...
Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...
 
G010334554
G010334554G010334554
G010334554
 
AN DYNAMIC ENERGY MANAGEMENT ON FPGA FOR WIRELESS SENSOR NETWORK
AN DYNAMIC ENERGY MANAGEMENT ON FPGA FOR WIRELESS SENSOR NETWORKAN DYNAMIC ENERGY MANAGEMENT ON FPGA FOR WIRELESS SENSOR NETWORK
AN DYNAMIC ENERGY MANAGEMENT ON FPGA FOR WIRELESS SENSOR NETWORK
 
Convolution
ConvolutionConvolution
Convolution
 
50120140505008
5012014050500850120140505008
50120140505008
 
IRJET- Review on Dynamic Reconfiguration of Filters for Signal Processing
IRJET- Review on Dynamic Reconfiguration of Filters for Signal ProcessingIRJET- Review on Dynamic Reconfiguration of Filters for Signal Processing
IRJET- Review on Dynamic Reconfiguration of Filters for Signal Processing
 
Benefits of a relay barrier
Benefits of a relay barrierBenefits of a relay barrier
Benefits of a relay barrier
 
FPGA IMPLEMENTATION OF APPROXIMATE SOFTMAX FUNCTION FOR EFFICIENT CNN INFERENCE
FPGA IMPLEMENTATION OF APPROXIMATE SOFTMAX FUNCTION FOR EFFICIENT CNN INFERENCEFPGA IMPLEMENTATION OF APPROXIMATE SOFTMAX FUNCTION FOR EFFICIENT CNN INFERENCE
FPGA IMPLEMENTATION OF APPROXIMATE SOFTMAX FUNCTION FOR EFFICIENT CNN INFERENCE
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...
Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...
Performance Evaluation of FPGA Based Runtime Dynamic Partial Reconfiguration ...
 
Nt1310 Unit 5 Algorithm
Nt1310 Unit 5 AlgorithmNt1310 Unit 5 Algorithm
Nt1310 Unit 5 Algorithm
 
1
11
1
 
Ijecet 06 08_003
Ijecet 06 08_003Ijecet 06 08_003
Ijecet 06 08_003
 

Creating a ZigBee Smart Energy Device with the MSP430F54xx and the CC2530-ZNP

  • 1. W H I T E PA P E R Zin Kyaw, Systems Application Engineer Texas Instruments Creating a ZigBee® Smart Energy Device with the MSP430F54xx and Introduction This paper describes how to create a ZigBee the CC2530-ZNP Smart Energy Device using the MSP430F54xx (ZigBee Pro Network Processor) as the host application processor to the CC2530-ZNP (ZigBee Pro Network Proces- sor). The physical interface between the MSP430 and the CC2530-ZNP is discussed, Physical interface and development platform as well as the software application frame- Although the CC2530-ZNP supports UART, USB, and SPI interfaces, we’ll be discussing work used to drive the CC2530-ZNP. This use of the SPI interface. Table 1 shows the recommended pin connection between the host paper assumes that the reader is familiar processor and the CC2530-ZNP, which matches the interconnect used by the EXP430F5438 with basic ZigBee concepts and terminology. Experimenter Board where the MSP430F5438 USCI B0 is used in 3-wire SPI mode. The CC2530-ZNP contains the core ZigBee Pro stack and exposes API interfac- MSP430F5438 Direction CC2530-ZNP Direction P3.0 Out P1.4 (SS) In es to the host processor for configuration of P3.1 (UCB0SIMO) Out P1.6 (MOSI) In the stack and data transfer. In the sample P3.2 (UCB0SOMI) In P1.7 (MISO) Out application installer that is provided by TI, P3.3 (UCB0CLK) Out P1.5 (SCLK) In these APIs are abstracted by an application P1.2 Out RESET_N In framework called the ZAP (ZigBee Applica- P1.4 In P0.4 (SRDY) Out tion Processor) framework, which makes it P1.6 Out P0.3 (MRDY) In P2.0 (CFG1, driven HIGH easy for an application developer to write P8.2 Out for SPI transport) In sophisticated ZigBee Smart Energy applica- N/C Configured as input with P1.2 (CFG0) In pull-up tions, among others (e.g., Home Automa- Table 1. MSP430F5438 to CC2530-ZNP interconnect. tion and manufacturer-specific profiles). TI has provided an extensive framework to make application development easy and To test this connection, one can obtain a CC2530EMK [which contains 2× CC2530 evalu- thus re-use of this application framework ation modules (EMs)] and 2× EXP430F5438 Experimenter Boards separately. This setup is is highly encouraged. However, for appli- shown in Figure 1 on the following page. One will also need the SmartRF05EB board which cation developers that choose to use the is used to program the CC2530EM modules. The SmartRF05EB board comes included with CC2530-ZNP but still want to build their either the CC2530DK, CC2530ZDK, or CC2520DK. application framework from the ground up, the ZigBee Smart Energy sample applica- tion suite serves as great reference code of how to interface with the CC2530-ZNP.
  • 2. 2 Texas Instruments Figure 1. Development platform for MSP430F54xx/CC2530-ZNP Software application The software application framework is built upon the OSAL (Operating System Abstraction Layer) operat- framework ing system (see reference [2] for more information) from TI. OSAL provides services for task management, power management, non-volatile memory, dynamic memory management, software timers, event generation, inter- and intra-task messaging (or message queues), and a seamless interface to the layer that abstracts the board support package (BSP) called the Hardware Abstraction Layer (HAL). The ZAP framework re-uses the architecture of the ZigBee® application framework on TI’s ZigBee stack (Z-Stack™). Each layer of the application framework is organized as a task within OSAL, and the HAL task is always given top priority, as shown in the system diagram of OSAL ZAP services in Figure 2. The HAL task is the first task that runs and HAL main Tasks serviced in this order ZAP ZCL osal_init_system Application osal_start_system Figure 2. System diagram of OSAL ZAP services Creating a ZigBee® Smart Energy Device with the MSP430F54xx and the CC2530-ZNP January 2010 (ZigBee Pro Network Processor)
  • 3. Texas Instruments 3 Application OSAL ZigBee Cluster Library (ZCL) Task management Smart Energy Dynamic General memory management Foundation ZAP Timers and events App Phy ZNP Sys Non-volatile memory AF Util ZDO CBKE INTER-PAN ZMAC Power management HAL Task SPI LED LCD Flash messaging Timers ADC Keys DCO Figure 3. Layers of the ZAP framework after each subsequent task runs to completion, a branch is always taken back to the HAL task to see if it needs to be serviced. The tasks in the diagram shown are typical of a ZAP implementation. The ZAP layer shown in Figure 3 acts as a translation layer between Z-Stack™ APIs and ZNP APIs. There- fore, a customer application written for the full ZigBee® stack will work as is when used on a ZAP platform that TI supports. This saves the customer from having to learn a different application development philosophy when using the CC2530-ZNP. In the sections ahead, we’ll examine how the ZAP layer takes care of translat- ing application API calls to ZNP API calls for configuration and data exchanges. For this purpose we use the Smart Energy Sample Application Project which can be found in C:Texas InstrumentsZAP-MSP430-1.0.0 ProjectszstackZAPSE-SampleAppEXP5438 after installing the ZAP installer package. ZNP startup The macro HAL_SPI_INIT() takes care of initializing the SPI interface of the MSP430™. The function zapPhyInit() is used to initialize the ZNP hardware control signals and allow the CC2530-ZNP to run by de- asserting the RESET_N pin. Once the ZNP has finished its internal initialization sequence, it signals comple- tion to the host processor by asserting the SRDY signal. The zapPhySpiPoll() process will then retrieve the SYS_RESET_IND command. Subsequently, the zapSysResetInd() function is called to alert the ZAP layer that it has received the reset indication and that it can now go ahead and configure the ZNP. From now on, we’ll call this the “ZNP sync event”. Creating a ZigBee® Smart Energy Device with the MSP430F54xx and the CC2530-ZNP January 2010 (ZigBee Pro Network Processor)
  • 4. 4 Texas Instruments ZNP configuration The first thing the user has to do is decide whether to restore the network state of the ZNP device every time a ZNP sync event occurs. This is selectable by the compile option ZAP_NV_RESTORE. If ZAP_NV_RESTORE is set to FALSE, the network state of the ZNP will be cleared, and default configuration used. zapAfSync() and zapZdoSync() are used to register application endpoints and ZDO callbacks, respectively. The host application must do this upon every ZNP sync event since application endpoint and callback information are not saved in ZNP non-volatile memory. The application then makes a series of calls using znp_nv_write for the items ZCD_NV_LOGICAL_TYPE, ZDAPP_CONFIG_PAN_ID, DEFAULT_CHANLIST to configure the logical device type (coordinator, router, or end device), PAN ID, and scan channel mask, respectively. The default values from the zap.cfg configura- tion file are taken as values. When the compile option TC_LINKKEY_JOIN is defined, zapCertSync() is called to configure test certificate data for ZigBee® CBKE (Certificate Based Key Establishment) security. Note that since these configuration items are declared as global variables within the ZNP, a reset of the ZNP is not required to change these items at runtime. Note that this configuration of ZNP has been automated if the ZAP_AUTO_CFG compile option is set to TRUE in zap.cfg. Once all the configuration changes are made, the host processor can then start the device by calling ZDOInitDevice which in turn calls the ZDO_STARTUP_FROM_APP ZNP API function. The compile option ZAP_ZDO_STARTUP_AREQ is used to allow the ZDO_STARTUP_FROM_APP command to be sent as an asynchronous request (AREQ) because the device startup process (which includes scanning for networks) could take > 400 msec. Therefore, this allows the application to service other tasks instead of having to wait for the synchronous response (SRSP). The status of this request will be queued for the host processor as a ZDO_STATE_CHANGE_IND command. This indication is then passed up to the application task to notify it that the device has a valid ZigBee network address. The application then processes this event as: case ZDO_STATE_CHANGE: if ((DEV_END_DEVICE == (devStates_t)(MSGpkt->hdr.status)) || (DEV_ROUTER == (devStates_t)(MSGpkt->hdr.status))) { // device is on the ZigBee network Note that this network startup of ZNP has been automated if the ZAP_AUTO_START compile option is set to TRUE in zap.cfg. Registering application Part of the application’s initialization function is to register for the SE endpoint and desired ZDO callbacks. For endpoints and ZDO example, the function zclSE_Init registers the SE endpoint description with the ZNP. callbacks Creating a ZigBee® Smart Energy Device with the MSP430F54xx and the CC2530-ZNP January 2010 (ZigBee Pro Network Processor)
  • 5. Texas Instruments 5 // register for SE endpoint zclSE_Init( &simpleMeterSimpleDesc ); This translates into a ZAP proxy function called znp_afRegisterExtended() which uses the AF_REGISTER ZNP API to register this endpoint with the ZNP. The application can also register for certain ZDO callback notifications. The Energy Service Portal (ESP) example registers for the following ZDO callbacks: // register for end device annce and simple descriptor responses ZDO_RegisterForZDOMsg( espTaskID, Device_annce ); ZDO_RegisterForZDOMsg( espTaskID, Simple_Desc_rsp ); The ZDO_RegisterForZDOMsg() function then calls the ZAP proxy function znp_ZDO_RegisterForZDOMsg(), which sends the ZDO_MSG_CB_REGISTER command to the ZNP. When the ZAP layer receives an incoming ZDO command, the function zapZdoProcessIncoming is called. The command is then processed in the case handler for MT_ZDO_MSG_CB_INCOMING. This command handler then calls ZDO_SendMsgCBs in order to parse and determine which application task should receive the callback. The ESP application uses the end device announce to detect when other devices join the SE network. The ESP then uses the ZDO simple descriptor request to query the device for what type of device it is. Both callbacks are processed as follows: static void esp_ProcessZDOMsg( zdoIncomingMsg_t *inMsg ) { ZDO_DeviceAnnce_t devAnnce; switch ( inMsg->clusterID ) { case Device_annce: { ZDO_ParseDeviceAnnce( inMsg, &devAnnce ); simpleDescReqAddr.addrMode = (afAddrMode_t)Addr16Bit; simpleDescReqAddr.addr.shortAddr = devAnnce.nwkAddr; // set simple descriptor query event osal_set_event( espTaskID, SIMPLE_DESC_QUERY_EVT ); Creating a ZigBee® Smart Energy Device with the MSP430F54xx and the CC2530-ZNP January 2010 (ZigBee Pro Network Processor)
  • 6. 6 Texas Instruments } break; case Simple_Desc_rsp: { ZDO_SimpleDescRsp_t *pSimpleDescRsp; // pointer to received simple desc response pSimpleDescRsp = (ZDO_SimpleDescRsp_t *)osal_mem_alloc( sizeof( ZDO_ SimpleDescRsp_t ) ); ……… Initiating key When full ZigBee® CBKE security is used with the Certicom Elliptic Curve Cryptography (ECC) library, in order establishment to establish an application link key with the ESP, the function zclGeneral_KeyEstablish_InitiateKeyEstablishment is called. This in turn sends the UTIL_ZCL_KEY_EST_INIT_EST command to the ZNP. As the entire ECC pro- cess could take up to 20 seconds, zapPhyWait(zapAppPort, ZCL_KEY_EST_INIT_EST_WAIT) is called to tell the low-level SPI driver to wait at least 30 seconds before timing out on the SRSP. When the key establish- ment process completes, the zapUtilProcessIncoming function will notify the application via the MT_UTIL_ ZCL_KEY_ESTABLISH_IND handler. The application can then decide to use this indication to determine that it can start to communicate with the ESP. For example, in the simple meter example we have: case ZCL_KEY_ESTABLISH_IND: if ((MSGpkt->hdr.status) == TermKeyStatus_Success) { osal_start_timerEx( simpleMeterTaskID, SIMPLEMETER_REPORT_ATTRIBUTE_EVT, SIMPLEMETER_REPORT_PERIOD ); } Sending Smart Once the key establishment procedure is complete, sending application commands is straightforward. The Energy profile ZCL layer provides API functions to send correctly formatted SE commands, such as the following, which is commands used in the simple meter example to send a report attribute command to the ESP: zcl_SendReportCmd( SIMPLEMETER_ENDPOINT, &ESPAddr, ZCL_CLUSTER_ID_SE_SIMPLE_METERING, pReportCmd, ZCL_FRAME_SERVER_CLIENT_DIR, 1, 0 ); Creating a ZigBee® Smart Energy Device with the MSP430F54xx and the CC2530-ZNP January 2010 (ZigBee Pro Network Processor)
  • 7. Texas Instruments 7 These commands are translated into AF_DATA_REQUEST commands that are sent to the ZNP. In the Smart Energy Sample Application Project, there are also other device configurations such as the In-Premise Display and Load Control Device that show examples of how to use commands related to Pricing and Demand Response and Load Control, respectively. Receiving Smart Any incoming over-the-air message is extracted by the host processor (as an AF_INCOMING_CMD) and then Energy profile passed up to the ZCL layer. The application registers callbacks for each command that it wishes to process commands on the receive side. As the ESP has to support all SE commands, all SE callbacks are registered by the ESP application: static zclSE_AppCallbacks_t esp_SECmdCallbacks = { esp_GetProfileCmdCB, // Get Profile Command esp_GetProfileRspCB, // Get Profile Response esp_ReqMirrorCmdCB, // Request Mirror Command esp_ReqMirrorRspCB, // Request Mirror Response esp_MirrorRemCmdCB, // Mirror Remove Command esp_MirrorRemRspCB, // Mirror Remove Response esp_GetCurrentPriceCB, // Get Current Price esp_GetScheduledPriceCB, // Get Scheduled Price esp_PublishPriceCB, // Publish Price esp_DisplayMessageCB, // Display Message Command esp_CancelMessageCB, // Cancel Message Command esp_GetLastMessageCB, // Get Last Message Command esp_MessageConfirmationCB, // Message Confirmation esp_LoadControlEventCB, // Load Control Event esp_CancelLoadControlEventCB, // Cancel Load Control Event esp_CancelAllLoadControlEventsCB, // Cancel All Load Control Events esp_ReportEventStatusCB, // Report Event Status esp_GetScheduledEventCB, // Get Scheduled Event }; For example when the ESP receives a Get Current Price command from an In-Premise Display, the esp_GetCurrentPriceCB callback function is called and the Publish Price command is sent back: Creating a ZigBee® Smart Energy Device with the MSP430F54xx and the CC2530-ZNP January 2010 (ZigBee Pro Network Processor)
  • 8. 8 Texas Instruments static void esp_GetCurrentPriceCB( zclCCGetCurrentPrice_t *pCmd, afAddrType_t *srcAddr, uint8 seqNum ) { #if defined ( ZCL_PRICING ) // On receipt of Get Current Price command, the device shall send a // Publish Price command with the information for the current time. zclCCPublishPrice_t cmd; osal_memset( &cmd, 0, sizeof( zclCCPublishPrice_t ) ); cmd.providerId = 0xbabeface; cmd.priceTier = 0xfe; // copy source address of display device that requested current pricing info so // that esp can send messages to it using destination address of IPDAddr osal_memcpy( &ipdAddr, srcAddr, sizeof ( afAddrType_t ) ); zclSE_Pricing_Send_PublishPrice( ESP_ENDPOINT, srcAddr, &cmd, false, seqNum ); #endif // ZCL_PRICING } Conclusion This paper has described how to create a ZigBee® Smart Energy device using the MSP430F54xx as the host application processor to the CC2530-ZNP (ZigBee Pro Network Processor). A typical smart meter application that would benefit most from this type of architecture would be a gas or water meter since extended battery life of 10 years or greater is a key requirement for these devices. The MSP430F54xx and CC2530-ZNP combination provides a low-power and low-cost solution that meets this requirement. The ZAP software ap- plication framework provides an easy-to-use development environment that accelerates ZigBee development for smart meter applications. Creating a ZigBee® Smart Energy Device with the MSP430F54xx and the CC2530-ZNP January 2010 (ZigBee Pro Network Processor)
  • 9. Texas Instruments 9 References [1] CC2530-ZNP Interface Specification, SWRA312 [2] OSAL API document, SWRA194 [3] Z-Stack™ API document, SWRA195 [4] ZCL API document, SWRA197 [5] Z-Stack Smart Energy Developer’s Guide, SWRA216 For more information on Smart Metering devices from TI, visit www.ti.com/metering, or e-mail: metering@ti.com Important Notice: The products and services of Texas Instruments Incorporated and its subsidiaries described herein are sold subject to TI’s standard terms and conditions of sale. Customers are advised to obtain the most current and complete information about TI products and services before placing orders. TI assumes no lia- bility for applications assistance, customer’s applications or product designs, software performance, or infringement of patents. The publication of information regard- ing any other company’s products or services does not constitute TI’s approval, warranty or endorsement thereof. MSP430 and Z-Stack are trademarks of Texas Instruments Incorporated. All other trademarks are the property of their respective owners. © 2010 Texas Instruments Incorporated SLYY022
  • 10. IMPORTANT NOTICE Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements, and other changes to its products and services at any time and to discontinue any product or service without notice. Customers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All products are sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment. TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI’s standard warranty. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where mandated by government requirements, testing of all parameters of each product is not necessarily performed. TI assumes no liability for applications assistance or customer product design. Customers are responsible for their products and applications using TI components. To minimize the risks associated with customer products and applications, customers should provide adequate design and operating safeguards. TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right, copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process in which TI products or services are used. Information published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI. Reproduction of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional restrictions. Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements. TI products are not authorized for use in safety-critical applications (such as life support) where a failure of the TI product would reasonably be expected to cause severe personal injury or death, unless officers of the parties have executed an agreement specifically governing such use. Buyers represent that they have all necessary expertise in the safety and regulatory ramifications of their applications, and acknowledge and agree that they are solely responsible for all legal, regulatory and safety-related requirements concerning their products and any use of TI products in such safety-critical applications, notwithstanding any applications-related information or support that may be provided by TI. Further, Buyers must fully indemnify TI and its representatives against any damages arising out of the use of TI products in such safety-critical applications. TI products are neither designed nor intended for use in military/aerospace applications or environments unless the TI products are specifically designated by TI as military-grade or "enhanced plastic." Only products designated by TI as military-grade meet military specifications. Buyers acknowledge and agree that any such use of TI products which TI has not designated as military-grade is solely at the Buyer's risk, and that they are solely responsible for compliance with all legal and regulatory requirements in connection with such use. TI products are neither designed nor intended for use in automotive applications or environments unless the specific TI products are designated by TI as compliant with ISO/TS 16949 requirements. Buyers acknowledge and agree that, if they use any non-designated products in automotive applications, TI will not be responsible for any failure to meet such requirements. Following are URLs where you can obtain information on other Texas Instruments products and application solutions: Products Applications Amplifiers amplifier.ti.com Audio www.ti.com/audio Data Converters dataconverter.ti.com Automotive www.ti.com/automotive DLP® Products www.dlp.com Communications and www.ti.com/communications Telecom DSP dsp.ti.com Computers and www.ti.com/computers Peripherals Clocks and Timers www.ti.com/clocks Consumer Electronics www.ti.com/consumer-apps Interface interface.ti.com Energy www.ti.com/energy Logic logic.ti.com Industrial www.ti.com/industrial Power Mgmt power.ti.com Medical www.ti.com/medical Microcontrollers microcontroller.ti.com Security www.ti.com/security RFID www.ti-rfid.com Space, Avionics & www.ti.com/space-avionics-defense Defense RF/IF and ZigBee® Solutions www.ti.com/lprf Video and Imaging www.ti.com/video Wireless www.ti.com/wireless-apps Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright © 2010, Texas Instruments Incorporated