EtherNet/IP™ Adapter3.09.00
 
Loading...
Searching...
No Matches
EtherNet/IP Adapter Examples

Scope

Note
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Users of the EtherNet/IP stack library are expected to adjust the provided examples according to their application requirements. As such, the examples only represent a basis for user applications.

This section discusses example applications that are shipped as part of the EtherNet/IP Adapter SDK. The directory structures below describe the location of all libraries and example source files required to build EtherNet/IP Adapter examples applications for different profiles as specfied in Chaper 6 Device Profiles of THE CIP NETWORKS LIBRARY – Volume 1.

The example applications are build from a set of C source and header files the are common for all different device profiles and code files that contain the actual device profile specific functionality such as particular objects, instance, attributes, and assemblies.

This structure can be extended with further device profiles examples over the time.

It is also suggested that device manufacturers integrate their specific implementations into this structure, if possible.

Overview of EtherNet/IP Adapter Demo

Figure below, gives an Overview of the EhterNet/IP adapter Demo folder structure, details about device profiles are described in separate section.

Default Objects implemented by all examples

The tables below summarize the objects that are created in Stack and the instance attribute values that are applied from application (through EtherNet/IP Adapter APIs).

Identity Object (Class Code: 0x01)

Class attributes
Attribute ID Name Data Type Value
1 Revision UINT 2
Instance attributes
Attribute ID Name Data Type Value
1 Vendor ID UINT Default: 806 [0x0326]
2 Device Type UINT Default: depending on particular example
3 Product Code UINT Default: depending on particular example
4 Revision UDINT Default: depending on particular example
5 Status WORD
6 Serial Number UDINT
7 Product Name SHORT_STRING Default: depending on particular example
Note
The Get_Attribute_All service returns Attribute ID 1 to 22. For Attribute IDs 8 and above only default values are returned as they are currently not implemented.

Message Router Object (Class Code: 0x02)

Class attributes
Attribute ID Name Data Type Value
1 Revision UINT 1
Note
Instance Attributes of the Message Router Object are optional and not supported by the EtherNet/IP stack.

Connection Manager Object (Class Code: 0x06)

Class attributes
Attribute ID Name Data Type Value
1 Revision UINT 1
Note
Instance Attributes of the Connection Manager Object are optional and not externally accessible via EtherNet/IP stack Get or Set services. The EtherNet/IP stack implements revision 1 of the Connection Manager Object. Concurrent connections are currently not supported.

Time Sync Object (Class Code: 0x43)

Class attributes
Attribute ID Name Data Type Value
1 Revision UINT 4
Instance attributes
Attribute ID Name Data Type Value
1 PTPEnable BOOL
2 IsSynchronized BOOL
3 SystemTimeMicroseconds UTIME
4 SystemTimeNanoseconds STIME
5 OffsetFromMaster NTIME
6 MaxOffsetFromMaster ULINT
7 MeanPathDelayToMaster NTIME
8 GrandMasterClockInfo STRUCT
9 ParentClockInfo STRUCT
10 LocalClockInfo STRUCT
11 NumberOfPorts UINT
12 PortStateInfo STRUCT
13 PortEnableCfg STRUCT
14 PortLogAnnounceIntervalCfg STRUCT
15 PortLogSyncIntervalCfg STRUCT
16 Priority1 USINT
17 Priority2 USINT
18 DomainNumber USINT
19 ClockType WORD
20 ManufactureIdentity USINT[4]
21 ProductDescription STRUCT
22 RevisionData STRUCT
23 UserDescription STRUCT
24 PortProfileIdentityInfo STRUCT
25 PortPhysicalAddressInfo STRUCT
26 PortProtocolAddressInfo STRUCT
27 StepsRemoved UINT
28 SystemTimeAndOffset STRUCT
Note
Note that the Time Sync Object is only avaialble if EIP_TIME_SYNC=1 is defined in the list of predefined symbols of the main example project in Code Composer Studio (Properties → Build → Arm Compiler → Pedefined Symbols).

Device Level Ring (DLR) Object (Class Code: 0x47)

Class attributes
Attribute ID Name Data Type Value
1 Revision UINT 3
Instance attributes
Attribute ID Name Data Type Value
1 Network Topology USINT
2 Network Status USINT
10 Active Supervisor Address STRUCT
12 Capability Flags DWORD 0x82 (Beacon-based Ring Node, Flush_Table frame Capable)

QoS Object (Class Code: 0x48)

Class attributes
Attribute ID Name Data Type Value
1 Revision UINT 1
Instance attributes
Attribute ID Name Data Type Value
2 DSCP PTP Event USINT Default: 59 ('111011')
3 DSCP PTP General USINT Default: 47 ('101111')
4 DSCP Urgent USINT Default: 55 ('110111')
5 DSCP Scheduled USINT Default: 47 ('101111')
6 DSCP High USINT Default: 43 ('101011')
7 DSCP Low USINT Default: 31 ('011111')
8 DSCP Explicit USINT Default: 27 ('011011')

TCP/IP Interface Object (Class Code: 0xF5)

Class attributes
Attribute ID Name Data Type Value
1 Revision UINT 2
Instance attributes
Attribute ID Name Data Type Value
1 Status DWORD Default: BOOTP/DHCP/NVS
2 Configuration Capability DWORD Default: 0x00000095 (BOOTP Client, DHCP Client, Configuration Settable, ACD Capable)
3 Configuration Control DWORD Default: 0x00000000 (Configuration Method: Static IP)
4 Physical Link Object STRUCT
5 Interface Configuration STRUCT Default
IP Address: 192.168.1.10
Network Mask: 255.255.255.0
Gateway Address: 192.168.1.1
Name Server: 0.0.0.0
Name Server 2: 0.0.0.0
Domain Name:
6 Host Name STRING Default:
8 TTL Value USINT Default: 1
9 Mcast Config STRUCT Default
Num Mcast: 32
Mcast Start Addr: 239.192.2.32
10 SelectAcd BOOL Default: 1
11 LastConflictDetected STRUCT
12 EtherNet/IP QuickConnect BOOL Default: 0
13 Encapsulation Inactivity Timeout UINT Default: 120

Ethernet Link Object (Class Code: 0xF6)

Class attributes
Attribute ID Name Data Type Value
1 Revision UINT 4
2 Max Instance UINT 2
3 Number of Instances UINT 2
Instance attributes
Attribute ID Name Data Type Value
1 Interface Speed UDINT Default:
2 Interface Flags DWORD Default:
3 Physical Address USINT[6]
4 Interface Counters STRUCT
5 Media Counters STRUCT Allways 0
6 Interface Control STRUCT
7 Interface Type USINT Default: Twisted-pair
8 Interface State USINT Default:
9 Admin State USINT Default: enable
10 Interface Label SHORT_STRING Default: Port 1|2
11 Interface Capability STRUCT Default: Port 1|2

Device Profile Example Implementations

currently, there are two Examples provided, one is CIP Generic Device (Device Type 0x2B) and the second one is CIP General Purpose Discrete I/O Device (Device Type: 0x07) according to Volume 1 Chapter 6 of the CIP NETWORKS LIBRARY.

Generic Device (Device Type: 0x2B)

The Generic Device profile does not specify any instances of the Assembly Object or the type of application objects necessary for device operation. This portion of the device profile must be supplied by the product developer and in this example focuses on digital I/O functionality via an LED array available on the evaluation board. The Generic Device example does not cover CIP Sync functionality.

See Generic Device (Device Type: 0x2B) for details.

General Purpose Discrete I/O Device (Device Type: 0x07)

A General Purpose Discrete I/O device type interfaces to multiple discrete I/O device types that do not have network capabilities. Examples include sensors and actuators. The example provided with the EtherNet/IP adapter SDK implements Discrete Input Point Object (Class Code: 0x08), Discrete Output Point Object (Class Code: 0x09) and also Discrete Output Group (Class Code: 0x1E).
The configuration of assemblies is also handled through a simple API ( DIO_DEVICE_ASM_initInstance), although only a subset of all possible configuration is supported.

See General Purpose Discrete I/O Device (Device Type: 0x07) for details.

Web Server Task

The EtherNet/IP stack contains an example how to implement a small HTTP server application. The corresonding code can be found in the files web_server.c, web_server.h, and web_server_data.h. The HTML definitions for the page layout are contained in web_server_data.h.

The web server and the corresponding background task are enabled by setting CPU_LOAD_MONITOR == 1 (default: CPU_LOAD_MONITOR == 0) in the list of predefined symbols of the main example project in Code Composer Studio (Properties → Build → Arm Compiler → Pedefined Symbols).

To reach the example web page enter the IP address of the EtherNet/IP Adapter device (default: 192.168.1.10) into a web browser.

Simple CPU Load monitoring through UART

As a less CPU intensive alternative to the Web-Server, it is possible to show the CPU load via UART Terminal, to enable this feature, UART_CPU_LOAD_MONITOR=1 must be defined in the list of predefined symbols. (Properties → Build → Arm Compiler → Pedefined Symbols).

Note
At any given time, only one of the UART_CPU_LOAD_MONITOR or CPU_LOAD_MONITOR can be set to 1. Both feature cannot be activated at the same time.