The Zigbee protocol stack structure is composed of a series of protocol blocks called layers. Each layer provides a specific set of services to the layer above. The data portal provides data transmission services, and the management portal provides all other services. Each service interface exchanges data with the upper layer through the SAP (Service Access Point) interface, and each SAP supports a series of service primitives.
The zigbee protocol stack is based on the OSI (Open Systems Interconnection) standard, but only defines the required layers. It is mainly composed of physical layer PHY, media access layer MAC, network layer and application framework layer. The framework diagram is shown in the figure. Among them, the PHY layer and MAC layer adopt the IEEE802.15.4 protocol standard.
1. Zigbee network layer
The zigbee network layer is mainly used for networking connection, data management and network security of zigbee wireless personal area network WPAN network. The network layer needs to be functionally compatible with the IEEE 802.15.4 standard, and the upper layer also needs to provide appropriate functional interfaces.
1. Main functions of zigbee network layer:
For the network layer, the main functions it completes and provides are as follows:
(1) Generate network layer data packets: When the network layer receives data packets from the application sublayer, the network layer parses the data packets, and then adds the appropriate network layer header for transmission to the MAC.
(2) Routing function of network topology: The network layer provides the function of routing data packets. If the destination node of the packet is this node, the data packet is sent to the application sublayer. If not, the packet is forwarded to the next node in the routing table.
(3) Configure new device parameters: The network layer can configure appropriate protocols, such as establishing a new coordinator and initiating network establishment or joining an existing network.
(4) Establish PAN network
(5) Connecting to or leaving the PAN network: The network layer can provide the function of joining or leaving the network. If the node is a coordinator or router, it can also require the child nodes to leave the network.
(6) Assign network address: If this node is a coordinator or router, the network address of the byte point connected to the node is controlled by the network layer.
(7) Discovery of neighbor nodes: The network layer can discover and maintain network neighbor information.
(8) Establish routing: The network layer provides routing functions.
(9) Control reception: The network layer can control the reception time and status of the receiver.
2.Zigbee network layer structure
In order to provide an interface to the application layer, the network layer provides two functional service entities, namely the data service entity NLDE and the management service entity NLME. NLDE provides data transmission services for the application layer through NLDE-SAP, and NLME provides network management services for the application layer through NLME-SAP. In addition, NLME also completes the maintenance and management of the network information base NIB.
2. Zigbee application layer
The zigbee application framework layer mainly provides some application framework models for the actual application of zigbee technology to facilitate the development and application of zigbee technology. In different application situations, the development and application frameworks are different. From the current point of view, the application frameworks provided by different manufacturers are There are differences. The zigbee application layer includes application support sublayer APS, application framework AF, and zigbee device object ZDO. Together, they provide a unified interface for application developers.
1. Application support sub-layer APS
Main functions of APS layer:
(1) Processing of APS layer protocol data unit APDU.
(2) APSDE provides a data transmission mechanism between application entities in the same network.
(3) APSME provides a variety of services to application objects, including security services and binding devices, and maintains a database of management objects, which is what we often call AIB.
2. Application Framework AF
The Application Framework provides a template-style activity space for each user-defined application object, and provides each application object with two services: key-value pair KVP service and message MSG service for data transmission.
In addition to the 64-bit IEEE address and 16-bit network address, each node also provides an 8-bit application layer entry address, corresponding to the user application object. Endpoint 0 is the ZDO interface, endpoints 1 to 240 are user-defined for object use, endpoint 255 is the broadcast address, and endpoints 241 -254 are reserved for future use. Each application corresponds to a profile. The configuration file includes: Device ID, transaction cluster ID (clusterID), attribute ID (Attribute ID), etc. AF can use this information to determine the service type.
3.zigbee device object ZDO
ZDO is a special application layer endpoint. It is the middleware for other endpoints of the application layer to interact with the management entities of the application sub-layer. The main functions it provides are as follows:
(1) Initialize application support sub-layer, network layer.
(2) Discover nodes and node functions. In a beaconless network, a joining node is only visible to its parent node. Other nodes can use the ZDO function to determine the overall topology of the network and the functions that the node can provide.
(3) Security encryption management: mainly includes the establishment and sending of security keys, which have been securely authorized.
(4) Network maintenance function.
(5) Binding management: The binding function is provided by the application support sublayer, but the management of the binding function is provided by ZDO, which determines the size of the binding table, the initiation of binding and the cancellation of binding, etc. .
(6) Node management: For network coordinators and routers, ZDO provides a series of node management functions such as network monitoring, obtaining routing and binding information, and initiating the process of leaving the network.
ZDO is actually an endpoint between the application layer endpoint and the application support sub-layer, and its main functions focus on network management and maintenance. The endpoints of the application layer can obtain information about the network or other nodes through the functions provided by ZDO, including the topology of the network, the network addresses and status of other points, the types of other points and the services provided.
At present, companies at home and abroad that can provide ZigBee solutions include TI, Jennic, ST, Atmel, Freescale, etc. Among them, TI provides the most complete technical solutions. The ZigBee protocol stack provides a full set of function implementations for the ZigBee protocol from underlying hardware signal processing to system layer data reading and message processing. Application developers do not need to understand the underlying hardware signal processing process and hardware organization structure. The benefit is to accelerate things Development of Internet-connected applications brings products to market faster. Keywords: cost-effective 4G RTU