Notes On LonWorks-1
Notes On LonWorks-1
Notes On LonWorks-1
Introduction
LON stands for Local Operation Network and LonWorks was developed by Echelon Corporation in 1988 as a networking
platform to support control applications. Originally known as LonTalk it was accepted by ANSI as the standard ANSI/CEA-
709.1-B. Ecehelon also had their power line and twisted pair signalling systems accepted as ANSI standards. In Europe
LonWorks became the standard EN 14908 and internationally, in 2008, the following standards were issued:
LonWorks is a peer-to-peer protocol and can run on twisted-pair, Ethernet or power wiring. A network configuration tool
such as LonMaker is used to configure the data exchange by binding the input of one device to an output of another
device. The Neuron chip is the silicon that contains all of the networking firmware and is made by different
manufacturers. The programming language used within the Neuron chip is Neuron C.
Structure
Neuron Chip
The whole LonWorks protocol stack (formerly LonTalk) is contained on the Neuron chip along with three CPUs, memory,
input/output circuitry, the firmware and the operating system. There are two forms of the Neuron chip:
3120 - has a fixed amount of RAM and EEPROM depending on the manufacturer and cannot be expanded. The
ROM contains the System Image consisting of the LonTalk protocol , the operating system and the I/O libraries
3150 - has all that the 3120 has, but in addition contains an external data and address bus to allow for
expandable RAM and EEPROM up to 64KB in total. The System Image must be stored in the first 16KB of
external memory.
As well as the System Image there is the Comm Image that has to be loaded into memory and this determines the
parameters for communication such as speed and media type. The Network Image has the logical address of the device
along with the destination device address and message type. The final image is the Application Image that contains the
custom algorithms.
Media Access Processor (MAC) - sends, receives and checks the message destination address and CRC.
Network Processor - routes packets, sets the destination address, detects duplications, performs
The 5-pin transceiver interface can be configured for Single-ended Manchester encoded (RS485), Differential
Manchester encoded (twisted-pair) or Special Purpose Mode (Power Line). Any number of Inputs and Outputs can be
added to the Neuron chip and will depend on the manufacturer and the application. The I/O firmware library allows the
Each Neuron chip has its own unique 48-bit Neuron ID and is used to identify specific devices in the same way that MAC
addresses are used in Ethernet. The Neuron ID cannot be changed so swapping devices becomes problematic if you use
the Neuron ID directly as a way of addressing devices. For this reason Logical Addresses are used at the Network Layer
Communications
Pri - Priority used with Predictive P-Persistent CSMA. A value of 0 is used for non-priority frames, and a value of 1
Path - A special purpose mode transceiver can be interfaced to two physical channels or to two physical bit
encodings on the same channel. A value of 0 is used for the primary channel and a value of 1 is used for the
alternate channel.
Delta Backlog - used to adjust the number of slots for randomising access. Receiving devices add this value to
o Version - Always 0
o Packet Format
0 - Transport Packet
1 - Session Packet
2 - Authenticated Packet
3 - Presentation Packet
o Address Format
0 - Subnet Broadcast
1 - Group
3 - Neuron ID
o Length
0 - 0 bytes
1 - 1 byte
2 - 3 bytes
3 - 6 bytes
o Address - 3 to 9 bytes
o Domain - 0, 1, 3 or 6 bytes
o Packet
CRC-16 - the CCITT standard CRC check which is X16 + X12 + X5 + 1. The polynomial is computed over the entire
An idle period is considered to be anything over 2 bit times and marks the end of a frame.
The LonWorks Protocol (formerly LonTalk) follows the OSI seven layer model for its structure.
Layer 1 - Physical - EIA/TIA 485, Power Line and Free Topology (FT).
Layer 2 - MAC - there were improvements on Ethernet's Carrier Sense Multiple Access (CSMA) algorithms
(see below). Also, Bi-phase Space Encoding (a variation of Differential Manchester Encoding is used so that
it matters not which way around the communication wires are terminated.
Layer 3 - Network - Each Neuron chip can be assigned two logical addresses and up to 15 Group IDs. The
addressing is hierarchical, beginning at the node's 8-bit Domain ID, followed next by the 8-bit Subnet ID and then
the 8-bit Node ID. A node can be a member of a number of multicast groups, again each group address, or
Group ID represented as a single byte. There can be up to 256 multicast groups in a domain and 255 subnets,
and each one can have a 127 nodes. A domain's address can be encoded either as zero in length, as a single
byte, as three bytes, or in order to ensure uniqueness, a six bytes. This addressing regime enables simple routing
of packets across links. The routing tables have an array of 256 bits deciding whether or not a message can pass
across the router to a given subnet. Members with the same Group ID can be anywhere within the Domain and
Layer 4 - Transport - message duplication and re-transmission is handled at this layer. Messages can use
Reliable Services (requiring an acknowledgement or response) for both unicast and multicast, or Unreliable
Services can be used. The total transaction time on the receiver end, the number of retries and the time between
Layer 5 - Session - management of requests and responses occurs here. A message response is saved
temporarily in case a retry is required thereby saving a message having to be re-created and re-transmitted.
Layer 6 - Presentation - data items are identified here and the semantics are created of how the data is passed
Layer 7 - Application - Network Variables are specific data types such as temperature in degrees Celsius plus
high and low limits. If a Network Variable Output on one device is Bound to a Network Variable Input on
another device, then a published change will be sent to each Subscriber of that value. Other features at the
CSMA
CSMA has been adopted and augmented to provide more efficient ways of allowing station access to the transmission
medium.
P-Persistent CSMA
P-Persistent CSMA provides access to the medium by way of slots. If there are 10 slots then the probability (P) of
accessing the medium is 0.1. The more slots that are created the more random the medium access is and therefore the
less chance there is of a collision. On an idle network there is still an average delay of accessing the medium which is
Non-Persistent CSMA
With Non-Persistent CSMA a station randomises when it accesses the medium which is useful when there is a burst of
congested. A number of randomizing slots can be assigned to specific stations just for their use. A station with this MAC
priority privilege may use the dedicated slot and avoid all link access contention.
When a station sends a message, the number of response packets the message will generate is placed in the Layer 2
header and is known as the Link Backlog Increment, the sender must keep track of responses so it knows when to stop
retransmitting. The nodes on the link receive the packets and look at the Layer 2 header to view the increment of the link
backlog. This backlog is used to adjust the number of slots they randomise for their own link access which goes up when
LonWorks protocol modifies the number of randomising slots based on the short term future. The protocol's MAC
algorithm for a peer-to-peer network has been shown to use link bandwidth up to 80 percent of its maximum with a
collision rate of less than 4 percent, this compares favourably with Ethernet's CSMA/CD where you can get 100%
collisions at 40% bandwidth utilisation (thereby temporarily shutting down the network). It is therefore efficient and
requires no knowledge of the number of stations on the link, and no collision detection hardware.
Network Variables
Network Variables are used to communicate between nodes and each has a direction, a type and a length. Each node will
have its own set of Network Variables that are created as part of the application programme within that node they can be
likened to 'virtual wires' that connect devices. Node links are only allowed between inputs and outputs of the same type
which are configured during the binding process. An output variable may send data to multiple input variables on the
network (multicast), or multiple output variables can send data to a single input variable or even between outputs and
The types of input and output variables are defined within a growing set of Standard Network Variable Types (SNVT)
called Snivets. The variable types most often correspond to physical measurements such as temperature, humidity,
pressure, levels etc. and the number type such as integer, floating point, binary etc. The master list of SNVTs can be
SNVT_temp - Temperature.
SNVT Index 39
Measurement Temperature
SNVT_elec_kwh_l - Temperature.
Units Kilowatt-hour
Invalid Value 0x7FFFFFFF (214,748,364.7)
Each network variable on a device has a unique network variable index. Network variable indexes are assigned in order,
starting with index 0. A network variable selector is an identifier that is used to match a network variable update message
with a network variable within the receiving application. Every device manages one or two tables that are used to match a
network variable selector with a network variable index. The first table implemented by all devices is the network variable
configuration table. The second table that may be implemented by a device is the network variable alias table. The device
uses these tables to translate the network variable index on the sending device to a network variable selector.
The network variable selector is a 14-bit identifier with a value between 0x0 and 3FFFx0. Selector values 3000x0 to
3FFFx0 are reserved for unbound network variables. Selector values 0x0 to 2FFFx0 are available for bound network
variables.
Messages
Messages systems are stored within the Network Image (for easy modification later) and the messages themselves are
UnAcked - Unacknowledged, meaning that the message is sent with no expectation of any acknowledgement
being returned.
UnAckedR - Unacknowledged Repeat, meaning that the message is sent a number of times according to a pre-
Acked - Acknowledged Service with Automatic Retries - this is the default mechanism whereby the receiving
device sends an Ack (Acknowledgement) back. If an Ack has not been received within a specified time period
then the message is resent for up to three times unless the system has been programmed differently, a Message
Although data encryption is not supported it is possible to implement authentication to check that a sender is authorised to
send a particular message. At installation, a 48-bit key is issued to the devices on a per domain basis. The following
5. The receiver also transforms the challenge using the 48-bit key and compares the two results
Messages exchanged between applications consist of a 1-byte Message Code followed by up to 227 bytes of data, unless
the message contains a network variable, in which case there will be between 1 and 31 bytes of data. The range of
User Application 00 - 2F 0 - 47
Standard Application 30 - 3E 48 - 62
Foreign Frame 40 - 4E 64 - 78
Network Diagnostic 50 - 5F 80 - 95