Application Examples

acd

Purpose

This example shows the acd (Address Conflict Detection) implementation for Ethernet/IP.

Configuration

The IP 192.168.1.12 is set by default

The acd for Ethernet/IP configuration is following:

Define

Value

Description

Define

Value

Description

EIP_ACD_PROBE_WAIT

200ms

initial random delay

EIP_ACD_PROBE_NUM

4

number of probe packets

EIP_ACD_PROBE_MIN

200ms

minimum delay until repeated probe

EIP_ACD_PROBE_MAX

200ms

maximum delay until repeated probe

EIP_ACD_ANNOUNCE_WAIT

200ms

delay before announcing

EIP_ACD_ANNOUNCE_NUM

2

number of Announcement packets

EIP_ACD_ANNOUNCE_INTERVAL

2000ms

time between Announcement packets

EIP_ACD_DEFEND_INTERVAL

2000ms

minimum interval between defensive ARPs

EIP_ACD_EIP_ARP_PARSING

GOAL_TRUE

extended parsing of ARP frames for EIP mode

EIP_ACD_KEEP_ANNOUNCED_IP

GOAL_FALSE

do not release an IP address on conflict if it has been successfully announced

Usage Hints

This example shows how to use acd.

Whether ACD is activated can be checked via the TCP / IP Interface Object - Instance Attributes 10 (SelectAcd). This should be on by default. For reasons of compatibility, the acd config variable must also be set in addition to the SelectAcd attribute.

goal_eipCfgAcdOn(GOAL_TRUE);

During / after the probe process of the IP address, goal_ipProbedCbis called and it is reported whether the probe process was successful (GOAL_ACD_CB_IP_PROBED) or not (GOAL_ACD_CB_IP_CONFLICT).

If a conflict occurs, information is given at which phase (GOAL_ACD_PROBE_IPV4_ADDRESS, GOAL_ACD_ONGOING_DETECTION, GOAL_ACD_SEMI_ACTIVE_PROBE) in the probe process the conflict occurred.

The IP address is only ready for use after the probe process has been successful.

If a conflict was detected, the conflict packet can be read out via TCP / IP Interface Object - Instance Attributes 11 (LastConflictDetected) after a reboot. A reboot is necessary because the device gives up its IP address in the event of a conflict.

 

cfg_demo

Purpose

This example shows how to use the configuration management.

Configuration

-

Usage Hints

This application changes the value of the CM-Var APPL_CM_VAR_UINT32 and reads it out.

 

chase_lights

Purpose

This is a simple LED chase lights application, which uses alternating ascending or descending LED order.

Configuration

Define

Value

Description

Define

Value

Description

GOAL_LEDS_NUM

8

number of LEDs

GOAL_LED_BLINK_TIME_MS

25

LED blinks every 25ms

Usage Hints

-

 

cli

Purpose

This application basically initializes the Command Line interface (CLI).

Configuration

The IP 192.168.0.100 is set by default

Usage Hints

see Chapter: Command line interface (CLI)

 

cli_udp

Purpose

This application tests the reception of cli commands via UDP packets.

Configuration

The IP 192.168.0.100 is set by default

Usage Hints

see Chapter: Command line interface (CLI)

 

dd

Purpose

This application demonstrates the integration of device detection.

Configuration

-

Usage Hints

see Chapter: Device Detection (DD)

 

dhcp

Purpose

This application demonstrates the reception of IP, netmask and gateway via DHCP.

Configuration

-

Usage Hints

-

 

dlr

Purpose

This module implements a basic application that tests the DLR stack without an EtherNet/IP stack. This sample sets up a ring Node that periodically prints its status. You can include this ring node into a DLR ring. However you can not use the CIP services to access this device.

Configuration

-

Usage Hints

-

 

dm

Purpose

This module provides an example on usage of the data mapper.

Configuration

-

Usage Hints

-

 

eth_stats

Purpose

This application polls all Ethernet statistics and shows changed statistics every second.

Configuration

-

Usage Hints

-

 

heap

Purpose

This module shows how to use the GOAL dynamic heap (allocate, copy, verify and free).

Configuration

-

Usage Hints

-

 

https

Purpose

This application runs a simple HTTPS server that hosts a demo HTML page. It can be accessed via web browser by browsing https:// followed by the IP address of the device. Additional it is possible not to use TLS, only by browsing the IP address. In this case another demo html page is shown.

Configuration

-

Usage Hints

-

iface_info

Purpose

This application polls the Ethernet interfaces for changes in link state, duplex and speed. If a change is detected, it waits the APPL_ETH_CHANGE_DELAY delay and checks again to avoid flicker.

Configuration

-

Usage Hints

-

igmp_snoop

Purpose

This example application basically initializes the board with GOAL running IGMP (Internet Group Management Protocol) snooping.

Configuration

-

Usage Hints

-

 

inst

Purpose

This module provides a simple application of goal instance handling.

Configuration

Define

Value

Description

Define

Value

Description

APPL_ID

0xffff

instances type id

Usage Hints

see Chapter: Generic GOAL instances

 

linked_list

Purpose

This module provides a simple application of linked lists.

Configuration

-

Usage Hints

Make sure the initial list pointer is set to NULL before using it with the GOAL_LL_* API.

 

LM (Message Logger)

Purpose

This application demonstrates the integration of LM (Message Logger) and example log messages.

Configuration

Define

Value

Description

Define

Value

Description

GOAL_LM_BUFFER_SIZE

512

buffer size of message logger

APPL_DELAY_MS

100

loop time

APPL_STR_LEN

32

length of log string

Usage Hints

-

 

mailbox_ac

Purpose

This module demonstrate the handling of GOAL its mailbox MA.

Configuration

Define

Value

Description

Define

Value

Description

APPL_TX_TIME

1 ms

cycle time for sending messages

APPL_LOG_TIME

5 s

cycle time for logging stats

APPL_FIRST_ID

0

start message

Usage Hints

-

 

mailbox_cc

Purpose

This module demonstrate the handling of GOAL its mailbox MA.

Configuration

Define

Value

Description

Define

Value

Description

APPL_TX_TIME

1 ms

cycle time for sending messages

APPL_LOG_TIME

5 s

cycle time for logging stats

APPL_FIRST_ID

0

start message

Usage Hints

-

 

mctc_ac

Purpose

This module provides a simple micro core to core application using GOAL. This application is used for AC and CC. The application handles cyclic data for the MCTC communication. They contain a local time stamp and an incremental transmission counter, which are transfer to the peer core. Meanwhile, the other core do the same.

Configuration

Define

Value

Description

Define

Value

Description

APPL_LOOP_TIMEOUT

1 s

application timeout

APPL_STATUS_TIMEOUT

5000 ms

application timeout of status log

Usage Hints

The content of received data is compared to the content of the next cyclic data, for determining the delay of communication.

see Micro Core to Core - User Manual

 

mctc_ac

Purpose

This module provides a simple micro core to core application using GOAL. This application is used for AC and CC. The application handles cyclic data for the MCTC communication. They contain a local time stamp and an incremental transmission counter, which are transfer to the peer core. Meanwhile, the other core do the same.

Configuration

Define

Value

Description

Define

Value

Description

APPL_LOOP_TIMEOUT

1 s

application timeout

APPL_STATUS_TIMEOUT

5000 ms

application timeout of status log

Usage Hints

The content of received data is compared to the content of the next cyclic data, for determining the delay of communication.

see Micro Core to Core - User Manual

mem_deny_delay

Purpose

This application shows how delay the memory allocation block after GOAL_STAGE_GOAL by getting a delay handle which must be later released.

Configuration

Define

Value

Description

Define

Value

Description

GOAL_APPL_MEM_SIZE

100

allocation size

Usage Hints

-

 

no_net

Purpose

Application template without Ethernet functionality.

Configuration

-

Usage Hints

-

 

rb

Purpose

This module provides a simple application of ring buffer usage.

Configuration

Define

Value

Description

Define

Value

Description

RB_SIZE

128

ring buffer size

Usage Hints

-

 

rpc_ac

Purpose

This module provides a simple RPC application using GOAL. The variable A and variable B is transmitted to the server for multiplication. The client receives the result as variable C and checks it.

Configuration

Define

Value

Description

Define

Value

Description

GOAL_RPC_FUNC_TEST

0

user function ID

GOAL_CTC_TX_TIME

5 s

cycle time for sending messages

VAR_A

0x0123

variable A

VAR_B

0x4567

variable B

VAR_C

VAR_A * VAR_B

result C

Usage Hints

-

 

rpc_cc

Purpose

This module provides a simple RPC application using GOAL. The variable A and variable B is transmitted to the server for multiplication. The client receives the result as variable C and checks it.

Configuration

Define

Value

Description

Define

Value

Description

GOAL_RPC_FUNC_TEST

0

user function ID

GOAL_CTC_TX_TIME

5 s

cycle time for sending messages

VAR_A

0x0123

variable A

VAR_B

0x4567

variable B

VAR_C

VAR_A * VAR_B

result C

Usage Hints

-

 

snmp

Purpose

This application demonstrates the initialization and basic usage of the Simple Network Management Protocol (SNMP) with GOAL.

Configuration

Define

Value

Description

Define

Value

Description

APPL_SNMP_ID

0

snmp ID

APPL_ADDR_IP

192.168.0.50

IP-Address

APPL_ADDR_NETMASK

255.255.255.0

netmask

APPL_ADDR_GATEWAY

0.0.0.0

gateway

APPL_ADDR_TRAPSINK

192.168.150.33

trapsink

Usage Hints

-

 

spi

Purpose

This module provides a simple SPI test for both master and slave. The SPI mode (master/slave) is auto detected by values stored in the SPI MA.

Configuration

Define

Value

Description

Define

Value

Description

GOAL_APPL_SPI_CHANNEL

0

spi channel

GOAL_APPL_SPI_MSG_SIZE

128

message size

GOAL_APPL_TIMER_DELAY

2 s

time delay

GOAL_APPL_SPI_MSG_SLAVE_OFFSET_MAX

10

slave offset

Usage Hints

The master cyclically sends out data generated by a deterministic function based on the last data sent. The slaves mirrors the data as soon as possible. The deterministic function should be bijective - that means to each argument there is exactly one image and vice versa. Both sides check received data for correctness. The slave directly checks if the alogorthm applied to last master data received leads to current received data. The master checks if the algorithm aplied to received data (zero, one or more times) leads to last sent data. In this case the number of algorithm calls corresponds to the number of SPI frames between master message and slave answer.

 

task

Purpose

This application shows how to set up and use tasks.

Configuration

Define

Value

Description

Define

Value

Description

GOAL_APPL_MAIN_LOOP_TIMER_PERIOD

5 s

timer period

GOAL_APPL_TASK_LOOP_SLEEP_DURATION

5 s

sleep duration

Usage Hints

-

 

task_lock

Purpose

This application shows how to set up and use the locking mechanismn with two tasks.

Configuration

Define

Value

Description

Define

Value

Description

APPL_TASK_ONE_SLEEP

1 s

first task sleep time

APPL_TASK_TWO_SLEEP

1.5 s

second task sleep time

APPL_TASK_PRIO_HIGH

GOAL_TASK_PRIO_HIGHEST

high priority

APPL_TASK_PRIO_LOW

GOAL_TASK_PRIO_LOWEST

low priority

Usage Hints

-

 

tcp_client

Purpose

This application demonstrates the connection of a TCP client to a TCP server. After establishing a connection to given server a fixed number of test TCP frames will be sent. Then the client will close the connection.

Configuration

Define

Value

Description

Define

Value

Description

MAIN_APPL_TCP_PORT

1234

tcp port

MAIN_APPL_IP

192.168.0.100

IP address

MAIN_APPL_IP_REMOTE

192.168.0.10

remote ip address

MAIN_APPL_NM

255.255.255.0

netmask

MAIN_APPL_GW

0.0.0.0

gateway

GOAL_APPL_RECON_TIME

1 s

reconnection time

GOAL_APPL_SEND_INT

1 s

interval between two sending actions

GOAL_APPL_SEND_CNT_CLOSE

5

number of sending actions before closing

GOAL_APPL_CNT_REPEAT

3

count of repeating this test

Usage Hints

The client waits until a server is found. If the TCP closed the channel (e.g. by timeout) the client tries to reopen it.

 

tcp_server

Purpose

This application demonstrates a simple TCP Echo Server.

Configuration

Define

Value

Description

Define

Value

Description

MAIN_APPL_TCP_PORT

1234

tcp port

MAIN_APPL_IP

192.168.0.10

IP address

MAIN_APPL_NM

255.255.255.0

netmask

MAIN_APPL_GW

0.0.0.0

gateway

Usage Hints

-

 

template

Purpose

This module provides a simple application template using GOAL.

Configuration

-

Usage Hints

-

tls

Purpose

This application runs a simple HTTP server that hosts a demo HTML page. It can be accessed via web browser by browsing the IP address of this device. It is possible to use TLS/ HTTPS.

Configuration

Define

Value

Description

Define

Value

Description

APPL_ADDR_IP

192.168.0.10

IP address

APPL_ADDR_NETMASK

255.255.255.0

netmask

APPL_ADDR_GATEWAY

0.0.0.0

gateway

APPL_TCP_PORT

443

tcp port

HTTP_RESPONSE

"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n" \ "<h2>mbed TLS Test Server</h2>\r\n" \ "<p>Successful connection with TLS</p>\r\n"

http response

DEBUG_LEVEL

0

debug level

MAIN_APPL_TLS_CHAN_CNT

1

tls channel count

Usage Hints

-

 

udp_jumbo_frames

Purpose

This application demonstrates the activation and handling of the jumbo frame feature if supported by the hardware. This application is based on the udp_receive demo.

Configuration

Define

Value

Description

Define

Value

Description

MAIN_APPL_UDP_PORT

1234

udp port

MAIN_APPL_IP

192.168.0.10

IP address

MAIN_APPL_NM

255.255.255.0

netmask

MAIN_APPL_GW

0.0.0.0

gateway

Usage Hints

-

 

udp_receive

Purpose

This application demonstrates the reception of UDP packets.

Configuration

Define

Value

Description

Define

Value

Description

MAIN_APPL_UDP_PORT

1234

udp port

MAIN_APPL_IP

192.168.0.10

IP address

MAIN_APPL_NM

255.255.255.0

netmask

MAIN_APPL_GW

0.0.0.0

gateway

Usage Hints

-

Â