Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The CC-Link IE TSN Master SDK is used to implement a Management Master station or a Control Master Station in a device. The SDK uses GOAL, port’s Industrial Communication Framework.

SDK directory structure

The SDK has the following directory structure.

Path

Description

appl/goal_ccl_ie_tsn/01_master

Sample application for communication with port’s Remote Station SDK

appl/goal_ccl_ie_tsn/03_master_ct

Sample application for Conformance Test

goal*

GOAL core, platform independent

plat

Platform specific files: architecture, board configuration, drivers

projects/goal_ccl_ie_tsn/01_master

Sample project for communication with port’s Remote Station SDK

projects/goal_ccl_ie_tsn/03_master_ct

Sample project for Conformance Test

protos/ccl_ie_tsn

CC-Link IE TSN protocol stack

protos/goal_ts

(g)PTP protocol stack

protos/acd

ACD protocol stack

protos/slmp

SLMP protocol stack

Table 1‑1: Directory structure of the Master SDK

Writing an Application for the Master SDK

Overview

An application for the Master SDK is a GOAL application. It consists of three functions that are called by GOAL: appl_init, appl_setup, appl_loop.

Additionally, the application can register a callback that is called by the CC-Link IE TSN Master stack to inform the application about events.

The function appl_init is used to register components in GOAL, e.g. the CC-Link IE TSN protocol stack.

The actual initialization of the application happens in appl_setup.

The application must include goal_includes.h and goal_ccl_ie_tsn_master.h.

 

Configuration of the CC-Link IE TSN protocol stack

The function appl_setup is called by GOAL during initialization. Within this function all functions listed in this chapter can be used to configure the bahavior of the Management Master. All Functions must be called before calling goal_cclIeTsnNew.

All functions return a status code indicating whether the operation succeeded or not.

Function

Description                                                                                     

goal_cclIeTsnCfgManagementPrioritySet

Set the Management Priority of this master station

goal_cclIeTsnCfgNumGmRecordEntriesSet

Set the maximum number of Grandmaster Record entries

goal_cclIeTsnCfgNumSlavesSet

Set the maximum number of Remote Stations handled by this station

goal_cclIeTsnCfgNumS2sSubpayloads

Set the maximum number of Subpayloads for direct communication between remote stations

goal_cclIeTsnCfgSlaveCheckIntervalSet

Set the check interval for pending Remote Stations during RUN phase

goal_cclIeTsnCfgNodeTypeSet

Set the node Type of this station (Management Master or Control Master)

goal_cclIeTsnCfgCertificationClassSet

Set the Certification Class of this station

goal_cclIeTsnCfgDeviceVersionSet

Set the Device Version of this station

goal_cclIeTsnCfgDeviceVendorCodeSet

Set the Device Vendor Code of this station

goal_cclIeTsnCfgDeviceProductIdSet

Set the Product Id of this station

goal_cclIeTsnCfgDeviceExModelCodeSet

Set the Device Expansion Model Code of this station

goal_cclIeTsnCfgDeviceTypeIdSet

Set the Device Type Id of this station

goal_cclIeTsnCfglogSyncIntSet

Set the default logarithmic Sync Tx interval

goal_cclIeTsnCfglogAnnounceIntSet

Set the default logarithmic Announce Tx interval

goal_cclIeTsnCfglogPDelayIntSet

Set the default logarithmic PDelay Tx interval

goal_cclIeTsnCfgPdelayResTimeSet

Set the time between Pdelay_Req and Pdelay_Resp_Follow_Up

goal_cclIeTsnCfgDelaySetTimeSet

Set the time between Peer delay calculation and port role adjustment

goal_cclIeTsnCfgAnounceRelayTimeSet

Set the time for relaying Announce frames from Remote Station port to Master ports

goal_cclIeTsnCfgNumTxSubpayloadEntrieSet

Set the number of allowed Tx Subpayload information entries. The number defines how many Transmit Subpayloads can be handled by this station.

goal_cclIeTsnCfgNumRxSubpayloadEntrieSet

Set the number of allowed Rx Subpayload information entries. The number defines how many Receive Subpayloads can be handled by this station.

goal_cclIeTsnCfgNumCycTxHandlersSet

Set the number of cyclic transmission handlers. The number defines how many cyclic connections can be established at the same time.

goal_cclIeTsnCfgNumCycRxHandlersSet

Set the number of cyclic reception handlers. The number defines how many cyclic connections can be established at the same time.

goal_cclIeTsnCfgNumSlmpServerHandlesSet

Define how many received SLMP requests can be processed in parallel

goal_cclIeTsnCfgNumSlmpClientHandlesSet

Defines how many SLMP requests can be sent in parallel.

goal_cclIeTsnCfgNumSlmpDivDataHandlesSet

Define how many fragmented SLMP messages can be received in parallel.

goal_cclIeTsnCfgClearOnHoldEnable

Defines whether imported cyclic data is cleared or held if the the sender's application is stopped.

goal_cclIeTsnCfgPtpPrio1Set

Overwrite the PTP prio1 value for this station.

goal_cclIeTsnCfgLinkSpeedEnforce

Enforce a link speed for all ports

Table 1‑2: Configuration Functions of the CC-Link IE TSN protocol stack

Creating a new instance of the CC-Link IE TSN protocol stack

After the stack has been configured the function goal_cclIeTsnNew must be invoked to create a new instance of the protocol stack. It is also used to register a callback handler for processing events from the stack. The callback handler will be explained in detail in a later chapter.

Code Block
languagec
    GOAL_STATUS_T res;                              /* result */
    static GOAL_CCL_HANDLE_T *pCcl = NULL;          /* GOAL CCL handle */

    /* create instance of CC-Link IE TSN stack */
    res = goal_cclIeTsnNew(&pCcl, GOAL_CCL_INSTANCE_DEFAULT, appl_goalCclCb);
    if (GOAL_RES_ERR(res)) {
        goal_logErr("Failed to instantiate CC-Link IE TSN stack");
        return res;
    }

 Figure 1.1: Creating a new instance of the CC-Link IE TSN master stack

This function creates a handle (in this example it is called pCcl) that must be used for all other function calls to reference the the stack instance.

Runtime behavior of the CC-Link IE TSN Master stack

The functions in this chapter influence the runtime behaviour of the CC-Link IE TSN Master Station. The functions must be called after goal_cclIeTsnNew returned successfully and before goal_cclIeTsnStart is called. These functions can be directly called within appl_setup or at a later point in time. These functions represent settings that usually come from an Engineering Tool. Therefore, the settings can be applied after receiving the current configuration from the tool.

Function

Description

goal_cclIeTsnDetectionAckEnforce

Enforce DetecktionAck transmission with every Detection frame

goal_cclIeTsnNetworkConfigSet

set Network properties:

  • cycle time

  • CC-Link IE Field Coexistence

  • number of Generic PTP devices

  • TxProhibit time

  • timeslot number for cyclic communication

  • number of allowed consecutive cyclic errors

goal_cclIeTimeSlotAdd

Add a time slot in ascending order from TSLT0 to TSLT7.

goal_cclIeTimeSlotEtherTypeAdd

Assign an Ethertype to a timeslot in ascending order from TSLT1 to TSLT7.

goal_cclIeTimeSlotMacAddrAdd

Assign a Destination MAC address to a specific timeslot.

goal_cclIeTimeSlotVlanAdd

Assign a VLAN Tag to a specific timeslot.

goal_cclIeTsnPortFilterSet

Set a port filter for each port. Use the GOAL_CCL_PORT_FILTER_* macros.

goal_cclIeTsnMulticastGroupAdd

Register a Multicast Group for reception.

goal_cclIeTsnRxAddrOverlapCheckEnable

Request Remote Stations to check their Rx Memory configurations for overlaps.

goal_cclIeTsnCycleCounterIgnoreEnable

Instruct all Remote Stations to ignore the cycle counter in cyclic frames.

goal_cclIeTsnTimeoutsGet

Get the timeout values of the Management Master state machine.

goal_cclIeTsnTimeoutsSet

Set the timeout values of the Management Master state machine.

goal_cclIeTsnTimeSyncSet

Set the time synchronization settings:

  • use 802.1AS or 1588v2

  • domain number

  • logarithmic Sync interval

  • Sync Rx timeout factor

  • logarithmic Announce interval

  • announce Rx timeout

  • logarithmic Pdelay interval

  • DelayResp monitoring interval

  • delay mechanism (E2E or P2P)

  • number of tolerable Sync losses

  • synchronization tolerance

goal_cclIeTsnNetworkNumberSet

Set the SLMP network number

goal_cclIeTsnMasterIdSet

Set the Id of the master station

goal_cclIeTsnCanOpenCallbackSet

Register a CANopen callback handler

goal_cclIeTsnStationNumSet

Set the station number of the device.

goal_cclIeTsnStationModeAdd

Register a Station mode for this device

goal_cclIeTsnLinkDevAdd

Add a Link device to a Station Mode

Table 1‑3: Runtime behavior functions of the CC-Link IE TSN Master stack

Remote Station Configuration

 For each Remote Station station in the network a Remote Station handle must be added. Each Remote Station is represented by an Id. The functions must be called after goal_cclIeTsnNew returned successfully and before goal_cclIeTsnStart is called. These functions can be directly called within appl_setup or at a later point in time, i.e. after the expected Remote Station configuration has been received from the Engineering Tool.

Function

Description

goal_cclIeTsnSlaveAdd

Add a Remote Station station with an IPv4 address and the ID of the Control Master.
The function returns the Remote Station ID (used as internal reference).

goal_cclIeTsnControlMasterAdd

Add a Control Master station with an IPv4 address and ist Master ID.
The function returns the station handle ID (used as internal reference).

goal_cclIeTsnSlaveStationModeSet

Set the expected station mode of a Remote Station.

goal_cclIeTsnSlaveTsltMagnificationSet

Set the timeslot magnification value for a Remote Station.

goal_cclIeTsnSlavePortFilterSet

Set the port filter for a Remote Station. Each array entry represents a port. Use the GOAL_CCL_PORT_FILTER_* macros.

goal_cclIeTsnSlaveCyclicConfigSet

Set the cyclic configuration for a Remote Station:

  • if Remote Station is a reserved station

  • if Control data can be split in multiple frames

  • EMG groups Remote Station belongs to

  • GOF groups Remote Station belongs to

  • number of sub cycles

  • subCycle where frame is either sent or received

  • if cyclic frames must be sent from all ports

goal_cclIeTsnSlaveInputAdd

This function is used to register an Input Link device for a Remote Station, i.e. a Subpayload transmitted by the Remote Station to the master.
It requires the receive address in the master's memory, the transmitt address in the Remote Station's Link Device and the data length.

goal_cclIeTsnSlaveOutputAdd

This function is used to register an Output Link device for a Remote Station, i.e. a Subpayload received by the Remote Station from the master.
It requires the transmit address in the master's memory, the receive address in the Remote Station's Link Device and the data length.

goal_cclIeTsnSlaveS2sTxSplAdd

Add a Tx Subpayload for direct communication to a Remote Station. The destination MAC address and IP address of the receiving Remote Station must be specified. Furthermore the Subcycle settings must be specified.

goal_cclIeTsnSlaveS2sRxSplAdd

Add a Rx Subpayload for direct communication to a Remote Station.

goal_cclIeTsnSlaveS2sRxSrcAdd

Add a Rx Source information item for direct communication to a Remote Station. This function sets the IP address of the sending Remote Station and the subcycle settings.

goal_cclIeTsnSlaveRxMulticastGroupSet

Add a Remote Station to a Rx multicast group. The Remote Station's Output Subpayloads will be sent with other Subpayloads via Multicast frames.

goal_cclIeTsnSlaveTxMulticastGroupSet

Add a Remote Station to a Tx multicast group. The Remote Station's Input Subpayloads will be received with other Subpayloads via Multicast frames

...

goal_cclIeSlaveTimeSlotMacAddrAdd

...

.

goal_

...

Assign a VLAN to a timeslot for this Remote Station.

...

cclIeTsnSlaveUncontrolledMulticastGroupAdd

Add a Remote Station to a Multicast Group that is not controlled by this station, i.e. multicast group for Remote Station-to-Remote Station communication

goal_cclIeTsnSlaveAppNetSyncEnable

Request the Remote Station to synchronize its application to the network cycle.

goal_cclIeTsnSlaveCyclicStopEnable

Enable or disable the Cyclic Stop request for a Remote Station station.

goal_cclIeTsnSlaveCanOpenConfigSet

Configure a Remote Station for CANopen communication.
Register startup commands, and TPDO and RPDO config objects.

Table 1‑4: Functions for Remote Station configuration

Starting the CC-Link IE TSN Master Stack

...

goal_cclIeTsnSlaveVlanSettingSelectSet

Assign a VLAN setting that shall be used by the Slave.
This function can be used if the slave shall transmit its cyclic data in a
timeslot that is not reserved for the CC-Link IE EtherType. Instead, it must
use a VLAN configuration from the global VLAN configuration array. The index starts at 1.

Table 1‑4: Functions for Remote Station configuration

Starting the CC-Link IE TSN Master Stack

After finishing all settings of the runtime behavior and the expected Remote Station configuration the stack must be started by calling goal_cclIeTsnStart.

 

Code Block
languagec
    res = goal_cclIeTsnStart(pCcl);
    if (GOAL_RES_ERR(res)) {
        goal_logErr("Failed to start stack");
    }

Figure 1.2: Start an instance of the CC-LINK IE TSN master stack

If this function succeeds the stack CC-Link IE TSN Master stack has been started and tries to detect all configured Remote Stations. All functions described in previous chapters cannot be used anymore.

Functions used during Run phase

After sucessfulling starting the stack. The application can use the following functions to access cyclic data and to influence the stack’s behaviour.

Function

Description

goal_cclIeTsnCyclicStopSet

Enable or Disable Cyclic Stop for the Master Station.

goal_cclIeTsnInputGet

Read Input data from the Cyclic Memory Map.
Only Input Link devices can be used. Each Link Device has ist own memory map.

goal_cclIeTsnOutputSet

Write Output data to the Cyclic Memory Map
Only Output Link devices can be used. Each Link Device has its own memory map.

goal_cclIeTsnAppStopSet

Enable or Disable Application Stop mode for this station.

goal_cclIeTsnAppErrorStopSet

Enable or Disable Application Error Stop mode for this station.

goal_cclIeTsnEmergencyStopExec

Issue an Emergency Stop due to internal error.
Calling this function will cause all controlled devices in the network to shutdown.
After calling this function the application is expected to halt the device and stop processing cyclic data.

goal_cclIeTsnPowerSupplyErrorStopExec

Issue an Emergency Stop due to Power supply error.
Calling this function will cause all controlled devices in the network to shutdown.
After calling this function the application is expected to halt the device and stop processing cyclic data.

goal_cclIeTsnOutputDevGet

Get data from an Output Link Device (data received via Master-to-Master communication).

goal_cclIeTsnInputDevSet

Set data of an Input Link Device (data transmitted for Master-to-Master communication).

goal_cclIeTsnSdoWrite

Start a SDO Write operation for a Remote Station.

goal_cclIeTsnSdoRead

Start a SDO Read operation for a Remote Station.

goal_cclIeTsnNmtUpload

Get the NMT state of a CANopen Remote Station.

goal_cclIeTsnNmtDownload

Set the NMT state of a CANopen Remote Station.

goal_cclIeTsnSlaveProcTypeRead

Request processor Type information from a Remote Station

Table 1‑5: Functions used during Run phase

Application Callback

 

During initialization, the application can register a callback handler with the function goal_cclIeTsnNew. The callback handler uses the following arguments:

Argument data type

Description

GOAL_CCL_HANDLE_T *

CC-Link IE TSN stack instance reference

GOAL_CCL_CB_ID_T

callback ID indicating callback type

GOAL_CCL_CD_DATA_T *

callback data, actual meaning depends on callback ID

Table 1‑6: Arguments of the Application Callback Handler

Some callback ID also evaluate the return value of the handler to decide how to proceed.

Callback ID

Description

Callback data

Return value

GOAL_CCL_CB_DETECTION_MISMATCH

mismatch in detected Remote Stations and configuration from engineering tool

NULL

don't care

GOAL_CCL_CB_NETCFG_MISMATCH

mismatch in network configuration

pNetConfigMismatchId
(Id of Remote Station with mismatching network configuration)

GOAL_OK: continue operation
other: go to Error state

GOAL_CCL_CB_MASTERCFG_MISMATCH

mismatch in configuration of a Control Master

NULL

don't care

GOAL_CCL_CB_ERROR_STATE

device entered Error state

NULL

don't care

GOAL_CCL_CB_UNKNOWN_SLAVE

detected a Remote Station that was not set by the engineering tool

pUnknownSlaveIpAddr
(IP Address of unknown Remote Station)

don't care

GOAL_CCL_CB_SLAVE_UNDETECTED

Remote Station was not detected in the network

pUndetectedSlaveId
(ID of Remote Station Handle)

GOAL_OK: continue operation
other: go to Error state

GOAL_CCL_CB_SLAVE_WRONG_IP_ADDR

Remote Station has wrong IP address (not in the same subnet)

pWrongIpAddrSlaveId
(ID of Remote Station Handle)

GOAL_OK: continue operation
other: go to Error state

GOAL_CCL_CB_SLAVE_IP_ADDR_DUPL

Remote Station has a duplicate IP address

pDuplicateIpAddrSlaveId
(ID of Remote Station Handle)

GOAL_OK: continue operation
other: go to Error state

GOAL_CCL_CB_SLMP_ERROR

SLMP error received from station

pSlmpErrorInfo->slaveId
(ID of Remote Station Handle)
pSlmpErrorInfo->cmd
(SLMP command)
pSlmpErrorInfo->subCmd
(SLMP subcommand)
pSlmpErrorInfo->endCode
(end code indicating error)

don't care

GOAL_CCL_CB_CM_UNCONFIGURED

Control Master is not configured

pUnconfiguredMasterId
(ID of Control Master handle)

GOAL_OK: continue operation
other: go to Error state

GOAL_CCL_CB_SLAVE_UNCONTROLLED

Remote Station not controlled by its Control Master

pUncontrolledSlaveId
(ID of Remote Station Handle)

GOAL_OK: continue operation
other: go to Error state

GOAL_CCL_CB_WRONG_GRANDMASTER

Remote Station has a different Grandmaster

pWrongGrandmasterSlaveId
(ID of Remote Station Handle)

don't care

GOAL_CCL_CB_RSV_TRANSIENT_DONE

reserved transient transmission done

NULL

don't care

GOAL_CCL_CB_RESERVED_STATION_ON

device entered Reserved Station mode

NULL

don't care

GOAL_CCL_CB_RESERVED_STATION_OFF

device left Reserved Station mode

NULL

don't care

GOAL_CCL_CB_CYCLIC_STOP_ON

cyclic communication stopped

NULL

don't care

GOAL_CCL_CB_CYCLIC_STOP_OFF

cyclic communication restarted

NULL

don't care

GOAL_CCL_CB_OWN_STATION_EMG_STOP

device received Emergency Stop request

pEmgGroup
(EMG group causing stop)

don't care

GOAL_CCL_CB_CYCLIC_ERROR_ON

other station causes cyclic error

pCyclicErrIpAddr
(IP address of Remote Station)

don't care

GOAL_CCL_CB_CYCLIC_ERROR_OFF

other station fixed cyclic error

pCyclicErrIpAddr
(IP address of Remote Station)

don't care

GOAL_CCL_CB_OTHER_STATION_EMG_STOP

Emergency stop for an Emergency Group

pEmgGroup
(EMG group that will be stopped)

don't care

GOAL_CCL_CB_OTHER_STATION_GOF_STOP

Emergency stop for a GOF Group

pGofGroup
(GOF group that will be stopped)

don't care

GOAL_CCL_CB_SLAVE_INVALID_CFG

expected configuration of Remote Station is not valid

pInvalidCfgSlaveId
(ID of Remote Station Handle)

GOAL_OK: continue operation
other: go to Error state

GOAL_CCL_CB_SLAVE_INVALID_DATA_ON

received invalid control data from Remote Station

pInvalidCycDataSlaveId
(ID of Remote Station Handle)

don't care

GOAL_CCL_CB_SLAVE_INVALID_DATA_OFF

control data from Remote Station is valid again

pInvalidCycDataSlaveId
(ID of Remote Station Handle)

don't care

GOAL_CCL_CB_CYC_COM_ENABLED

station started to send and receive process data

NULL

don't care

GOAL_CCL_CB_CYC_COM_DISABLED

station stopped to send and receive process data

NULL

don't care

GOAL_CCL_CB_IP_ADDR_DUPL

station’s IP address is also used by another station

NULL

don’t care

GOAL_CCL_CB_READPROCTYPE_RES

received a ReadProcType response

pReadProcTypeRes
(ReadProcType response data)

don’t care

...

GOAL_CCL_CB_SLAVE_INCOMPATIBLE

the slave's protocol version and/or certification class cannot be handled

pInvalidCfgSlaveId
(ID of Remote Station Handle)

don’t care

Table 1‑7: Handling of Application Callback IDs

Code Block
languagec
static GOAL_STATUS_T appl_goalCclCb(
    GOAL_CCL_HANDLE_T *pCclm,                   /**< GOAL CCL handle */
    GOAL_CCL_CB_ID_T cbId,                      /**< callback ID */
    GOAL_CCL_CD_DATA_T *pCbData                 /**< callback data */
)
{
    GOAL_STATUS_T res = GOAL_OK;                /* result */

    switch (cbId) {
        /* ... */

        case GOAL_CCL_CB_SLAVE_WRONG_IP_ADDR:
            goal_logInfo("slave 0x%04x has unexpected IP address", 
                         *(pCbData->pWrongIpAddrSlaveId));
            /* abort initialization */
            res = GOAL_ERROR;
            break;

        /* ... */
    }

    return res;
}

Figure 1.3: Sample implementation of the application callback

Configuration of CANopen Remote Stations

CANopen Remote Stations are configured with the same functions as Link Device Remote Stations. Additionally, there is the function goal_cclIeTsnSlaveCanOpenConfigSet to set CANopen specific properties of the Remote Station.

Code Block
languagec
static uint16_t slave2RpdoMapObj = 0x1601;      /**< Slave2: RPDO Mapping object */
static uint16_t slave2TpdoMapObj = 0x1A01;      /**< Slave2: TPDO Mapping object */
static GOAL_CCL_CO_STARTUP_T slave2StartUpCmds[] = {
    {GOAL_TRUE, 0x1C00, 1, sizeof(uint16_t), (uint8_t *) &slave2RpdoMapObj},
    {GOAL_TRUE, 0x1C01, 1, sizeof(uint16_t), (uint8_t *) &slave2TpdoMapObj},
};
static uint16_t slave2TpdoCfgTbl[] = {
    0x1C01,
};
static uint16_t slave2RpdoCfgTbl[] = {
    0x1C00,
};

res = goal_cclIeTsnSlaveCanOpenConfigSet(pCcl, slaveId,
                                  slave2StartUpCmds, ARRAY_ELEMENTS(slave2StartUpCmds),
                                  slave2TpdoCfgTbl, ARRAY_ELEMENTS(slave2TpdoCfgTbl),
                                  slave2RpdoCfgTbl, ARRAY_ELEMENTS(slave2RpdoCfgTbl));
if (GOAL_RES_ERR(res)) {
    goal_logErr("Failed to configure CANopen properties of slave %u", slaveId);
}

Figure 1.4: Configuration of a CANopen remote station 

An entry in the startup command table has the following fields:

Code Block
languagec
typedef struct {
    GOAL_BOOL_T wrFlag;                      /**< write or read access */
    uint16_t index;                          /**< object index */
    uint16_t subIndex;                       /**< object subindex */
    uint16_t dataLen;                        /**< size of data to be written or read */
    uint8_t *pData;                          /**< write data buffer */
} GOAL_CCL_CO_STARTUP_T;

Figure 1.5: CANopen startup command table entry

The other two tables contain lists of TPDO Config Objects and RPDO Config objects that must be enabled for cyclic communication.

In the RUN phase the application can use the functions goal_cclIeTsnSdoWrite and goal_cclIeTsnSdoRead to start SDO write or read operations.

CANopen Data Callback

The application can use the function goal_cclIeTsnCanOpenCallbackSet to register a callback handler for CANopen object access.

Code Block
languagec
        res = goal_cclIeTsnCanOpenCallbackSet(pCcl, appl_goalCclCanOpenCb);
        if (GOAL_RES_ERR(res)) {
            goal_logErr("Failed to register CANopen callback");
        }

Figure 1.6: Register a CANopen callback handler

The handler is called by the protocol stack every time a SDO Read or Write response was received, including those of the startup commands.

The callback handler uses the callback IDs GOAL_CCL_CO_CB_SDO_READ_RES or GOAL_CCL_CO_CB_SDO_WRITE_RES to indicate if the callback data refers to a read response or a write response.

The callback IDs GOAL_CCL_CO_CB_NMT_UPL_RES and GOAL_CCL_CO_CB_NMT_DNL_RES are used to indicate results of an NMT Upload or Download request.

Member

Data type

Description

slaveId

uint16_t

Remote Station id

endCode

uint16_t

SLMP end code (status of operation)

index

uint16_t

object index (only valid during startup or if endCode == 0x0000)

subIndex

uint8_t

object subindex (only valid during startup or if endCode == 0x0000)

dataLen

uint16_t

object data length (only valid for read access and if endCode == 0x0000)

pData

uint8_t *

object data (only valid for read access and if endCode == 0x0000) or
current NMT state of responder (as a uint8_t variable)

Table 1‑8: Members of callback data of CANopen data callback

Supported Platforms

 

Since the CC-Link IE TSN Protocol stack runs on GOAL, it can run on any platform supported by GOAL. However, to fullfill the requirements of a Class B device special hardware support is needed.

The hardware must support timestamping of Ethernet frames as defined by IEEE 1588v2 or IEEE 802.1AS.

Additionally, it must support time aware queuing of Ethernet frames as defined by IEEE 802.1Qbv.

 

As development is constantly ongoing, the following table should not be seen as complete.

Confirmed Supported Hardware

Features

 

NXP LS1028A

Conformance Class B

Hardware Qbv Support

IEEE1588v2 and IEEE802.1AS

100Mbit/1000Mbit

Table 1‑9: Confirmed Supported Hardware for the Master SDK

NXP LS1028A

The NXP LS1028A is a SoC that fullfills the hardware requirements for a Class B device.

There is an evaluation board called LS1028ARDB.

Building the firmware

The LS1028ARDB uses OpenIL, a Linux distribution for industrial automation with Realtime support. The distribution can be built with Buildroot.

Code Block
languagebash
git clone  
cd openil
git checkout OpenIL-v1.9-202009 #alternatively you can choose a newer release
make nxp_ls1028ardb-64b_defconfig
make 2>&1 | tee build.log

Flashing the firmware

Once the firmware has been built it must be copied to the SD-Card of the LS1028ARDB.

  •  insert SD-Card into Linux PC

    • card is listed as /dev/sdX [e.g. /dev/sdc]

    • see log via dmesg

  • in directory openil:

    • sudo dd if=output/images/sdcard.img of=/dev/sdc bs=1024

    • ATTENTION: choosing the wrong output device will overwrite sections of the PC’s HDD/SDD causing data loss

  • insert SD-Card into LS1028ARD and start device

 

Debug Interface

A serial console is available on UART1.

Use the following parameters: 115,200 baud/s, 8 data bits, no parity, 1 stop bit.

 

Configuration of the LS1028ARDB

It is possible to configure the number of ports used for CC-Link IE TSN. By default each port of the integrated TSN Switch is independent, i.e. there is no forwarding between these ports.

The interfaces representing these ports are called swp0 to swp3. In order to enable forwarding between two or more ports the following script could be executed:

 

Code Block
languagebash
#!/bin/sh

# create a bridge device
ip link add name switch type bridge
ip link set switch up
# add 1st port
ip link set swp0 master switch
ip link set swp0 up
# add 2nd port
ip link set swp1 master switch
ip link set swp1 up
# uncomment to add 3rd port
#ip link set swp2 master switch
#ip link set swp2 up
# uncomment to add 4th port
#ip link set swp3 master switch
#ip link set swp3 up

# add a route for this interface (subnet address might need to adjusted)
ip route add 192.168.3.0/24 dev switch

This will create a new interface called “switch”.

By default, the OpenIL image runs netopeer2, a NETCONF server. This server interfers with the Realtime behaviour of the GOAL process. Therefore, the server must be removed from the initialization scripts: 

Code Block
languagebash
rm /etc/init.d/S91netopeer2-server

Building the CC-Link IE TSN Master Application

The application can be built with aarch64-linux-gnu-gcc.

Navigate to the project folder of a sample application, e.g. “projects/goal_ccl_ie_tsn/03_master_ct/gcc”.

  •  Select the target platform (only required once)

    • make select

    • enter the number of “linux_nxp_ls1028a”

  • build sample application

    • make

The binary is located at
projects/goal_ccl_ie_tsn/03_master_ct/gcc/linux_nxp_ls1028a/goal_ linux_nxp_ls1028a.bin”.

The file must be copied to the LS1028ARDB, e.g. via scp.

 

On the LS1028ARDB:

Code Block
languagebash
#reduce kernel log messages to only critical ones
echo 1 > /proc/sys/kernel/printk
#disable memory overcommitting
echo 2 > /proc/sys/vm/overcommit_memory
#make application executable
chmod +x goal_ linux_nxp_ls1028a.bin
#start application (adjust Ethernet port if necessary)
./goal_ linux_nxp_ls1028a.bin -i <IFACE>

 Note:

<IFACE> is the ethernet interface that GOAL should use. This is either the bridge device “switch” or a standalone port, e.g. “swp0”.

Start CC-Link IE TSN Master application automatically 

In order to start the Master SDK automatically after boot up, a script must be created in the directory /etc/init.d, e.g. S99GOAL. 

The script should have the following content: 

Code Block
#!/bin/sh
#
# CC-Link IE TSN Master SDK
#
GOAL=/root/goal_linux_nxp_ls1028a.bin
start() {
	echo 1 > /proc/sys/kernel/printk
	echo 2 > /proc/sys/vm/overcommit_memory
	printf "Starting CC-Link IE TSN Master SDK: "
	${GOAL} -i swp0 &
	echo "OK"
}
stop() {
	printf "Stopping CC-Link IE TSN Master SDK: "
	killall $(basename ${GOAL})
	echo "OK"
}
restart() {
	stop
	start
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	restart
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

Please make sure that the script is executable:

chmod +x /etc/init.d/S99GOAL

Conformance Test

 

In order to perform the conformance test, several configurations must be tested.

...

Conformance Test

 

In order to perform the conformance test, several configurations must be tested.

Configuration of the Master Station the network and the expected Remote Stations is done by API functions as described in a previous chapter

...

.

There is a sample application that contains the required configurations. In can be found in appl/goal_ccl_ie_tsn/03_master_ct.

There are configuration macros to enable or disable features. If a new configuration is required, the macros must be set to the appropriate values. The application must be recompiled

...

and copied to the LS1028ARDB

...

.

...

Configuration Macro

Description

GOAL_APPL_SLAVE0_ENABLED

1: enable Remote Station 0

0: disbale Remote Station 0

(NZ2GN2B1-32DTE, 192.168.3.1)

GOAL_APPL_SLAVE1_ENABLED

1: enable Remote Station 1

0: disbale Remote Station 1

(RJ71GN11-T2, 192.168.3.2)

GOAL_APPL_SLAVE2_ENABLED

1: enable Remote Station 0

0: disbale Remote Station 0

(MR-J5-10G, 192.168.3.10)

GOAL_APPL_SLAVE2_ALT_MAPPING

1:

...

use an alternate PDO mapping for Remote Station 2
0: use default PDO mapping for Remote Station 2

GOAL_APPL_CO_OBJ_TEST

1: execute CANopen object test for Remote Station 2
0: do not execute test

GOAL_APPL_SLMP_TEST

1: execute SLMP Client test

0: do not execute test

GOAL_APPL_TIMESYNC_1588

1: use IEEE 1588v2 for time synchronization

0: use IEEE 802.1AS for time synchronization

GOAL_APPL_MULTICAST

1: use multicast frames for cyclic communication

0: use unicast frames for cyclic communication

GOAL_APPL_TIME_SYNC_SLAVE

1: device is not the Grandmaster

0: device is the Grandmaster

GOAL_APPL_LINKSPEED_100

1: enforce a Link speed of 100 Mbit/s

0: enforce a Link speed of 1000 Mbit/s

Table 1‑10: Configuration Macros of the Conformance Test sample application

Table of Contents
minLevel1
maxLevel7