An Introduction to
DeviceNet™
DeviceNet Unplugged – A View Under the Hood for End Users
This technology page presents an operational description of DeviceNet, a low-level industrial application layer protocol for industrial automation applications. DeviceNet connects simple industrial devices (sensors and actuators) with higher-level devices such as programmable controllers. Built on the standard Controller Area Network (CAN) physical communications standard, DeviceNet uses CAN hardware to define an application layer protocol that structures the task of configuring, accessing and controlling industrial automation devices.
This page is intended for the DeviceNet user who desires a deeper understanding of DeviceNet. It’s intended to provide much more information than is typically found in a network overview but much less than the several hundred-page DeviceNet Specification (The Specification). This can also provide a starting point for developers considering adding DeviceNet communications to their product.
Note that an abstract of a 200+ page specification is by definition incomplete. Some aspects of the technology are admittedly only lightly covered while others are not covered at all. Topics judged to provide the most insight into DeviceNet operation or clear up common misconceptions received priority.
Featured DeviceNet Gateways
DeviceNet resources
Want to learn more about DeviceNet?
Subscribe to our Automation Education email series to learn the ins and outs of DeviceNet and the top industrial protocols in a byte-size weekly format!
DeviceNet Blogs
DeviceNet Training
View the courses offered through Industrial Networking University:
- Basics of DeviceNet Course – This course will cover the basics of DeviceNet, once completed you will have a basic understaing of how DeviceNet works.
- Advanced DeviceNet Course – In this course, we will expand on those basics and discuss the specific requirements of a DeviceNet network.
A Quick Overview
DeviceNet is an application layer protocol. What does that mean? One way to look at it is that the term “application layer” implies that DeviceNet deals more with application data than a lower level or non-application layer protocol. For example, a link layer protocol is designed simply to move some bytes from point A to point B. It has no interest and conveys no inherent information regarding the contents of the message. Because it is an application layer protocol, its messages do convey information. A DeviceNet-explicit message has specific information in specific bytes of a message. There is a byte for a class number, a byte for a service code and so on.
Now, if DeviceNet is an application layer protocol, what are the lower protocol layers that transport its messages? That’s the content of the next section.
DeviceNet and CAN
CAN is a communications standard with a rather prolific set of offspring that includes DeviceNet, Can Open, Can Kingdom and several hundred other iterations all over the world.
CAN is a serial communications standard for intelligent devices to communicate with each other. Unlike many other communication standards that provide fast data rates with thousands or millions of data bytes in a single frame, CAN has a bit rate that max’s out at 1 mega baud. Most industrial applications don’t even need that speed. Most use the lowly 125Kbaud. And where other standards move thousands of bytes in a single frame CAN only moves 8 bytes of data.
But where speed and capacity are strengths for many of the other standards, CAN’s strength is its low overhead and simple physical interface. With its small packet size, even at 500Kbaud a frame with eight bytes of data, it’s only on the network wire for a quarter of a millisecond. For many control applications this is plenty fast.
Additionally, the microcontroller, yes, an underpowered 8-bit micro, can get the job done. It needs as little as 4K of program memory and 256 bytes of RAM to support a CAN application.
CAN was created by Bosch in Germany in March of 1985. The Bosch Company designed it to replace automotive wiring. In the early days of specification version 1.2, CAN messages contained an eleven-bit identifier providing the capability to address 2047 identifiers. In 1992, CAN Specification 2.0 extended the identifier size to 29 bits providing up to 56 million unique identifiers. As both specifications are still in use (sometimes on the same wire) the original 1.2 specification is called Part A and the new specification 2.0 is termed Part B. A unique attribute of CAN is that only two of the OSI Reference Model layers are defined (see Figure 1): the data link layer and the physical layer. The CAN data link layer is normally split into two sub-layers: the physical signaling sub-layer and the media access control (MAC) sub-layer.
Allen-Bradley (now Rockwell Automation) created DeviceNet as an application layer protocol on top of CAN in the 1990s. A-B selected CAN as the DeviceNet Physical Layer for a number of reasons including.
- An extremely robust physical layer
- Open Technology
- Small processor footprint (RAM, ROM Requirements)
- Inexpensive physical components with multiple sources
One of the most extraordinary features of CAN (and DeviceNet) is bitwise arbitration. Bitwise arbitration is the process that CAN uses to prioritize messages without losing any network bandwidth. On a CAN network, zero bits dominate one bits. As a device transmits a message, it listens to the bits on the network. If a device transmits a one and hears a zero, it knows that a higher priority message is being transmitted and it discontinues transmitting. The node with the higher priority message hears the bits it is transmitting and never knows it conflicted with a lower priority message. The message sequence on the network is preserved.
DeviceNet and CIP
The Communications and Information Protocol (CIP) is a communications protocol for transferring automation data between two devices. DeviceNet is a combination of the CIP protocol and the CAN Physical Layer. In CIP, every network device represents itself as a series of objects. Each object is simply a grouping of the related data values in a device. For example, every CIP device is required to make an identity object available to the network. The identity object contains related identity data values called attributes. Attributes for the identity object include the vendor ID, date of manufacture, device serial number and other identity data. CIP does not specify at all how this object data is implemented, only what data values, usually called attributes, must be supported and that these attributes must be available to other CIP devices. The identity object is an example of a required object. There are several types of objects defined by the CIP protocol.
REQUIRED OBJECTS
Required objects are required by The Specification to be included in every CIP device. These objects include the identity object, a message router object and a network object.
IDENTITY OBJECT
The identity object contains attributes that identity the DeviceNet device. Attributes for the identity object include the vendor ID, date of manufacturer, device serial number and other identity data.
MESSAGE ROUTER OBJECT
The message router is an object that exists to route explicit messages and explicit responses to and from the connection object (see below). For example, an explicit message request is received by the connection object and passed to the router object. The Router opens the DeviceNet/CIP package and identifies the target object. The message is passed to the target object for processing. The response from the target object follows the identical course in reverse. Remember that this is only the external operating behavior of the message router object. The implementation of this object can and does follow a much more concise and efficient mechanism.
DEVICENET OBJECT
The object contains attributes that identify the port, baud rate, MAC ID (DeviceNet Address), vendor ID and other physical operating parameters.
CONNECTION OBJECT
The connection object contains the attributes that control the processing of explicit and I/O messages. Most importantly, the attributes for the I/O path and connection type control how often the devices produces data and the path where the connection object finds the data to produce.
Another required object is the message router object. There are several kinds of message router objects and The Specification describes them in excruciating detail.
APPLICATION OBJECTS
Application objects are the objects that define the data encapsulated by the device. These objects are specific to the device type and function. For example, a motor object on a drive system has attributes describing the frequency, current rating and motor size. An analog input object on an I/O device has attributes that define the type, resolution and current value for the analog input.
These application layer objects are predefined for a lot of common device types. All CIP devices with the same device type (drive systems, motion control, valve transducer, etc.) must contain the identical series of application objects. The series of application objects for a particular device type is known as the device profile. A large number of profiles for many device types have been defined. Supporting a device profile allows a user to easily understand and switch from a vendor of one device type to another vendor with that same device type.
A device vendor can also group application layer objects into assembly objects. These super objects contain attributes of one or more application layer objects. Assembly objects form a convenient package for transporting data between devices. For example, a vendor of a temperature controller with two temperature loops may define assemblies for each of the temperature loops and an assembly with data from both temperature loops. The user can than pick the assembly that is most suited for the application and how often to access each assembly. For example, you can configure one temperature assembly to report every time it changes state and configure the second to report every one-second regardless of a change of state.
Assemblies are usually predefined by the vendor but CIP also defines a mechanism in which the user can dynamically create an assembly from application layer object attributes. Dynamic assemblies are rather rare, as most end users wouldn’t want to bother defining their own assemblies.
VENDOR SPECIFIC OBJECTS
Objects not found in the profile for a device class are termed vendor specific. The vendor includes these objects as additional features of the device. CIP provides access to these vendor extension objects in exactly the same method as either application or required objects. This data is strictly of the vendor’s choosing and is organized in whatever method makes sense to the device vendor.
In addition to specifying how device data is represented to the network, CIP specifies several different ways in which that data can be accessed, such as cyclic, polled and change-of-state.
Connections and Connection IDs
DeviceNet is a connection-based network similar to Ethernet TCP/IP. When two devices establish a connection, they exchange connection ID numbers. For most DeviceNet messaging (between a master device and a slave device), the connection IDs are predefined enabling low resource devices to optimize processing of these messages. Using the filters provided in a lot of CAN controllers, these messages are easily identified and processed while all other messages are quickly discarded.
For all but a few types of connections, two connection IDs are allocated. One, the produced connection ID is allocated for the message transmitted by the device. The second is the consumed connection ID, the connection ID used in the message consumed by the device.
The connection IDs are an integral part of DeviceNet messaging and are a part of the message prioritization scheme. The CAN identifier in every message is composed in part of the address and the connection ID for the message. The lower the connection ID/DeviceNet address combination the higher the priority of the message on the network. In some networks with certain types of messaging schemes using lower Mac ID addresses for higher priority devices is a valid optimization strategy.
Unconnected Message Connections
Every DeviceNet device contains a special virtual access port called the unconnected message port. This virtual port provides a way for a device to send a few predefined messages to a device without first making a connection. The predefined messages are limited to creating and deleting other connections.
The unconnected message port is part of the Group 2 connection set, the set of connections used by DeviceNet slave devices. This connection is designed for very unsophisticated, low-resource devices. In fact, this connection set is exactly how a master allocates a slave, by sending messages on the Group 2 unconnected message port.
More sophisticated devices also implement the unconnected message port. For these devices, this port can be used to create explicit connections on connection group 1 or group 3, connection groups that are used to transfer explicit message requests.
Connected Message Connections
Connected messages are messages produced and consumed across a connection between two devices. They can be either explicit response/request type messages or I/O messages containing formatted data. Connected messages can also be messages transferred at some specific data rate (cyclic messages), on response to a poll (poll response messages) or on a change of state message. The data may be public, predefined assemblies of data or proprietary data specific to a particular vendor (proprietary peer message). The fact that two devices are connected does not imply anything about the data being transferred over the connection.
The Master/Slave Connected Messaging
DeviceNet devices can be classified as master or slave devices. Master devices gather Input data from multiple slave devices and distribute output data to the slave devices. These devices are also referred to as scanners and client devices while slaves can be referred to as servers. Master and slave devices use a set of connections and message sequences that are termed the master/slave connection set. This set of connections and messages provides a convenient way for master device to allocate, configure and transfer I/O data to an unsophisticated slave.
The predefined master/slave connection set is described in great detail later.
I/O Connection Messaging
I/O connections are connections that distribute output data to slaves and gather input data from slaves. The direction of data transfer is always discussed in terms of the DeviceNet network. Data that is moved from the network into a device is output data. Data that is moved from a device to the DeviceNet network is input data.
I/O connections for the predefined master/slave connection set are discussed in detail later.
Offline Connection Messaging
DeviceNet now includes a connection set for devices in the communication faulted state. A DeviceNet device is communication faulted if on power up it detects another device with the same MAC ID (DeviceNet Address). A device in the communication faulted state is unable to transfer any data or perform any application operations until the fault is cleared. The fault is typically cleared by manually re-addressing the network so that no devices exist with duplicate addresses.
If many devices have the identical address, manually re-addressing the network is very time-consuming and difficult. Either the switches on the device must be changed individually and manually or all devices must be removed from the network. Once all devices are removed each software-addressable device can be added to the network and re-addressed one at a time by a configuration tool.
This time-consuming and tedious procedure is what the offline connection set messaging is designed to address. Using the offline connection set a configuration tool can connect to a communication faulted device, change its address and then reset it. Since many communication faulted devices may be sharing an address, the configuration tool uses the vendor serial number to identify a specific device on the network. By flashing the LEDs of that device in a specific pattern, the tool can identify the faulted device to the user who then can assign an address to that device.
Unfortunately, only a minority of devices support the offline connection set.
DeviceNet Messaging
There are three kinds of messages that can be transmitted between DeviceNet nodes. Peer messages are unformatted messages between any two nodes. Explicit messages are request/response type messages from a DeviceNet master to a DeviceNet slave that get or set an attribute in a DeviceNet object. I/O messages are messages that transfer predefined I/O data between a master and a slave.
Peer Messaging
Peer messaging in DeviceNet is a widely misunderstood concept. Though it is supported, there is no practical way for devices manufactured by different vendors to communicate over peer communication channels.
Peer messaging is simply the exchange of messages from one DeviceNet device to another over any non-master slave connection. If two devices both support unconnected messaging and one of the devices can issue an unconnected message a peer communication channel can be created between the two devices.
Unfortunately, creating the peer communication channel does not imply that the two devices can exchange meaningful data. Unlike the Group 2 only communication set (master/slave), there is no well-defined rule or organization for the data exchanged on peer communication channel. If a DeviceNet temperature controller sends a temperature over a peer connection to a display, there is no way for the display to decipher the data. The temperature may be in Celsius or Fahrenheit. It may be 16-bits or 32-bits, scaled or un-scaled. Unlike an I/O message between a master and a slave, there is no implied structure or meaning to the bytes sent on a peer communication channel.
Most implementations of peer communications are used by devices manufactured by the same vendor. The vendor defines the format and contents of the message so that each device can understand the contents of the message. Barcode vendors sometimes use peer messaging to create what is called a “poor man’s universal scanner.” Using two or more scanners situated all around a target the barcode device which reads the barcode sends a message to the other scanners indicating that it has the barcode and that they can discontinue scanning.
Explicit Messaging
Explicit messages are request/response messages that are issued by a master to request a service from a slave over an explicit message connection. The service code field in the explicit message identifies the requested service with the remainder of the message containing any data required to execute the service. The GET_ATTRIBUTE service code is a typical request carried in an explicit message. GET_ATTRIBUTE returns the value of an attribute to the device issuing the explicit message. Explicit messages are used by all devices including configuration tools.
I/O Messaging
I/O messages transfer predefined I/O data between a DeviceNet master and an I/O device. Traditionally inputs and outputs are referenced from the point of view of the network. An input is a data point produced by an I/O device and transferred to a scanner over the network. An output is a data point consumed by an I/O device and transferred from a scanner to a device over the DeviceNet network.
I/O data is contained in a device in one or more device assemblies. The input assembly object identifies the data produced by the device. Attribute three of each input asembly object is the attribute containing the data to produce. Attribute three is usually a collection of data from one or more application objects. Figure 2 is an example of the assemblies that you might find in a simple flow meter.
Output assembly objects identify data consumed by the device. Attribute three of each output assembly identifies the specific data consumed by the device and is usually a collection of data consumed by the device. The data consumed is destined for one or more application objects as it is received.
A device can have multiple input and output assemblies. For example, a barcode reader device may have some set of discrete inputs and outputs. The assembly objects for the barcode device may include an assembly with only barcode data, an assembly with just I/O data or an assembly that contains both barcode and I/O data. This provides the ultimate flexibility for the end user. An end user that doesn’t use the I/O on the barcode reader selects the first assembly. A user who is using the barcode reader as a discrete I/O device might select the second assembly while the user using both may select the last assembly.
Figure 2 shows a device with more than one assembly. In this example, the user can choose from two assemblies for a simple flow meter. Assembly #1 contains the flow and temperature while Assembly #2 contains the discrete I/O data.
In these cases, the I/O connection must be configured to reference an assembly other than the default assembly. In the connection object, there are a minimum of two connection instances. One instance is for the explicit connection and one instance for the I/O connection. The explicit connection describes how the explicit messages are transferred. The I/O connection descries how messaging is managed.
The connection path attribute in the I/O connection is the assembly object containing the data to consume and produce. There are a number of different ways to specify the connection path most of which require more explanation than can be provided there.
To change the connection path, a user can use an explicit message to set this path directly, or in many cases, the vendor of the device provides a selector attribute in one of the application objects to more easily set the path. If a device only supports direct management of the connection path attribute the user may have to consult the device documentation or the DeviceNet specification to correctly specify the path.
I/O messages come in a number of flavors.
- POLLED – Polled messages are request/reply messages issued to the polled connection and sent by the scanner at the rate of its choosing.
- CYCLIC – Cyclic messaging is scheduled messaging. In this mode, the slave device periodically issues messages to the master at some scheduled rate.
- Change-Of-State (COS) – COS messages are produced on the I/O connection on an event. Additionally, a heartbeat message is also issued by the slave device. The heartbeat lets the scanner know that the slave device is still alive.
All messages transfer an I/O assembly between the master and the slave (sometimes called the scanner and the adapter, respectively). I/O messages also implement a fragmentation scheme for I/O data greater than the CAN Standard eight data bytes. Unlike the fragmentation protocol used for explicit messages, fragmentation for I/O messages is not acknowledged and not sequenced. The multiple messages are transmitted with no special encoding or sequence number. The receiver simply reconstructs the I/O data in the order that the messages are received.
DeviceNet Synopsis
GET and SET attribute service codes are the most common messages carried by explicit messages. Service code data associated with these messages includes the following.
- Object Class – This is the object dlass number of the object in the target device.
- Instance Number – This is the specific occurrence of the object class in the target device. For example, a device with 16 input points may be implemented with one input object with 16 instances, one for every input point.
- Attribute ID – This is the index to the specific value in the object being addressed by the Get or Set attribute service.
- Attribute Value (Set Only) – this is the new value for the attribute.
A Get service request to obtain the device serial number looks like this:
Connection ID | Service Code | Object Class | Instance | Attribute ID |
—–CID—– | OE Hex | 1 | 1 | 6 |
All explicit messages are routed through the explicit message router inside the device. The router validates the object class. If the explicit message contains an invalid class, the router rejects the message and returns an error code to the requester. If the router validates the object class it passes it to the target object for processing. The response from the target object is returned to the requester through the router. Note that this is only the network view of the device operation and may or may not be how the device is implemented.
One interesting application of explicit messages is that they can be used to read I/O data. An explicit message can be formed to get the attribute data containing the I/O data. The I/O data can be retrieved from either the source object generating the data or the assembly object containing the data ready to transfer to the master.
An explicit message connection may support a fragmentation mechanism for messages greater than eight bytes. Fragmented explicit messages contain only six bytes of data. Two header bytes to manage the fragmentation are added to every message. One header byte indicates the fragmented message position (first, last, middle) in the message sequence while the second byte contains a sequence number.
Unlike I/O message fragmentation, explicit messages must be acknowledged. The receiver (master or slave device) must transmit a message indicating acceptance of the fragmented message before the next message in the sequence is transmitted.
DeviceNet devices are not required to support explicit message fragmentation. In fact, most devices do not as explicit message fragmentation and the required acknowledgement handing requires a tremendous amount of device resources. A little known fact is that most DeviceNet device names (ASCII strings) are eight or fewer bytes in length to avoid support for explicit message fragmentation since longer product names would be transferred to the master as a fragmented message sequence.
Connection Establishment Messaging
There are only two requirements for successfully placing a new device on a network: the baud rate of the device much match the baud rate of all other devices on the network; and, the device address must not conflict with an address of another device.
BAUD RATE
The baud rate limits the length of the network. There are three baud rates for DeviceNet networks: 125K, 250K and 500K. Very simply, CAN networks require every device to listen to its own bits as they are transmitted and to set the acknowledge bit in each and every message transmitted on the network. The implementation of this latter requirement dictates the maximum network length for each baud rate.
Date Rate | Trunk Length |
125K | 500 Meters (1640 feet) |
250K | 250 Meters (820 feet) |
500K | 100 Meters (328 feet) |
Identifying the current baud rate of a device can be a challenge. Unless a device is configured using dipswitches and the baud rate can be discerned from the switches, there is no way to know what the baud rate might be. One of the reasons that a device may not connect is a baud rate that is different than the network baud rate. If you don’t know the baud rate of a device, the only sure method to find it is to try to connect to it at each baud rate.
DeviceNet Address
An integer address is assigned to every DeviceNet device on a network. This integer is the device address, the same as a MAC ID. There are a maximum of 64 nodes on a DeviceNet network. These nodes occupy addresses 0 to 63 and can be set using switches or using a DeviceNet configuration tool. No two devices can occupy the same address.
As a device powers on, it sends out a message requesting access to the network. Part of this message is the unique device serial number. If more than one device from the same vendor claims the same vendor ID at power on and attempt to access the network at the identical instant the device with the lowest DeviceNet serial number is successful. All the other devices fault. This sequence is explained in more detail in the next section.
Duplicate MAC ID Sequence
The Specification requires that devices transitioning from the offline to the on-line state follow a very specific message sequence with specific timing. This sequence relies on the duplicate MAC ID request message. This message consists of the device’s vendor ID and serial number. The vendor ID is the integer ID assigned to the vendor by the ODVA while the serial number is a unique long integer assigned by the vendor. Since the vendor is required to assign a unique serial number to each device, no two DeviceNet devices anywhere on the planet can have the same vendor/sequence number combination. This ensures that no two duplicate MAC ID request messages can have the same contents. If two devices from the same vendor attempt access to the network at the same instant during the duplicate MAC ID sequence the device with the lowest vendor/sequence number combination will get access first.
The duplicate MAC ID sequence consists of sending two consecutive duplicate MAC ID request messages with a one-second delay between messages. During the delay, any online device with the same MAC ID must issue a duplicate MAC ID response message. If the device joining the network receives a duplicate MAC ID response message it transitions to the communication fault state. If no response is received after the second, one-second delay, the device can officially transition to the online state.
There are other more subtle requirements for devices. For example, if a device in the online state ever receives a duplicate MAC ID response message, it must immediately transition to the offline state. Receiving a duplicate MAC ID response indicates that there is another device on the network in the online state with the same MAC ID.
Miscellaneous Messages
A message that is directly opposite the duplicate MAC ID request message is the device shutdown message. This message broadcasts the fact that a device is transitioning from the online state to the offline or non-existent state. This is an optional message that can be used by a device to signal a fault condition, remote command or some other reason for taking itself off the network.
Another infrequently used message is the device heartbeat message. Devices that support COS operations use the device heartbeat message to communicate to the master that they are operational. If no COS message containing new data is produced for a set duration, the device produces the DHB message.
Error States
DeviceNet devices can assume any of the following states.
NON-EXISTENT | The device has shut down due to an internal error or some remote command. |
UNALLOCATED | The device has successfully joined the network but is not currently owned by a master device. The LED network status indicator for an unallocated device flashes green. |
TIMED OUT | Messages have failed to arrive on one or more connections with the master device. This is typically a recoverable error. The LED network status indicator on a device will typically flash green in this state. |
FAULTED | The device has detected an internal error or received a duplicate MAC ID response message. This is not a recoverable error. The LED network status indicator on a device will typically be solid red in this state. |
BUSOFF | In the BusOff state, the device has detected significant network errors and has removed itself from network operation. This is typically a hardware failure in the device circuitry. The LED network status will typically be solid red in this state. |
DeviceNet Device Types
There are three basic device type and a device can support any one or all of the device types simultaneously.
Master Devices (Scanners)
Master devices, are devices “own” slave devices. A master can own many or all the slave devices but a slave can only be owned by one master at a time.
A master device must first allocate a slave device to obtain ownership. The allocation process (described later) is a set of handshaking messages in which the master device requests control of the slave and then configures the slave to transfer a particular set of data at a data rate specified by the master. The typical set of messages that request ownership is known as the predefined master/slave connection set.
The allocation process is simply an open explicit request message issued on the unconnected message port requesting ownership of the slave device. If the slave accepts ownership it replies in the affirmative and creates the connections requested by the master device in the request message. Usually, the master requests both an explicit and an I/O connection.
A slave may deny the allocation request from the master device if they are already allocated to another master or if the master device requests an unsupported connection type. For example, if the master requests a cyclic connection and the slave only supports polled connections the allocation request is denied.
Once the slave accepts the connection request the master uses the explicit message connection to configure the I/O connection. Configuration includes setting the two most important attributes of the I/O connection: the expected packet rate and the produced and consumed connection paths. The expected packet rate is the rate at which the master expects to scan the slave device. If the master fails to scan at this rate, the slave device enters a timed out state and must be explicitly reactivated by the master device. The produced and consumed connection paths are the paths to the application objects where data is respectively generated or stored. Generally, these paths refer to one of the assemblies supported by the slave device.
Scanning can begin once the slave device is fully configured. During scanning, the master device produces and consumes slave data. The master produces data for the slave’s output assembly that is identified by the consumed connection path in the slave. The master consumes data generated from the slave’s input assembly that is identified by the produced connection path in the slave’s output assembly.
Slave Devices (Adapters)
Slave devices receive and transmit application specific data to and from a master device. Slave devices, by definition, implement the predefined master slave connection set described in the previous section.
Slave devices must support at least one or more of the following I/O Message transport types.
- POLLING – The master device transmits I/O data to the slave device at some rate. This rate must be greater than the rate specified by the expected packet rate when the connection was configured. The slave device responds to a polling message by producing the data in its input assembly.
- CYCLIC – The master device transmits I/O data to the slave device at some rate. This rate must be greater than the rate specified by the expected packet rate when the connection was configured. The slave device may or may not be configured to respond immediately. In a typical situation, the slave device produces its I/O data at a frequency configured by the master device.
- CHANGE-OF-STATE (COS) – The master device transmits I/O data to the slave device at some scan rate greater than specified in the expected packet rate. The slave device may or may not be configured to respond immediately. In the typical situation, the slave device produces its I/O data only when the application layer indicates data has changed or upon expiration of some transmission timer also known as a heartbeat timer.
A master device implicitly transmits its current operating mode with every I/O scan. If the master device (typically a programmable controller) is in a non-run mode the master produces an I/O message with zero data bytes, known as an IDLE mode message. The slave device can then implement whatever functionality is required of the device when its master is not in run mode. Messages received with at least a single byte of I/O data indicate to the slave device that the master is now in run mode. DeviceNet does not require a slave device to implement any specific behavior when a master device is in an IDLE mode.
Master devices such as configuration tools often allocate the predefined connection set of a slave device requesting only the explicit message request connection. These devices typically allocate the EM connection, get or set a particular attribute and then release the connection set. If these devices are currently allocated by another master device, the master owning the slave mimics the messages of an unconnected slave device but only accepts the explicit message connection. Messages for the owned slave are received by this master and sent to the slave. The response from the slave is received and relayed to the original requestor, just as if the original master device was communicating with the slave directly. In this fashion, a device, like a configuration tool, can get or set an attribute of a slave even if a master already owns it.
Master Allocation Sequence
A master makes a connection with a slave device using the following sequence.
- The master issues an unconnected open request message to the slave. A slave device that supports unconnected messages allocates an explicit message connection and answer the master’s message. The slave returns a connection ID and describes the kind of messaging the slave can support. These slaves then continue with Step 6 of the message connection sequence.
- If a slave fails to answer the unconnected message request within one second, the master issues a second unconnected open request message. Slaves that don’t support unconnected messaging will ignore the unconnected open request message.
- A slave may answer the second request, allocate an explicit message connection and return the connection ID to the master. These slaves then continue with Step 6 of the message connection sequence.
- If a slave device fails to answer both unconnected message requests, the master waits another second and issues a Group 2 only connection request. This message attempts an allocation of an explicit and/or IO connection using the Group 2 only port. This is a special port designed only to support simple allocation of slave devices.
- Slaves that fail to answer the Group 2 only connect request are marked as faulted. Some masters may retry the allocation sequence periodically but are under no requirements to do so.
- Using the explicit connection made in the previous step, the master uses the connection to configure the I/O connection. The master sets the I/O timeout, connection paths and other attributes required to operate the I/O connection.
- Once the I/O connection is complete some master will explicitly delete the explicit connection, as it is no longer needed.
Physical Media Issues
Indicators & Switches
DeviceNet devices are configured using external hardware or software configuration tools. External hardware can include rotary switches, thumbwheels, dipswitches and other fixed input devices. Software configuration tools access the internal configuration of the device over the DeviceNet network or other communication port. Generic tools that can configure any device use the DeviceNet network. Vendor specific tools that configure just the devices of that vendor may either use the DeviceNet network or some other communication port on a device.
Some end users prefer configuration using switches. Their philosophy holds that a device can be easily replaced if all it takes is to set switches and connect the replacement devices. Other end users prefer software configuration. These users view switches as a potential source of device failure.
Termination
DeviceNet requires termination resistors at each end of a trunk line. One 1/4-watt, 120-ohm resistor should be placed at each end of the trunk between the CAN-H and CAN-L signals. The Specification expressly recommends that these termination resistors not be included within a device.
Isolation
Isolation of devices is recommended for devices with connections to external power supplies.
Electronic Data Sheets (EDS)
DeviceNet vendors are required to provide some type of documentation specifying how their device is configured. The document may be a set of printed instructions or some electronic file. At a minimum, the vendor must provide instructions for any external switches and a list of class, instance and attribute values that control the configuration of the device. Some vendors create a configuration assembly containing the parameter data. This assembly provides a single attribute, a single point of reference where all device parameters can be read and written.
An electronic listing of the attributes that configure a device is usually provided by a vendor. These EDS files sometimes provide little to no information on the device, or they can be very lengthy and complex. The more extensive EDS files allow configuration tools to precisely configure the device using text identifiers for bit values and other very informative text strings.
Typical DeviceNet Devices
DeviceNet I/O Devices
Most devices are slave I/O devices. A DeviceNet I/O device transfers discrete or analog I/O points to a master. I/O devices come in all shapes and sizes from one or two points to many points. A lot of I/O devices are non-isolated and are powered from the network while others use isolated outputs.
DeviceNet Masters
Master devices are usually programmable controllers or personal computers. They allocated slaves and transfer data between the master and its slaves.
DeviceNet Gateways
DeviceNet gateways convert data from another protocol to DeviceNet. Modbus to DeviceNet gateways, for example, convert Modbus devices to DeviceNet devices. ASCII to DeviceNet gateways take ASCII data and convert it to Modbus. There are innumerable protocol converters for DeviceNet.
The difficult issue for a gateway is mapping data in the other protocol to the object structure of DeviceNet. For example, the Modbus protocol represents its data as a series of 16-bit integers while CIP represents data as attributes that are part of objects. A DeviceNet gateway must allow some method to convert the data in its native Modbus, ASCII or other format to the object-based structure of DeviceNet.
DeviceNet Master Stack
A master software stack is the software the implements the DeviceNet and CIP communication protocol. A master must be able to send messages over the physical CAN network. To do that it must know the particular register interface of a selected CAN controller. A device developer that wants to implement a master must create the interface between the master and the CAN controller selected by the hardware designer. Sometimes, as in the case of master, stacks provided by Real Time Automation, Inc., an interface file for a particular CAN controller, is delivered as part of the master stack.
To implement a master, the application controls the devices to allocate the number of data bytes to produce and consume and how often the slave devices are polled. For more information on implementing a DeviceNet master application, contact Real Time Automation, Inc.
DeviceNet Slave Stacks
A DeviceNet slave software stack is the software the implements the DeviceNet and CIP communication protocol. A slave must be able to receive an allocation message from a master, consume outputs generated by the master and produce inputs. To do that it must know the particular register interface of a selected CAN controller, just like the DeviceNet master stack. A device developer that wants to implement a slave must create the interface between the slave and the CAN controller selected by the hardware designer. Sometimes, as in the case of slave stacks provided by Real Time Automation, Inc., an interface file for a particular CAN controller is delivered as part of the slave stack.
To implement a DeviceNet slave the application controls the DeviceNet address, the number of data bytes to produce and consume and the object structure of the device. Implementing the object structure of the device in the slave is one of the most important parts of implementing a slave device. This structure is the one seen by the users of the device and must be implemented correctly to meet their needs.