Sys Tec Electronic GW-003 System Manual

Can-ethernet gateway
Table of Contents

Advertisement

Quick Links

CAN-Ethernet Gateway
GW-003
Systems Manual
Edition April 2007
system house for distributed automation

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the GW-003 and is the answer not in the manual?

Questions and answers

Summary of Contents for Sys Tec Electronic GW-003

  • Page 1 CAN-Ethernet Gateway GW-003 Systems Manual Edition April 2007 system house for distributed automation...
  • Page 2 SYS TEC electronic GmbH neither gives any guarantee nor accepts any liability whatsoever for consequential damages resulting from the use of this manual or its associated product. SYS TEC electronic GmbH reserves the right to alter the information contained herein without prior notification and accepts no responsibility for any damages, which might result.
  • Page 3: Table Of Contents

    4.4 File System ................. 38 4.4.1 Structure ................ 38 4.4.2 Data Storage in EEPROM..........39 4.5 Command Set Description ............40 4.5.1 cd ................... 40 4.5.2 ls ..................40 4.5.3 mkif ................41 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 4 7.3.5 Using the DLL Functions ..........90 7.3.5.1 Demo project ..........90 7.3.5.2 Starting the Demo Program ......91 Updating the device Firmware ............93 8.1 Preparations................93 8.2 Firmware download ..............94 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 5 Contents Index......... 97 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 6 Figure 18: The CAN timestamp structure ..........74 Figure 19: CAN-Status Structure .............. 78 Figure 20: MemTool software..............94 Figure 21: Memory sectors of the CAN-Ethernet Gateway...... 95 Figure 22: Memory areas and sector assignment ........95 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 7 File Structure of the CAN-Ethernet Gateway Utility Disk..60 Table 10: Available Functions within the Software States ...... 62 Table 11: EthCan.Dll Interface Function Error Codes......84 Table 12: CAN Error Codes..............88 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 8 CAN – Ethernet Gateway © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 9: Introduction

    Internet communication via TCP/IP is finding ever-increasing implementation in industrial applications. The CAN-Ethernet Gateway from SYS TEC electronic GmbH is a solution that enables CAN networks to be coupled together over the Internet/Ethernet, whereby remote monitoring and control is possible. The CAN-Ethernet Gateway controls networked communication and makes a transparent CAN-based application interface available to the user.
  • Page 10: Application Fields

    CAN messages to be sent on, thus only the relevant data gets transmitted over the Ethernet. The principle possibilities for building a network structure using CAN-Ethernet Gateways are represented in Figure 1. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 11: Figure 1: Application Example #1: Transparent Connection Of Two Can Networks Using Intranet/Ethernet

    CAN-Device B CAN - Bus 1 CAN-Ethernet Gateway Ethernet Intranet Ethernet CAN-Ethernet Gateway CAN - Bus 2 CAN-Device C CAN-Device D Figure 1: Application Example #1: Transparent Connection of two CAN Networks using Intranet/Ethernet © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 12: Remote Diagnostics And Configuration Of Can Networks

    Ethernet connection to the field level, however it offers the convenience of familiar CAN and CANopen tools. The functions and parameters of the Gateway itself can be accessed and modified remotely using the Telnet protocol. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 13: Delivery Contents

    CAN- Ethernet Gateway via RS-232 in preparation: • GW-003-2 CAN-Ethernet Gateway (2* CAN) in housing for DIN rail assembly, including a 2-pin and a 5-pin removable screw clamp connector © SYS TEC electronic GmbH 2007...
  • Page 14 CAN – Ethernet Gateway © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 15: Technical Data

    • Dimensions without connectors, 70 x 100 x 61 (L x B x H) mm³, suitable for DIN/EN rail assembly • Protection level: IP20 CiA, CAN in Automation, international users and manufacturers group © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 16: Figure 3: View Of The Can-Ethernet Gateway

    CAN – Ethernet Gateway • Operational temperature range 0°C to +70°C Figure 3: View of the CAN-Ethernet Gateway © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 17: Getting Started

    Gateway. The CAN shield potential is only connected between the two CAN connectors. The CAN bus is galvanic isolated (optically isolated) from the Gateway's internal circuitry. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 18: Ethernet Connection

    Gateway Name Description Transmit Data + Transmit Data - Receive Data + n.c. not connected n.c. not connected Receive Data + n.c. not connected n.c. not connected Table 2: Ethernet Connector Pin Assignment © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 19: Interface

    System Ground Data Set Ready Request to Send Clear to Send Ring Indicator Table 3: RS-232 Interface Connector Pin Assignment The CAN-Ethernet Gateway is connected to the PC via a null modem cable. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 20: Device Status Display

    Data transfer over Ethernet [yellow] traffic Indicates data traffic on the CAN bus [green] error (CAN) Error during data transfer on the CAN connection (refer to section 6.1) [red] Table 4: Meaning of the Device Status LEDs © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 21: Switches

    Gateway (refer to section 8) “Bootstrap-Mode” will be entered Firmware of the CAN-Ethernet Gateway starts Reset the CAN-Ethernet Gateway (refer to section 8) Reset active/enabled Reset not active/disabled Table 5: Meaning of the Switches © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 22: Initial Setup And Operation

    1 Mbit/s CAN identifier for error messages: 0xFE RS-232 interface Baud rate: 9600 baud Data bits: Parity: none Stop bits: Protocol/flow control: hardware BTP: Block Transfer Protocol for transmitting CAN messages via UDP/IP © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 23: Initial Configuration Using The Rs-232 Interface

    • Set the baud rate and the protocol for the serial interface (e.g. COM1) in HyperTerminal (refer to Figure 4 and Figure 5). Figure 4: HyperTerminal Configuration (1) © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 24: Figure 5: Hyperterminal Configuration (2)

    CAN – Ethernet Gateway Figure 5: HyperTerminal Configuration (2) • Be sure that you have correctly connected the supply voltage (polarity) and then turn on the power. Figure 6: CAN-Ethernet Gateway Start Message © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 25 UDP_Client_1CAN.txt or TCP_Client._1CANtxt. • Copy these files into a folder of your choice on your PC (e.g. C:\SYSTEC\GW-003\RC-Files). Before you transfer one of these files to the CAN-Ethernet Gateway you must modify the file. Open the file Udp_Server_1CAN.txt with an editor.
  • Page 26 UdpServer_1CAN_117.txt The generated configuration file is written to the CAN-Ethernet Gateway as follows: Change to the directory /save / >cd /save↵ /save > Erase the existing configuration file /save >rm rc↵ /save >sync↵ © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 27: Figure 7: Sending A Configuration File Via Hyperterminal

    After you’ve input the command you can send a file to the CAN- Ethernet Gateway using the HyperTerminal tool. The following images show how to do this: Figure 7: Sending a Configuration File via HyperTerminal Figure 8: Selecting a Configuration File © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 28: Figure 9: Successful Transmission Of A Configuration File, Terminate With Crtl+D

    4. To end the transfer push . The Gateway will show the Ctrl+D execution with the prompt /save > 5. Save the file with the command in EEPROM. sync Figure 10: Finishing the Configuration © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 29: Figure 11: Verifying The Selected Configuration

    . All created interfaces appear in the folder . An interface can be addressed and configured via a direct call to the directory (refer to section 4.2.4). © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 30: Configuration And Operation Using Telnet

    (refer to section 3.5.1). A Telnet client is already included in the Windows package. This Telnet client can be called via Under Linux the telnet <Address>. programs can be used. telnet netcat © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 31: Device Functions

    (optional) Ethernet Input filter Output filter fout UDP Server Interface udpserv0 Port number Server LED Interface UDP: red/green CAN: red/green Telnet - or RS-232 Access Configuration Figure 12: CAN-Ethernet Gateway Functional Overview © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 32: Interfaces

    Within the interface directory there are 3 files. The files are responsible for CAN message filtering (refer to section fout 4.3). The file is intended for future expansions and currently conf remains unused. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 33 After an interface has been created, the current settings can be queried by entering the command interface name + number. e.g. /if/can0↵ Usage: /if/can0 [on] [off] [canid:<hex>] [baud:<num>] [bus:<num>] [buf:<num>] Current settings: on canid:0xF6 baud:0 (1MBit/s) bus:0 state:0x0 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 34: Udp/Tcp Server Interface

    CAN messages has not been reached, an additional timer event can initiate the transmission of the UDP/TCP packet. These parameters are applicable for © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 35 Ethernet packet: Number of received CAN messages >= time difference between the last transmission time and the current time > time Output of the current configuration: /if/udpserv0↵ Usage: udpserv0 port:<num> [trig:<cnt>[,<time>]] Current port:8234 trig:1,0 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 36: Udp/Tcp Client Interface

    CAN auto messages to be sent. stops the connection, any data that has not been transferred will be discarded (default) © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 37 1 - 127 default: time in milliseconds [ms] that can have passed since the time last transmission before the next Ethernet packet is transmitted. value range: 0 - 4294967295 [ms] default: © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 38 > time Output of the current configuration /if/udp0↵ Usage: udp0 [to:<ipaddr>[:<port>]] [on|auto|off] [alive:<num>] [reco:<num>[,<time>]] [trig:<cnt>[,<time>]] 0 frames sent, 0 frames recv'd, state: Connection establishment in process Current settings: to:192.168.10.118:8234 alive:1 reco:1,120 trig:1,0 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 39: Can Interface

    Sets the CAN identifier , which is used when error <hex> messages are sent (default: 0xfe). Value range: 0<= <= 7FF CiA DSP305: CAN in Automation Draft Standard Proposal CANopen Layer Setting Services and Protocol © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 40 <busid> ::= bus:<num> determines the CAN bus connection that is to be used for the interface (default: 0) GW-003 supports a CAN-Bus: num = 0 (in preparation: GW-003-2 CAN-Ethernet Gateway with two CAN bus interfaces, value range: 0 <= num <=1 ) <bufid>...
  • Page 41: Led Interface Status Display

    The states of other interfaces are not displayed. The interface IDs can be accessed with the command ls (refer to section 4.5.2). Default setting (the CAN interface has the interface number 1): /if/led0/fin +hd1 +l Possible options: <option> ::={<reset>} re-initializes the LEDs reset © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 42: Filtering

    CAN IDs are established in the function will reach the CAN-Ethernet Gateway. 4.3.3 Output Filter The output filter determines which messages from the Gateway’s data pool will be passed on ( fout © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 43: Filter Description (Syntax)

    ID with the command refer to section 4.5.2). If no number is given then all interfaces are accepted. If individual CAN identifiers are filtered then is not required. <idh> RTR: Remote Transmission Request © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 44 0x57F and those with the CAN identifier 0x700. By deleting the filter file with the command , the filter rules are also deleted. The file is retained. The configured filter rules can be displayed by calling the filter file. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 45 -lds 180 57f -lde 180 57f -lds 700 700 -lde 700 700 default: +l /if/can0 > Note: The CAN identifier is given in hexadecimal format, without indication of a preceding 0x or a subsequent h. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 46: File System

    (refer to section 5). The /save directory represents a special case. All files contained therein can be stored in EEPROM. There are commands available for navigation within the file system (refer to section 4.5). © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 47: Data Storage In Eeprom

    . This file is executed when the firmware is started (under the condition that the switch "DEFT" = OFF) and contains all of the configuration data for the CAN-Ethernet Gateway (refer to section 5.3). © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 48: Command Set Description

    Example: displays the folder / >ls /if↵ typ:0xc2 led0 use:0 typ:0xa0 ch:4 id:0 can0 use:0 typ:0xa0 ch:4 id:1 udpserv0 use:0 typ:0xa0 ch:4 id:2 tcpserv0 use:0 typ:0xa0 ch:4 id:3 udp0 use:0 typ:0xa0 ch:4 id:4 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 49: Mkif

    Configuration of the output filter, i.e. for /if/<if-name>/fout messages from the Gateway to the interface Example: creates an interface with the name / >mkif tcp 0 tcpclient tcpclient creates a CAN interface with the name / >mkif can can0 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 50: Sys Tec Electronic Gmbh 2007 L-1032E_9

    Example: / > mem↵ Free file handles: 40 Memory total free blocks Eeprm: 2026 1668 1442 lwIP : 8192 8090 8090 SysSt: 2410 2148 1908 UsrSt: 9000 7058 6658 : 150000 144792 65528 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 51: Write

    . The command is closed write with two empty lines and the key combination Crtl+D. The use of the command is described in section 3.5. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 52: Cat

    Description: command writes files located in the sync /save directory that are not yet saved into the EEPROM. Thus the files are available again following power-on or a reset (refer to section 4.4.2). © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 53: Version

    Gateway (software reset). Depending on the "DEFT" DIP switch position the corresponding configuration script will be loaded. MAC: Media Access Control: Unique Ethernet address for each CAN-Ethernet Gateway. Each device with an Ethernet controller has its own MAC address. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 54: Ipcfg

    Example: Configuring the device parameters />ipcfg 192.168.10.117 255.255.255.0 192.168.10.1↵ Displaying the current configuration />ipcfg ↵ ipcfg ipcfg <local-ip> <mask> <gw> local-ip:192.168.10.117 mask: 255.255.255.10 192.168.10.1 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 55: Siocfg

    4800 Baud 9600 Baud 19200 Baud 38400 Baud 57600 Baud 115000 Baud The parameters hardware flow control, 8 data bits, one stop bit and no parity are preset. Example: / >siocfg 57600↵ © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 56 CAN – Ethernet Gateway © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 57: Gateway Configuration

    - can be established with the commands write sync and is saved in EEPROM - is executed if the switch "DEFT" is set to OFF - is established by the customer based on the application requirements © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 58: Example For A Customer-Specific Configuration Script

    CAN error message, CAN interface is switched on /if/udp0 Configuring the UDP client interface with to:192.168.10.115 on target IP address entry, the interface is switched on and starts the connection © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 59: Creating A Configuration Script

    Finally the data must be stored in the EEPROM with the command sync Restarting the Gateway activates the new configuration (the switch "DEFT" must be set to OFF). © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 60: Resetting The Device To Its Standard Configuration

    /save >sync software reset /save >reset prompts to enter the password when Bye. Enter password: starting a new session over Telnet or RS-232 Entry of an incorrect password will be answered with Access denied © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 61: Error Handling

    CAN ID to be sent) General: incorporation of error messages possible, if CAN internal high-priority buffer has not overflowed Incorporation of the original CAN message is attempted again. Indication on Gateway: CAN Error LED illuminates briefly © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 62 • CAN bus-off error Possible causes: incorrect CAN bus cabling, wrong CAN bitrate, hardware error Gateway: CAN error LED blinks with a 50:50 on/off ratio until the transmission or receipt of a CAN message was successful © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 63: Table 7: Error Display Overview

    Receive buffer overflow (message loss) blinks with CAN bus-off error detected 50:50 on/off ratio blinks with CAN acknowledgement error detected 25:75 on/off ratio short flashes Send buffer overflow Table 7: Error Display Overview © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 64: Error Indication Under Windows

    For the 2 byte long emergency and error codes (byte 0/1 and 4/5) the MSB portion is sent last, e.g. 00 10 for 0x1000. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 65 Usage: can0 [on] [off] [canid:<hex>] [baud:<num>] [bus:<num>] [buf:<num>] Current settings: on canid:0xF5 baud:0 (1MBit/s) bus:0 state:0x850 shows CAN bus-off and CAN warning limit as well state = 0x850 as data transfer via BTP © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 66 CAN – Ethernet Gateway © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 67: Software Support

    During installation the driver-DLL (EthCAN.Dll) will be copied to the corresponding Windows system folder (depending on your operating system). The setup program will also create the following file structure in the installation folder, based on the default installation path: © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 68: Table 9: File Structure Of The Can-Ethernet Gateway Utility Disk

    "Demo.Prj" contains a demo project in the form of a Visual Studio project. This project contains a "C" source file as well as a corresponding header file, which shows the use of the DLL functions in the form of a demo program. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 69: Dynamic Linked Library Ethcan.dll

    If the library function EthCanInitHardware() is called, then the software will change to the HW_INIT state. All resources that are necessary for communication with the CAN-Ethernet Gateway are provided here. With the library function EthCanDeinitHardware() it © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 70: Ethcan.dll Function Interface

    DLL in terms of their use and return values. The use of the functions is illustrated with code examples. All function parameters are selected so that the DLL can be used with programming languages such as Pascal or Visual Basic. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 71: Ethcangetversion

    16 - 31: release version number in binary format Application Example: DWORD dwVersion; char szVersion[16]; // Get version number dwVersion = EthCanGetVersion (); // convert to a string wsprintf( szVersion, „V%d.%02d.r%d“, (dwVersion&0xff), (dwVersion&0xff00)>>8, dwVersion>>16); © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 72: Ethcaninithardware

    It reports the current connection status and is always called from the DLL if the connection status changes. It is therefore possible to react accordingly to any breaks in the connection within the application. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 73: Figure 14: Hardware Parameter Structure Overview

    #define IP_PORT_DEFAULT (8234) UDP and TCP are available for the transfer protocol to be used. typedef enum kUseTCP = 0x00, // TCP Protocol kUseUDP = 0x01 // UDP Protocol }tUsedProtocol; Figure 15: CAN-Ethernet-Gateway Transfer Protocols © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 74 Note: If a separate Callback function is created for each instance, it is important to be sure that different function names are assigned to prevent Compiler and Linker errors! © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 75: Figure 16: Can-Ethernet Gateway Connection Status

    Return Values: (see Section 7.3.3) ETHCAN_SUCCESSFULL ETHCAN_ERR_RESOURCE ETHCAN_ERR_ILLHANDLE ETHCAN_ERR_ILLPARAM ETHCAN_ERR_HWINUSE ETHCAN_ERR_HWCONNECT_FAILD ETHCAN_ERR_MAXMODULES ETHCAN_ERR_SAL ETHCAN_ERR_IFBTP © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 76: Application Example

    //Connection in process case kConnecting:……………………… break; //Connection Established case kEstablished:…………………… break; //Disconnecting case kClosing:……………………………… break; //Disconnected case kClosed:………………………………… break; //initializes a CAN-Ethernet Gateway with Callback function dwRetcode = EthCanInitHardware (&EthCanHandle, &EthCanHwParam, EthCanConnectControlFct,NULL); © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 77: Ethcandeinithardware

    2. In „Non-blocked Mode“ the disconnection process is started without waiting for completion. The function returns immediately. If the connection status is changed the Callback function is called from the DLL, which returns the current connection status. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 78 #define IP_ADDR ((192 << 0)+(168 << 8)+ (10 << 16)+(111 << 24)) #define IP_PORT (8234) void main (void) DWORD dwRetcode; tEthCanHandle EthCanHandle; tEthCanHwParam EthCanHwParam; EthCanHwParam.m_IpAdress = IP_ADDR; EthCanHwParam.m_wPort = IP_PORT; EthCanHwParam.m_UsedProtocol = kUseTCP; © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 79 EthCanInst_g[EthCanHandle_p].m_fConnected = FALSE; break; void main (void) DWORD dwRetcode; ..tEthCanHandle EthCanHandle; //initialize a CAN-Ethernet Gateway with callback function dwRetcode = EthCanInitHardware (&EthCanHandle, &EthCanHwParam, EthCanConnectControlFct,NULL); if(dwRetcode == ETHCAN_SUCCESSFUL) printf("\n*** Successfully initialised! ***\n", dwRetcode = EthCanDeinitHardware(EthCanHandle); © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 80 CAN – Ethernet Gateway if(dwRetcode == ETHCAN_SUCCESSFUL) printf("\n*** Successfully closed! ***\n"); //Wait for the disconnect, signalized by the Callback function Sleep(10); }while(EthCanInst_g[EthCanHandle].m_fConnected); //Exit application return(dwRetcode); © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 81: Ethcanreadcanmsg

    When formatting the CAN message, there is differentiation between two types. CAN messages with 11-bit identifiers (Standard CAN Frame) and CAN messages with 29-bit identifiers (Extended CAN Frame) are supported. This also applies for so-called remote frames © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 82: Figure 18: The Can Timestamp Structure

    Ethernet Gateway hardware. The time between two CAN messages is determined by the difference between the two values. Note: The Member variables m_wMilliSec_Overflow and m_wMicroSec of the Timestamp structure are not used at this time and always contain the value 0. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 83 RecvCanMsg; tCANTimestamp RecvTime; DWORD dwRetcode; //Read CAN-message dwRetcode = EthCanReadCanMsg(EthCanHandle,&RecvCanMsg,&RecvTime); if(dwRetcode == ETHCAN_SUCCESSFUL) //CAN-message received else if(dwRetcode & ETHCAN_CANERR_ QRCVEMPTY) //no CAN-message in the message buffer else //error during receipt of the CAN-message © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 84: Ethcanwritecanmsg

    (see Section 7.3.2.4) corresponding to the CAN-message (29-Bit, 11-Bit, RTR) to be sent. The parameter pSendTime_p is an address pointing to a Timestamp structure. For this function, this parameter has no meaning, however © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 85 = 8;//8 Byte requested Data length SendTime.m_dwMillis = 0; //Send CAN-message dwRetcode = EthCanWriteCanMsg(EthCanHandle,&CanMsg,&SendTime); if(dwRetcode == ETHCAN_SUCCESSFUL) //CAN-message sent else if(dwRetcode & ETHCAN_CANERR_ QXMTFULL) //Overflow of the send buffer else //Error when sending the CAN-message © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 86: Ethcangetstatus

    Address to a status structure. This address must not be NULL! This status structure is defined as follows: typedef struct WORD m_wCanStatus; // current CAN state WORD m_wConnectionStatus; // current connection state } tStatus; Figure 19: CAN-Status Structure © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 87 ETHCAN_ERR_ILLHANDLE ETHCAN_ERR_ILLPARAM ETHCAN_ERR_HWNOINIT ETHCAN_ERR_HWNOTCONNECTED Application Example: tEthCanHandle EthCanHandle; tStatus Status; DWORD dwRetcode; //read CAN-Status dwRetcode = EthCanGetStatus(EthCanHandle,&Status); if(dwRetcode == ETHCAN_SUCCESSFUL) if(Status.m_wCanStatus & ETHCAN_CANERR_OVERRUN) //Overrun error occurred else //Error while reading the CAN status © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 88: Ethcangetconnectionstate

    The parameter pState_p returns the current connection status after the function has been called and can take on the values as previously described in Figure 16. Return Values: (see Section 7.3.3) ETHCAN_SUCCESSFUL ETHCAN_ERR_ILLHANDLE ETHCAN_ERR_ILLPARAM ETHCAN_ERR_HWNOINIT © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 89 ConnectionState; DWORD dwRetcode; //Read Connection Status dwRetcode = EthCanGetStatus(EthCanHandle,&ConnectionState); if(dwRetcode == ETHCAN_SUCCESSFUL) if(ConnectionState == kConnecting) //Code to be executed if(ConnectionState == kEstablished) //Code to be executed else //Error while reading the connection status © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 90: Ethcanresetcan

    0x01 //Erase the send and receive buffer for CAN messages in the DLL #define RESET_ALL_QUEUES 0x02 //Erase the send and receive buffer for CAN messages on //the Gateway and reset the CAN controller © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 91 //of the CAN-Ethernet Gateway dwResetCode = (RESET_ALL_QUEUES & RESET_CAN_CONTROLLER); //Reset the CAN interface dwRetcode = EthCanResetCan(EthCanHandle,dwResetCode); if(dwRetcode == ETHCAN_SUCCESSFUL) //CAN interface was reset successfully else //An error occurred while resetting the CAN interface © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 92: Error Code Description

    The function was executed without errors. ETHCAN_ERR_ILLPARAM An illegal parameter was passed to the function. The most probable cause for this error is passing of a NULL pointer. ETHCAN_ERR_ILLPARAMVAL An invalid parameter value was passed to the function. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 93: Ethcan_Err_Illhandle

    CAN message should only be polled if the connection status is kEstablished. callback function defined then function EthCanGetConnectionState() should be used to poll the connection status. Following a successful ”Reconnect“ the function can be called again. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 94: Ethcan_Err_Hwconnect_Faild

    The maximum number of CAN-Ethernet Gateways that can be supported by the DLL has been reached. No other instances can be initialized. De-initialize any instances that are no longer required and then call the init function again. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 95: Ethcan_Err_Sal

    BTP interface (Block Transfer Protocol) for UDP or TCP. ETHCAN_ERR_RESOURCE A resource could not be created or is not available. Understood as resources are memory requirements, handles or threads, which are managed by Windows. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 96: Can Error Code Description

    The send buffer in the CAN Controller of the CAN-Ethernet Gateway has reached the maximum number of CAN messages. ETHCAN_CANERR_OVERRUN The receive buffer in the CAN controller of the CAN Ethernet Gateway has reached the maximum number of CAN messages. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 97 Overflow of the send queue for CAN messages in the DLL. It is possible that some CAN messages will have been lost. ETHCAN_CANERR_REGTEST The register test of the SJA1000 failed. Refer to the manual for the CAN Controller SJA 1000. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 98: Using The Dll Functions

    Using the same tools it is possible to send CAN messages, which are transmitted to the PC via Ethernet and are displayed on the console window with its CAN-ID, data length code and data field. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 99: Starting The Demo Program

    IP address, the Port number and the desired transfer protocol. The following shows two examples: Example 1: ...\Release\EthCanDemo.exe 192.168.010.111 8234 TCP Example 2: ...\Release\EthCanDemo.exe 192.168.010.111 8234 UDP © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 100 CAN – Ethernet Gateway © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 101: Updating The Device Firmware

    COM port on the PC via the Nullmodem cable mentioned above. 3. Activate the „Bootstrap-mode“. Therfore switch the boot switch to position „On“ and reset the device. The device is now ready for downloading the firmware. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 102: Firmware Download

    A configuration dialog window appears, where you can configure the serial interface used for firmware update. 3. Connect to the target using the „Connect“ button. After the connection has been established successfully, the available memory sectors appear (see Figure 21). © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 103: Sys Tec Electronic Gmbh 2007 L-1032E_9

    Figure 22: Memory areas and sector assignment 7. Click button „Program“ to start the program download. 8. After successfully downloading the firmware set the boot switch to „Off“ and reset the device by reset button or power cycle. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 104 EEPROM will be discarded. With restarting the device after firmware update the standard configuration with default IP 192.168.10.111 and the settings described in the standard RC file is loaded. The user specific configuration must be downloaded afterwards. © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 105 J1939 ........... 1 Dimensions ......... 7 LED........7, 33 DIN/EN Rail Assembly ....7 LED Interface......33 Driver Installation ..... 59 LIB ..........60 Dynamic Linked Library ..61 ls 40 EEPROM ........39 mem........... 42 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 106 UDP_Client_1CAN.txt..... 17 Standard Gateway....21, 46 UDP_Server_1CAN.txt .... 17 Standard-Resource-File .... 96 Using the DLL Functions ..90 Subnet Mask ....18, 21, 46 version........45 Supply Voltage ....... 7, 9 write .......... 43 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 107 Did you find any mistakes in this manual? page Submitted by: Customer number: Name: Company: Address: Return to: SYS TEC electronic GmbH August-Bebel-Str. 29 D-07973 Greiz, Germany Fax : +49 (0) 3661 6279-99 © SYS TEC electronic GmbH 2007 L-1032e_9...
  • Page 108 Published by © SYS TEC electronic GmbH 2007 Ordering No. L-1032e_9 Printed in Germany...

Table of Contents