ZigBee protocol Stack ti z-Stack Analysis

Source: Internet
Author: User

ZigBee terminology

I,Attribute is a data value that reflects the physical quantity or status, such as the switch value On/Off), temperature value, percentage, and so On.

II,A Cluster is a group that contains one or more attribute attributes. In short, a cluster is a set of attributes. Each cluster is assigned a unique cluster ID and each cluster has a maximum of 65536 attributes.

III,Device description device description DeviceDescription refers to a part of a large target application, including one or more clusters, and specifies whether the cluster is input or output.

IV,EndPoint is the entry to the application layer of the protocol stack. It can also be understood that the Application Object ApplicationObject exists. It is a group of clusters defined to implement a device description. Each ZigBee device can support a maximum of 240 such endpoints, which also means that 240 application objects can be defined on each device. The endpoint 0 is retained for the ZDO interface, the endpoint 255 is retained for broadcast, and the endpoint 241-254 is retained for future extension.

V,The Configuration File Profile can be understood as a collection of multiple device description items that jointly contribute to the interactive application. The ZigBee Alliance has defined some standard configuration files, such as remote control switch configuration files and optical sensor configuration files. Any node that complies with a standard configuration file can interoperate with nodes that implement the same configuration file. You can also create your own configuration file and submit it to the ZigBee Alliance for testing and approval. A configuration file is a set of descriptions of logical devices and their interfaces. It is a convention and criterion for an application. A device descriptor is a description provided by a distributed application. Multiple descriptions form a description set Profile. The purpose of defining the Profile is to enable the ZigBee devices produced by different manufacturers to achieve interoperability.

VI,A Node can also be understood as a container that contains a set of ZigBee devices and shares a wireless channel. Each node has only one wireless channel.

VII,Binding) ZigBee defines a special process called endpoint Binding. Binding creates a logical link between an EndPoint of the source node and an EndPoint of the target node. Binding can happen between two or more devices. The Coordinator node maintains a binding table that basically includes a logical link between two or more endpoints. The binding table contains the following information: IEEE address, Endpoint number, and ClusterID of the source and target nodes. For the two nodes that can establish a binding relationship, the Cluster attribute must be "input" and "output" respectively, and the ClusterID value is equal, they can be bound to each other. If the extension address of the target device is known, call the zb_BindDeviceRequest () function to create a binding entry.

8,Addressing) in the ZigBee network, two types of addresses are used: one is a 64-bit IEEEAddress, also known as a physical address, and the 64-bit address is unique among all ZigBee devices, it contains a 24-digit manufacturer-specific organization identifier OUIOrganizationallyUniqueIdentifier allocated by IEEE ). The other is a 16-bit NWKAddress, which is the network address. When a device is added to the ZigBee network, it obtains a 16-bit network address from the parent device that allows it to join. This address is unique in the ZigBee network for data transmission and packet routing. In ZigBee, data packets can be transmitted by single point (unicast), multi-point transmission (multicast), or broadcast transmission (broadcast). Therefore, the address mode parameter must exist. A single point of transmission packet is sent only to one device. A multi-point transmission packet is sent to a group of devices, and a broadcast packet is sent to all nodes in the network. When an application needs to send packets to a group of devices on the network, GroupAddressing can also be used ).

TIZ-Stack protocol Stack Architecture Analysis

 

The protocol stack defines how communication hardware and software are coordinated at different levels. In the network communication field, entities at each protocol layer communicate with peer-to-peer entities by packaging information. In the sender of the communication, the data packets to be transmitted pass through each protocol layer in sequence from the top to the bottom, the entity of each layer adds its own information to the data information according to the originally scheduled Message format. For example, the header information and verification of each layer finally reach the lowest physical layer and become a data bit stream, transmitted between physical connections. The receiver data packets of communication are sequentially pushed up through the Protocol Stack. The entity of each layer can accurately extract the data information that needs to be processed at the current layer according to the predefined format, the end user application obtains the final data information for processing. The implementation of ZigBee wireless network is based on the ZigBee protocol stack. The protocol stack uses a layered structure protocol layer to ensure that each layer is relatively independent, and each layer provides some services, A service is defined by a Protocol. A programmer only needs to care about the protocols at those layers that are directly related to his work. They provide services to the higher level and provide services at the lower level. In the ZigBee protocol stack, the PHY and MAC layers are at the lowest layer and related to hardware. The NWK, APS, APL layers and security layers are built on the PHY and MAC layers, and has nothing to do with hardware. The layered structure is clear and clear at a glance, which brings great convenience to design and debugging. The entire Z-Stack uses a hierarchical software structure, Hardware Abstraction Layer HAL) provides drivers for various hardware modules, including the Timer, General I/O port GPIO, general asynchronous transceiver UART, the application interface API of the ADC provides a set of extensions for various services. The OS abstraction layer OSAL provides an easy-to-use operating system platform. It uses the time slice rotation function to schedule tasks and provides a multi-task processing mechanism. Users can call the APIS provided by OSAL for multi-task Programming and use their applications as independent tasks.

Z-stackOSALAPI introduces that the OSAL layer is independent from the protocol stack, but the entire Protocol can only run based on OS. OSAL provides the following services and management: Information Management, task synchronization, time management, interrupt management, task management, memory management, power management, and non-Easy loss storage management.

I,Information management API Information Management provides a management mechanism for information exchange between tasks or external processing events, such as service interruption or function calls in a control loop. Including API functions such as allowing tasks to be allocated or not allocating information caches, sending command information to other tasks, and receiving response information.

II,Synchronization task API this API allows a task to wait for an event and return control during the wait period. This API is used to set events for a task. Once any event is set, the task is modified.

III,Time management API this API allows the timer to be used by internal Z-Stack tasks and external tasks. This API allows you to start and stop a timer, which can be set in milliseconds.

IV,Interrupt Management APIs these APIs are interfaces for external interruptions and tasks. These API functions allow a task to assign a specified service program to each interrupt. These interruptions can be allowed or prohibited. In a service program, you can set events for other tasks.

V,Task Management API this API is used to manage tasks in OSAL, including the creation, management, and information processing of system tasks and user-defined tasks.

VI,Memory Management API this API depicts a simple storage allocation system. These functions allow dynamic storage allocation.

VII,The power management API describes the OSAL power management system. When OSAL securely disables the receiver and external hardware and enables the processor to sleep, the system provides a way to notify the application/task of the transaction.

Edit recommendations]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.