Lonworks protocol stack - PHY, link, network, transport, session, presentation, application layers
This Lonworks tutorial page covers Lonworks protocol stack basics.
The Lonworks protocol layers include physical layer, link layer, network layer, transport layer,
session layer, presentation layer and application layer.
Refer Lonworks basics➤➤.
The figure-1 below depicts the Lonworks protocol stack layers. Before we move into Lonworks specific protocol layers, I recommend reader to understand functions of OSI protocol stack layers.

Lonworks physical layer
The Lonworks protocol is media independent and works with binary signals. There are different transceivers used based on underlying physical layer such as twisted pair, power line, optical fiber, radio frequency, coaxial layer and infrared channel medium.
Most of the transceivers use different manchester encoding whre in each one ("1") is transmitted as a polarity reversal for full time period. Each zero ("0") is represented as two polarity reversals during a single full period.
Each physical link may be interconnected by means of a Lonworks router or extended by repeater device.
Lonworks protocol Link layer
Lonworks Link layer provides CRC based error checking. This helps in detecting most transmission errors.
It uses CSMA (Carrier Sense Multiple Access) algorithm called p-persistent CSMA. Lonworks device first checks whether the medium is idle before transmitting the frame. Moreover to reduce the probability of collisions, it will initiate transmission with probability p in the one of 1/p predefined slots.
Based on network load number of time slots are dynamically adjusted.
Lonworks network layer
The Lonworks network layer takes care of message delivery mechanisms. Here each Lonworks networking device is identified by unique node identifier of size 48 bit. It is referred as UID or Unique_Node_ID. UID does not change and first used when device is inserted into the Lonworks network.
After device joins the network, it has been assigned with logical network address. The Lonworks protocol defines domain ( 0, 1 , 3 or 6 bytes), subnet ( 8 bits), node (7 bits) subaddresses. Each Lonworks device is assigned unique nodeID in each of the subnet. Hence there will be 32385 devices per domain, i.e. (255 subnets X 127 nodes).
Here, devices of single domain or subnet can be on different channels and devices from multiple domains may co-exist on same channel.
The network layer header consists of field called "packet format". It specifies whether packet is transport packet or a session packet or authenticated packet or presentation packet.
Lonworks protocol stack-Transport layer
The Transport layer of Lonworks protocol stack provides end to end reliable connectivity.
The protocol offers 4 types of messaging service based on reliability and efficiency.
• Acknowledged
• Request/Response
• Repeated
• Unacknowledged
The Lonworks device can select any of the above mechanisms to carry its presentation layer messages. In order to have authentication 48 bit key need to be configured in the devices before transmitting or receiving the messages.
Lonworks Session layer
The Lonworks protocol's session layer will replace transport layer if "packet format" field in network layer header is set to value "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 application layer of Lonworks Protocol Stack defines data interpretation conventions. It uses messages which are transported as well as re-transmitted by lower layers.
This layer messages will begin with 1 byte message code which defines type of data contained within the message. This is followed by 0 to 277 bytes of data. Following table-1 mentions message type with message code used at 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) . Moreover the services are specified for device developers by LonMark International committee.