Understanding the Lonworks Protocol Stack
Advertisement
This tutorial provides a basic understanding of the Lonworks protocol stack, covering its various layers.
The Lonworks protocol stack includes the following layers: physical, link, network, transport, session, presentation, and application.
Figure 1 illustrates the Lonworks protocol stack layers. Before diving into the specifics of Lonworks protocol layers, it’s recommended to understand the functions of the OSI protocol stack layers.
Figure 1: Lonworks protocol stack layers
Lonworks Physical Layer
The Lonworks protocol is media independent and operates with binary signals. Various transceivers are used depending on the underlying physical layer, such as:
- Twisted pair
- Power line
- Optical fiber
- Radio frequency
- Coaxial cable
- Infrared channel
Most transceivers use Manchester encoding, where a “1” is transmitted as a polarity reversal for the entire bit period. A “0” is represented by two polarity reversals within a single bit period. Physical links can be interconnected using a Lonworks router or extended by a repeater device.
Lonworks Link Layer
The Lonworks Link layer provides CRC-based error checking to detect most transmission errors. It utilizes a CSMA (Carrier Sense Multiple Access) algorithm called p-persistent CSMA.
Before transmitting a frame, a Lonworks device first checks if the medium is idle. To reduce the probability of collisions, it initiates transmission with a probability p in one of 1/p predefined slots. The number of time slots is dynamically adjusted based on the network load.
Lonworks Network Layer
The Lonworks network layer manages message delivery mechanisms. Each Lonworks networking device is identified by a unique 48-bit node identifier, referred to as UID or Unique_Node_ID. The UID remains constant and is initially used when the device joins the Lonworks network. After joining, the device is assigned a logical network address.
The Lonworks protocol defines domain (0, 1, 3, or 6 bytes), subnet (8 bits), and node (7 bits) subaddresses. Each Lonworks device is assigned a unique node ID within each subnet. This allows for 32385 devices per domain (255 subnets x 127 nodes). Devices within a single domain or subnet can be on different channels, and devices from multiple domains can coexist on the same channel.
The network layer header includes a “packet format” field, which specifies whether the packet is a transport packet, session packet, authenticated packet, or presentation packet.
Lonworks Transport Layer
The Transport layer of the Lonworks protocol stack provides end-to-end reliable connectivity. The protocol offers four types of messaging services based on reliability and efficiency:
- Acknowledged
- Request/Response
- Repeated
- Unacknowledged
A Lonworks device can select any of these mechanisms to carry its presentation layer messages. For authentication, a 48-bit key must be configured in the devices before transmitting or receiving messages.
Lonworks Session Layer
The Lonworks protocol’s session layer replaces the transport layer if the “packet format” field in the network layer header is set to “1”. This layer offers authentication as well as request/response service.
Session layer header = { Auth, Session packet format, transaction number, Enclosed packet }
Lonworks Presentation Layer
The presentation layer of the Lonworks Protocol Stack defines data interpretation conventions. It uses messages that are transported and re-transmitted by lower layers. These messages begin with a 1-byte message code that defines the type of data contained within the message, followed by 0 to 277 bytes of data.
Table 1 below lists message types along with their corresponding message codes used at the presentation layer.
Message Type | Message Code (1-byte) |
---|---|
User application message | 00 to 2F |
Standard application message | 30 to 3E |
Foreign Frame message | 40 to 4E |
Network Diagnostic message | 50 to 5F |
Network Management Message | 60 to 7F |
Network Variable Message | 80 to FF |
Lonworks Application Layer
The application layer services are defined and published by LonMark International (www.lonmark.org). These services are specified for device developers by the LonMark International committee.