...
...
Table 2‑2: Configuration Functions of the Remote Station 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.
...
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 2.1: Creating a new instance of the Remote Station 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 stack instance.
Runtime behavior of the CC-Link IE TSN Remote Station stack
...
...
...
...
...
...
GOAL_CCL_CB_ERROR_STATE
...
device entered Error state
...
NULL
...
Table 2‑4: Functions used during Run phase in the Remote Station SDK
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 2‑5: Arguments of the Application Callback Handler in the Remote Station SDK
Some callback ID also evaluate the return value of the handler to decide how to proceed.
...
Callback ID
...
Description
...
Callback data
...
Return value
...
...
reserved transient transmission done
...
NULL
...
don't care
...
...
device entered Reserved Station mode
...
NULL
...
...
...
...
...
...
...
...
...
...
...
...
...
pEmgGroup
(EMG group causing stop)
...
...
...
...
...
...
...
...
pCyclicErrIpAddr
(IP address of Remote Station)
...
...
...
station started to send and receive process data
...
...
...
...
...
station stopped to send and receive process data
...
...
...
station’s IP address is also used by another station
...
NULL
...
...
...
...
...
...
Table 2‑6: Handling of Application Callback IDs in the Remote Station SDK
...
...
...
GOAL_CCL_HANDLE_T *pCclm, /**< GOAL CCL handle */
...
...
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 2.3: Sample implementation of the application callback
Data Access with CANopen
The Remote Station SDK can be extended with a CANopen package which provides an additional approach to configure the data transfer, using methods known originally adapted from the CANopen specification. Specifically, this uses the concepts of RPDO and TPDO configuration and PDO or SDO data transfer.
To set up this operation mode, the station mode needs to be marked as CANopen. Instead of Word link devices, CANopen link devices must be initialized. Additionally, this mode requires an object dictionary and a CANopen configuration file. It is recommended to use the port ICC tool to interactively create them. (See chapter 3 in this document.)
When accessing the CANopen link devices, the general access function will not work. Instead, the following functions will address CANopen objects by index and subindex directly:
...
Function
...
Description
...
goal_cclIeTsnInputDevSetCANopen
...
Write to object in object dictionary
...
goal_cclIeTsnInputDevGetCANopen
...
Read from object in object dictionary
...
...
...
...
Table 2‑7: CANopen Data Access Functions
...
...
...
...
...
...
...
...
...