banner
Sunma

Sunma

看海天一色,听风起雨落 执子手吹散苍茫茫烟波

Detailed Explanation and Application of the KNX Bus Protocol

What is KNX?#

More convenience, more safety, and more energy efficiency: The demand for building management systems is continuously increasing.
Whether in a simple home or a complex office, the need for comfort and multifunctional management of air conditioning, lighting, and access control systems is on the rise. At the same time, the effective use of energy is becoming increasingly important. However, the requirements for greater convenience and safety, combined with low energy consumption, can only be achieved through intelligent control and monitoring of all related products. This means more wiring, sensors, and actuators are needed for control and monitoring. This extensive wiring, in turn, leads to higher design and installation labor, increased fire hazards, and high costs.
KNX - The only open international standard in the field of residential and building control.
To transmit control data to all building management components, a system is required to handle the issues of specific devices, ensuring that all components communicate through a common language: in short, a system like the KNX bus that is independent of manufacturers and application fields. This standard is based on over 15 years of market experience, transitioning from existing systems to KNX: EIB, EHS, and BatiBUS. All bus devices connected to the KNX medium (which includes twisted pair, radio frequency, power line, or IP/Ethernet) can exchange information. Bus devices can be sensors or actuators used to control building management devices such as: lighting, shading/blinds, security systems, energy management, heating, ventilation, air conditioning systems, signaling and monitoring systems, service interfaces, building control systems, remote control, metering, video/audio control, large appliances, etc. All these functions can be controlled, monitored, and signaled through a unified system without the need for an additional control center.
Lighting
Shading and Blinds
Security Systems
Energy Management
HVAC Systems
Monitoring Systems
Remote Control
Metering
Video/Audio Control
Large Appliances
The KNX Association is the creator and owner of KNX technology. KNX technology is the only worldwide standard that is open to all applications in residential and building control, including lighting and various security system shutdown controls, heating, ventilation, air conditioning, monitoring, alarms, water control, energy management, measurement, as well as home appliances, audio, and many other fields. This technology can be applied in both existing and new residential and building structures.
For members of the KNX Association, the system is licensed free of charge and can run on any processor platform. All products bearing the KNX logo have been certified to ensure system compatibility, interoperability, and interconnectivity.

KNX Technology#

1. Transmission Technology Characteristics#

KNX/EIB is an event-driven distributed bus system. The system uses serial data communication for control, monitoring, and status reporting. All bus devices exchange information through a shared serial transmission connection (i.e., the bus). Data transmission follows the rules defined by the bus protocol. The information to be sent is first packaged into a standard transmission format (i.e., a message) and then transmitted via the bus from a sensor device (command sender) to one or more actuator devices (command receivers).
The data transmission and power supply (DC 24V) for KNX/EIB bus devices share a single cable. The message is modulated onto the DC signal. Individual data within a message is transmitted asynchronously, but the entire message is synchronized as a whole by adding start and stop bits.
Asynchronous transmission requires access control for the bus as a shared communication physical medium. KNX/EIB uses CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance) protocol, while CSMA/CD protocol ensures access to the bus without collisions while maintaining transmission speed.
Although all bus devices are listening and transmitting messages, only devices with specific corresponding addresses will respond. To send a message, a bus device must first listen to the bus and wait for other bus devices to finish sending messages (this is called Carrier Sense). Once the bus is free, theoretically, any bus device can initiate the sending process (this is called Multiple Access).
If two bus devices start sending simultaneously, the device with the higher priority can continue transmitting without delay (this is called Collision Avoidance). Meanwhile, the lower priority bus device will stop transmitting and wait to retry later; if both have the same priority, the device with the lower physical address can take precedence.

2. Topology#

The minimum structure of the system is called a line, and generally (using a 640mA bus power supply), a maximum of 64 bus elements can operate on the same line. If necessary, the number of bus devices on a line can be increased by adding system devices after calculating the line length and bus communication load, with a maximum of 256 bus devices on one line.
The wire length of a line (including all branches) cannot exceed 1000m, and the wire distance between the bus device and the nearest power supply cannot exceed 350m. To avoid message collisions, the wire distance between two bus devices cannot exceed 700m.
Bus cables can be laid in parallel with 220V power supply cables and can form loops and branches. Bus wires do not require terminal connectors. When the number of bus elements connected to the bus exceeds 64, a maximum of 15 lines can be combined on a main line through a line coupler (LC). The structure described above is called a domain. Each line can connect 64 bus elements, and a domain contains 15 lines, allowing for a total of 15*64 bus elements to be connected.
The installation bus can be expanded in a trunk line manner, with trunk couplers (BC) connecting its domain to the trunk line. Up to 15 domains can be connected to the trunk line, allowing for more than 14,000 bus elements to be connected.

3. Bus Elements#

Bus elements are divided into two categories: sensors and actuators.
Sensors are responsible for detecting operations of smart panels in buildings; changes in signals such as light, temperature, humidity, etc.; and signals when timers reach their set times.
Actuators are responsible for receiving bus signals transmitted by sensors and executing corresponding actions, such as turning lights on and off and adjusting brightness; controlling shading motors/blinds; switching air conditioning fans, adjusting water valves, etc.

4. Bus Power Supply and Technical Parameters#

Each twisted pair KNX/EIB line has its own independent power supply, ensuring that even if one line loses power, other parts of the KNX/EIB system can still operate normally.
The KNX/EIB bus power supply provides a safe extra-low voltage (SELV) of DC 24V to each bus device on its line.
Depending on the number of bus devices on each line, KNX/EIB bus power supplies of 160mA, 320mA, or 640mA can be selected. The KNX/EIB bus power supply also includes overvoltage and overcurrent protection devices and provides a 200ms buffer for brief power outages.
The bus load is related to the types of bus devices connected, which must operate at a DC voltage greater than 21.5V. The typical power consumption of bus devices is 150mW, but if there are additional power-consuming application units (such as LEDs), their power consumption may increase to 200mW. If more than 30 bus devices are connected within a short distance (e.g., in the same control panel), the power supply must be installed near these devices. A maximum of two power supplies is allowed on one line, and they must be at least 200m apart (in wire length).

KNX Applications#

KNX/EIB building intelligent control is suitable for various complex functional buildings, from private residences to hotels, banks, office buildings, sports, and entertainment venues.
● Office buildings, schools, hospitals, factories - Utilize KNX/EIB's time control function to automate lighting control, use brightness sensors to automatically adjust illumination, and save energy. Central monitoring can be performed, and it can connect with building automation systems. Modifying the lighting layout does not require rewiring, reducing investment.
● Theaters, conference rooms, clubs, nightclubs - Utilize the KNX/EIB system's dimming function and scene switches to easily switch between multiple lighting scenes, achieving multi-point control. The KNX/EIB system can control air conditioning, fans, electric doors and windows, heaters, speakers, buzzers, flashing lights, and other devices.
● Outdoor public lighting in stadiums, municipal projects, squares, parks, streets, etc. - Utilize the KNX/EIB group control function to control lighting in entire areas without considering switch capacity issues, using brightness sensors and timed switches to achieve automated lighting control, and using KNX/EIB monitoring software for intelligent lighting control.
● Intelligent community lighting control - Remote, multi-point, and timed control of streetlights and landscape lights in intelligent communities, monitored by a central control center; scene, multi-point, group, and remote control of lighting in community clubhouses and smart homes; and cooperation with other home intelligent controllers.

KNX Protocol Details#

1. KNX System Topology#

The KNX network is a completely peer-to-peer distributed network, where each device connected to the network has equal status. Its network topology is shown below:

886a0618232ce352.png

The minimum installation unit of the KNX system is a line (Line), with each line capable of connecting up to 64 bus elements, which can be expanded to 255 elements using line repeaters (Line Repeaters); when the number of bus elements connected exceeds 255 or a different structure is required, line couplers (Line Couplers) can be used to connect 15 lines into a larger topological unit called a domain (Domain); each line connects to the trunk line through an LC, which requires a system power supply device. The backbone line coupler (Backbone Line Coupler) can connect 15 domains together into an area (Area). The area, domain, and line correspond to the physical addresses of the components, with the address format being A.B.C, where A, B, and C are clearly defined, occupying a total of two bytes, with the address format shown below:

9c7b4771f559387d.png

To achieve one-to-many communication between bus devices, KNX devices provide group addresses, allowing one node to send data that can be received and acted upon by multiple nodes with the same group address. The same device can have multiple group addresses, and multiple devices can share the same group address. Group addresses can be divided into two-layer (main group, sub-group) and three-layer (main group, sub-group, intermediate group) address formats, as shown below:

73e3e5352f617426.png

2. KNX Transmission Technology Characteristics#

The KNX system is an event-driven distributed bus system. All node devices in the KNX system need to be connected to the KNX serial transmission connection (commonly referred to as the bus) for data interaction and transmission, while data interaction and transmission must comply with the standards defined by the KNX bus protocol. The information to be sent, or the message, must first be packaged into the standard KNX message format and then transmitted via the KNX bus from a sensor device node (message sender) to one or more actuator device nodes (message receivers). These actuator device nodes decompose and analyze the received message information to achieve specific application functions. One of the media for the KNX bus is twisted pair, where data and power share the same twisted pair, and each node device uses dedicated bus chips to separate data and power energy.

KNX transmission technology uses the Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA) protocol as the bus access control protocol. The CSMA/CA protocol ensures that the bus transmission speed is not reduced while preventing message collisions on the bus.

(1) Although all node devices on the KNX bus are listening and ready to receive transmitted message information, only node devices with corresponding addresses will respond. To send a message, the node device must first listen to the KNX bus and wait for other node devices that are sending messages to finish before it can send its message, which is called Carrier Sense (CS).

(2) Once the KNX bus is free, theoretically, each KNX node device can initiate the message sending process, which is called Multiple Access (MA).

(3) However, if two KNX node devices start sending KNX message information simultaneously, the node device with the higher priority can continue sending without delay, while the lower priority node device will stop sending and wait to retry later. If both node devices have the same priority, the device with the lower physical address can send first, which is called Collision Avoidance (CA).

3. KNX Protocol Model#

The KNX protocol follows the ISO/OSI seven-layer protocol specification, allowing it to communicate well with other protocols based on the ISO/OSI model. The KNX protocol simplifies the seven-layer protocol into five layers: physical layer, data link layer, network layer, transport layer, and application layer, while retaining the session layer and presentation layer. Below is a brief introduction to each layer.

ff0bacf7aea07091.png
7489447cb5e71e30-1.png

3.1 Physical Layer
The physical layer implements the transmission of logical signals, sending data frames bit by bit onto the bus for transmission. When a conflict is detected, it stops and enters a retransmission mechanism. The KNX system offers different physical layer transmission medium options for vendors. With the increased availability of routers and robust network technology, the combination of multiple media access and various vendor configurations has become possible.

92a02a886b23814f-1.png

The KNX bus primarily defines and standardizes transmission media types such as twisted pair, power line, wireless radio frequency, and IP, with different transmission media corresponding to different media accessory units and physical layer logical units.

3.2 Data Link Layer
The data link layer provides media access control and logical link control, ensuring reliable message transmission between two or more devices within the same subnet.

When sending messages, the data link layer primarily performs the following functions:

  • Assembles complete frames from information passed down from the network layer.
  • Gains access to the media based on the specific media access protocol used.
  • Uses physical layer services to transmit messages to one or more peer devices' data link layers.

When receiving messages, the data link layer primarily performs the following functions:

  • Determines whether the message is complete.
  • Decides whether to forward the frame to the upper layer based on the destination address.
  • Sends acknowledgment frames back to the data link layer of the sender.

A KNX message consists of several bytes, with the last byte being a checksum byte, using odd parity. If sending ends, the addressed network node will send an acknowledgment frame after a 13-bit interval. If multiple nodes are addressed, they will all send this acknowledgment frame simultaneously, but only one acknowledgment frame will be visible on the bus. If a node fails to receive, the receiver will send a negative acknowledgment frame (INAK), while the correctly receiving node will send a positive acknowledgment (IACK), and a busy node will send a busy acknowledgment (BUSY). BUSY can override all INAKs, and INAK can override all IACKs. Since acknowledgment frames do not contain address information, the sender cannot know which receiver did not receive the data, so when the sender receives an INAK or BUSY, it will resend the message to all nodes.

Two different data units can be generated at the data link layer, known as Link Layer Protocol Data Units (LPDU), which include message telegrams (Message telegrams) and acknowledgments (Acknowledgments). Below is an introduction to their data formats.

(1) Acknowledgment

An acknowledgment is a message sent by the addressed node after receiving a message, with each acknowledgment frame containing only one byte. Acknowledgments are divided into three types:

  • IACK: The addressed node correctly received the message.
  • INAK: The addressed node failed to correctly receive the message.
  • BUSY: The device is busy.

The priority is: BUSY > INAK > IACK, with the frame format as follows:

73bc6a8d05b5b3fc.png

(2) Message Telegram

The message telegram contains the information that needs to be transmitted on the KNX bus, mainly consisting of control bytes, source address, destination address, length byte, checksum byte, and data link layer service unit. The composition is as follows:

9d27b01776a0d783.png

The data link layer adds a series of control information to the data link layer service data unit (Link Layer Service Data Unit, LSDU) to form the final message. The additional control information at the data link layer mainly includes the following aspects:

  • Control byte: Defines 2 bits of KNX message priority information and 1 bit indicating whether the message is a duplicate.
  • Source address: Contains the physical address of the node sending the message, composed of high and low bytes.
  • Destination address: Contains the address of the receiving node, which can be either a physical address or a group address, determined by the highest bit in the length byte.
  • Length: Defines a 1-bit target address type (physical address or group address), 4 bits of data link layer service data unit length information, and 3 bits of routing counter information (defined by the network layer).
  • Checksum byte: A byte generated by performing odd parity on all bits of the entire message.

3.3 Network Layer
The KNX network layer only performs the function of routing counting. To prevent routing loops, the network layer sets a routing counter. Each data message contains a 3-bit routing counter, which can be set to an initial value during configuration, with a maximum value of 7. Each time a KNX message passes through a backbone router or coupler, the counter automatically decrements. When the counter value reaches 0, the message transmission is abandoned, effectively solving the problem of message loops and ensuring the communication efficiency of the KNX bus.

3.4 Transport Layer
The transport layer is responsible for end-to-end data transmission, with two transmission modes:

(1) Connectionless Transmission Mode:

In connectionless transmission mode between KNX nodes, a message sent by the sending node can be simultaneously sent to one or more target nodes with the same group address without establishing a connection between the sending node and the target nodes. This one-to-many transmission mode greatly reduces the time for message transmission, ensuring that the KNX system can communicate efficiently. If a node on the KNX bus needs to send a message to multiple self-addressed nodes with the same group address, it only needs to send the message to that group address and then receive acknowledgment signals from the target nodes.

However, the connectionless transmission mode also has its drawbacks - the KNX system cannot confirm that each target node has received the target message. The sending node only needs to receive one correct acknowledgment message (IACK) and no negative acknowledgment message (INAK) for the KNX system to consider the transmission successful. If one of the target nodes disconnects from the KNX bus, it cannot send either a correct acknowledgment signal or a negative acknowledgment signal, so the signal loss of this target node cannot be detected by the KNX system. Therefore, the connectionless transmission mode is suitable for applications where the reliability of KNX message transmission is not highly critical.

(2) Connection-Oriented Transmission Mode:

In this mode, both nodes need to establish a connection before communication and release the connection after transmission. The source node can determine the status of the destination node based on the returned acknowledgment signal, allowing it to detect message loss. This mode is particularly important for large-capacity message transmissions and important message transfers.

Connection-oriented and connectionless transmissions can be further divided into four different data transmission modes:

  1. Multicast: A point-to-multipoint connectionless communication mode that communicates through group addresses, achieving one-to-many scene control, allowing the system to communicate efficiently.

  2. Broadcast: A point-to-all connectionless communication mode that allows devices to communicate with all devices in the domain.

  3. Point-to-point connectionless communication: Communication between any two independent devices.

  4. Point-to-point connection-oriented communication: Reliable communication between any two devices within a connection.

The transport layer provides four different transport protocol data types:

  1. UDT, suitable for connectionless transmission.

  2. NDT, suitable for connection-oriented transmission.

  3. UCD, used to establish and terminate a point-to-point transmission.

  4. NCD, used for acknowledgment of connection-oriented data frames.

6c6967f3c6b0cf2d.png

3.5 Application Layer
The application layer is the highest layer of the KNX protocol, primarily performing two functions: the first is to provide an interface for application programs and system programs while defining some application services; the second function is to manage the communication objects of bus devices, handling their communication transmission and data, and completing specific user functionality.

The smallest signal unit generated by the AL is called the Application Layer Service Unit (APDU). The length of the APDU is 4 bits/10 bits, essentially encoding and decoding the TPDU (TSDU) and APCI (Application Layer Protocol Control Information) of the TL. The message structure between the application layer AL and the transport layer TL is shown below:

3d45bcdb8297cbdb.png

The detailed message format is as follows:

c6363cce7f06c3f7.png

Parts that each protocol layer needs to consider:

Data Link Layer: Control field (Field 0), Source address (Fields 1 and 2), Destination address (Fields 3 and 4), Destination address type (Field 5, 8th bit), Message length statistics (Field 5, bits 1-4), and Checksum byte (Field 22).

Network Layer: Routing count (Field 5, bits 5-7).

Transport Layer: Determines the transmission mode (TPCI, Field 6, bits 3-8).

Application Layer: Application Layer Protocol Control Information (APCI, Field 6, bits 1-2 and Field 7, bits 7-8; some applications may also need to include bits 1-6 of Field 7), Application Layer Data (Fields 7 to Field n, n<22).

KNX message assembly and disassembly process:
6de527c0da5e6f29.png

4. KNX Communication Methods#

4.1 Physical Address and Group Address
To achieve communication under the KNX protocol, each node on the KNX bus has two addresses: one is the physical address (Physical Address, PA), and the other is the group address (Group Address, GA).

The physical address is the identity card of each bus node device, corresponding to the device's topological position on the KNX bus, composed of domain, line, and device number. The physical address is assigned during device installation programming and is used to download application programs, group addresses, and maintenance work for bus devices. The composition of the physical address is shown below:

527a396cba53041f.png

The group address plays an extremely important role in the KNX communication mechanism, as the mutual communication between KNX nodes is primarily achieved through group addresses rather than physical addresses. Group addresses simplify the communication method between buses, making one-to-many, many-to-one, and scene control in building automation exceptionally convenient. Group addresses occupy 2 bytes, with the first bit being 0 and the remaining 15 bits being valid addresses. Group addresses can be represented in two decimal formats: two-segment and three-segment, as shown in Figure 2-7. The two-segment format is M/s, and the three-segment format is M/m/s. The different representation methods only indicate that the KNX bus node has different functional concepts in the KNX network, while their binary data remains unchanged. For example, 3/515 and 3/23 represent the same group address, both in binary as 0 0011 010 00000011.

5cfea2e2bc362347.png

It should be noted that the group address and physical address of a node are fundamentally different. The physical address describes the structure of the KNX system network topology, while the group address represents the logical division of the KNX bus node device in terms of functionality. For example, in the three-segment representation, the first segment indicates three functions: "air conditioning," "shading," and "dimming," the second segment can represent air conditioning devices, blinds, and lights on different floors, and the third segment indicates devices in different rooms on the same floor.

If a KNX bus device only performs a single function, it should only require one group address. However, if multiple functions are to be achieved, this bus device may require multiple different group addresses.

4.2 Communication Objects and Communication Object Table
Communication Objects are the main communication entities in KNX network communication. A KNX bus node device typically requires multiple communication objects to work together to complete a certain function. For example, an eight-channel switch output node device requires at least 8 switch communication objects to perform the switch output operation, and each switch output can also have a switch status communication object to reflect the current output status of that channel.

To better manage these communication objects, a Communication Object Table is defined, which contains information about all communication objects in the node device, created by the user in EEPROM. The structure and internal data meaning of the communication object table are shown in the figure below. As seen in the figure, the table stores the number of communication objects in the node device (Object Count), the pointer to the RAM Flag table (RAM Flag Table Pointer), and the description of all communication objects (Object Descriptor). The description of communication objects contains three bytes: (1) The Data Pointer byte is a pointer pointing to an address in RAM or EEPROM, which is used to temporarily store communication object values during program execution; (2) The Config Byte is used to configure the communication object and set its specific communication method; (3) The Type Byte represents the data type of the communication object value.

3bc9ed0e16a5527a.png

During the process of sending and receiving messages by KNX nodes, each communication object has some state attributes that are temporary variables stored in the RAM Flag Table (RAM Flag Table). The RAM Flag Table serves as a bridge for internal communication between the system program and the user program. In the RAM Flag Table, each communication object is described by 4 bits to indicate the status of the communication flags, including a 1-bit data update flag (Update Flag), a 1-bit data request flag (Data Request Flag), and a 2-bit communication status flag (Transmission Status). The figure below shows the role of the RAM Flag Table in the interaction process between the system program and the user program.

4f7ff65636bcf352.png

Receiving data update flag: Indicates to the user that data has been received.

Sending data request flag: Requests the relevant node to send data.

Communication status flag: Indicates to the user that data is being sent.

In the figure, the communication object values in the communication object table are updated by the system program, and the communication object values are transmitted from the sending node to all target nodes with the same group address through messages. The corresponding communication object values of all bus nodes that receive this message are updated. In the KNX system, a communication object can receive information through multiple group addresses but can only send through one single group address. Multiple communication objects in a node device can connect to the same group address. Thus, the update or reading of communication objects is closely related to group addresses, so the system program must find the correspondence between communication objects and group addresses. Therefore, the KNX protocol introduces two additional tables: the Association Table and the Address Table.

4.3 Address Table and Association Table
The Address Table contains information about all physical addresses and group addresses in the node device, with its structure shown in the figure. The first byte represents the sum of the physical address and all group addresses, the second and third bytes represent the physical address of the node device, followed by the information of each group address. Each address has a connection number (connection#), starting from 0, with the first group address's connection number being connection#1.

6fcc9d578d98502d.png

When the system program receives a message, it compares the group address in the message with the group addresses in the address table in order. If a matching group address is found or if the end of the address table is reached without finding a match, the comparison stops.

The Association Table describes the connection relationship between group addresses and communication objects, with its structure shown in the figure. The first byte represents the length of the connection table, followed by the contents of the connection table, with each connection containing two parts:

4c62e7376e32cf27.png

4.4 Relationship Between Address Table, Association Table, and Communication Object Table
The communication mechanism of the KNX bus is composed of communication objects and their related communication object table, address table, and association table. Both the address table and communication object table are linear tables of variable length. The connection number (Connection#) of the address table starts from 0, with Connection#0 representing the physical address of the node device, and the first group address corresponding to Connection#1; the communication object number (Communication Object#) in the communication object table starts from 1, with Communication Object#0 indicating the pointer to the RAM Flag table. In the association table, a communication object number and a connection number form an association, indicating that the updates and readings of that communication object value are completed through that group address. The figure below illustrates how the communication object table, address table, and association table are related.

34e998d54e67f2f5.png

The arrows between the tables indicate whether the communication object is sending or receiving. The figure shows the following relationships:

A sending communication object is only allowed to use one group address, such as communication objects Object0 and Object1.

A receiving communication object can connect to only one group address, such as communication object Object2.

A receiving communication object can connect to multiple group addresses, such as communication object Object3.

A group address can connect to multiple communication objects, such as group address '113'.

For example, in the figure, the bus device 1E01 is a sensor node with two buttons, corresponding to communication objects 0 and 1. The group address of Obj.0 is 1/16, and the group address of Obj.1 is 0/43. The other devices are all actuator nodes, with their physical addresses, communication objects, and group addresses detailed in the figure. It can be seen that the communication objects Obj.0 in device 1E01, Obj.0 in device 1CFE, and Obj.0 in device 1CFF are all connected to the same group address 1/16, which means that if 1E01 sends a message through 1/16, devices 1CFE and 1CFF will update the value of communication object Obj.0, thereby controlling the stopping or starting of the motor. Similarly, the communication objects Obj.1 in device 1E01, Obj.0 in device 11EF, and Obj.0 in device 11EE are all connected to the same group address 0/43, indicating that if 1E01 sends a message through 0/43, devices 11EF and 11EE will update the value of communication object Obj.0, thereby controlling the turning on or off of the light.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.