LIN2CAN API (L2CAPI) MANUAL ENGLISH

Similar documents
LIN2CAN & Configuration Tool

IXXAT CME/PN. CANopen-PROFINET Gateway HARDWARE MANUAL ENGLISH

HARDWARE MANUAL ENGLISH

CANcheck. Installation Tester for CAN/CANopen Networks MANUAL ENGLISH

II. Intelligent PC/CAN Interface USER MANUAL ENGLISH

PCAN-LIN Interface for LIN, CAN, and RS-232. User Manual. Document version ( )

minimon Simple CAN Monitoring Tool for Windows

SAFETY MANUAL ENGLISH

Software Manual. DeviceNet-Module cananalyser3 Module for ODVA DeviceNet Protocol Interpretation

II/Generic. TCP/IP Gateway for CAN with Open Socket API MANUAL ENGLISH

Gryphon Hardware Information: LIN card

CAN-GW100/RS232. RS232-CAN Converter HARDWARE MANUAL ENGLISH

Conto D2 COMMUNICATION PROTOCOL CONTENTS 1.0 INTRODUCTION

JUMO Quantrol LC100/LC200/LC300

The RS-485 user manual for B800 series communication

AN433: CP2110/4 HID-to-UART API Specification

Ä.Dv'ä. L-force Controls. Industrial PC. Software Manual. L-force Controller 3241C - Backplane Bus. Programming Interface I/O-System 1000

JUMO ctron 04/08/16. Compact controller with timer and ramp function. B Interface Description Modbus /

ControlLogix Multi-Vendor Interface Module DH-485 API

User Application. HID to UART Library. HID Driver (Provided by OS) USB Root Hub USB. CP2114 USB Audio-I2S Digital Audio Bridge

FNL Modbus TCP Interface

History of Firmware Revisions. i-scan. Standard-Reader ID ISCLR200. SWRN ISCLR200 V5.04.doc

LMV2 / LMV3... Modbus. User Documentation. Building Technologies Division

PCAN-PassThru API. User Manual. Pass-Thru API and Connection of Pass-Thru Software to PEAK CAN Interfaces. Document version 1.1.

DataVU 5 - Interface Manual Modbus

B Interface description 12.01/

DataVU 5 - Interface Manual Modbus

CLD BF70x CDC Library v.1.3 Users Guide Users Guide Revision 1.3. For Use With Analog Devices ADSP-BF70x Series Processors. Closed Loop Design, LLC

celed LED Array Firmware Specification

4511 MODBUS RTU. Configuration Manual. HART transparent driver. No. 9107MCM102(1739) For 4511 devices from ser. no:

NOVOtechnik. Content. TIM CANopen Gebrauchsanleitung TIM CANopen user manual SIEDLE GRUPPE

COMMUNICATION MODBUS PROTOCOL

CLD SC58x CDC Library v.1.00 Users Guide Users Guide Revision For Use With Analog Devices ADSP-SC58x Series Processors. Closed Loop Design, LLC

CE4DMID01 COMMUNICATION PROTOCOL CONTENTS 1.0 INTRODUCTION

IF96017 MODBUS COMMUNICATION PROTOCOL

Hardware interface and protocol of data exchange with mobile beacon via USB, UART and SPI interfaces.

Kinetis Bootloader to Update Multiple Devices in a Field Bus Network

User Manual AnyBus Communicator for Profibus

Universal Configuration Manager

Manual. PLC Lib: Tc2_DMX. TwinCAT 3. Version: Date:

DELPHI CORPORATION. LIN to RS-232 Gateway Systems Analysis INterface Tool (SAINT) Users Guide

Wireless M-Bus Host Controller Interface DLL

HT32 Series In-System / In-Application Programmer User Manual

0.1. [0x8A] Read Configuration

Industrial-Automation System HIMatrix. MODBUS Master/Slave. Manual

NT 200/420. Communication in Gateway Setup SOFTWARE DESIGN GUIDE ENGLISH

Application Note. Introduction AN2471/D 3/2003. PC Master Software Communication Protocol Specification

X-gateway Interface Addendum DeviceNet Scanner Interface

AFRecorder 4800R Serial Port Programming Interface Description For Software Version 9.5 (Last Revision )

INSTRUCTION MANUAL ESI-Manager communication How to use RS485 USB Ethernet connections

2G Actuator Communications Protocol Document Rotary & Linear Actuators

Protocol of data exchange with modem via USB interface Version

ControlLogix Multi-Vendor Interface Module DF1 API

User Application. HID to UART Library. HID Driver (Provided by OS) USB Root Hub USB. CP2110 HID-UART Bridge

Panther Programmer USER MANUAL. Version 1.01 November, 2017

The I-7530A RS-232/485/422 to CAN Converter

I-7530 Series FAQ. ICP DAS Co., LTD 1

JUMO di 308. Digital Indicator. B Interface Description Modbus 12.07/

Profibus Gateway 3E V Technical Bulletin

Definition of PLR on the RS485-bus. Version 1.06

COMMUNICATION MODBUS PROTOCOL

Protocol VIT5. Communications RS485. Version 1.0. Pg.Up ENTER. Pg.Up ENTER. Pg.Up ENTER. Pg.Up ENTER. Pg.Up ENTER. Pg.Up ENTER. Pg.Up ENTER. Pg.

AN-881 APPLICATION NOTE

COMMON-ISDN-API. Version 2.0. Part II. 4 th Edition. Operating Systems

COMMUNICATION MODBUS PROTOCOL

CAN / RS485. Product Description. Technical Reference Note. Interface Adapter. Special Features

User Manual. R Series Encoders with CANopen Interface RNX HE 11 / 2005

Conto D1 MODBUS COMMUNICATION PROTOCOL

IO-Warrior Dynamic Library V1.5 for Windows

Lufkin Modbus Serial Driver Help Kepware Technologies

isma-b-mg-ip User Manual Global Control 5 Sp. z o.o. Poland, Warsaw

MODBUS APPLICATION PROTOCOL SPECIFICATION V1.1b3 CONTENTS

ACR122S. Serial NFC Reader. Application Programming Interface V2.03. Subject to change without prior notice.

Anybus. Safety Interface Guide

TOP Server 5 DNP Advanced Operations. Control Relay Output Block Commands

Anybus X-gateway. PROFIBUS Master Interface NETWORK GUIDE SCM EN 1.0 ENGLISH

CA Data Protection. External Agent COM API Reference Guide. Release 15.0

Embedded Simply Blue Application Note

CANopen Library User Manual

1.1 Errors and Event list

MODBUS APPLICATION PROTOCOL SPECIFICATION V1.1b3 CONTENTS

User Manual. K Series Encoders with CANopen Interface KXN FE 09 / 2005

Chapter 5: Communications 5 1 SR55 Communications Overview 5 2

User Module. Modbus TCP2RTU. Application note

VISY-Command. Technical Documentation. with Modbus Protocol. Edition: Version: 1 Art. no.:

4511 MODBUS RTU. Configuration Manual. Solenoid / alarm driver. No. 9203MCM100(1328)

Serial Communication Control Interface User s Manual

COMMUNICATION MODBUS PROTOCOL


Quickstart Manual. CANio 500. I/O-to-CAN Gateway. English

MOXA Sync Board API Programmer s Manual

Transponder Reader Family T4/T5

Transceiver IP Link Protocol rev.1

Logosol Joystick Node LS-731

Hello, and welcome to this presentation of the STM32 Universal Synchronous/Asynchronous Receiver/Transmitter Interface. It covers the main features

IO-Link Device Stack v1.1 API User Guide

NITGEN. Developer Guide. Version RS-232C serial protocol for Stand-Alone Fingerprint Recognition Device. Serial Protocol

E2 Modbus RTU Register Map Revision History Version Comments Author Date 1.02 Previous version PAE 11/06/ Revised to new format PAE 09/03/09

Data sheet Wireless UART firmware version 4

DeviceNet Interface User Manual

Transcription:

LIN2CAN API (L2CAPI) MANUAL ENGLISH

HMS Technology Center Ravensburg GmbH Helmut-Vetter-Straße 2 88213 Ravensburg Germany Tel.: +49 751 56146-0 Fax: +49 751 56146-29 Internet: www.hms-networks.de E-Mail: info-ravensburg@hms-networks.de Support For problems or support with this product or other HMS products please request support at www.ixxat.com/support. Further international support contacts can be found on our webpage www.ixxat.com Copyright Duplication (copying, printing, microfilm or other forms) and the electronic distribution of this document is only allowed with explicit permission of HMS Technology Center Ravensburg GmbH. HMS Technology Center Ravensburg GmbH reserves the right to change technical data without prior announcement. The general business conditions and the regulations of the license agreement do apply. All rights are reserved. Registered trademarks All trademarks mentioned in this document and where applicable third party registered are absolutely subject to the conditions of each valid label right and the rights of particular registered proprietor. The absence of identification of a trademark does not automatically mean that it is not protected by trademark law. Document number: 4.01.0130.20100 Version: 1.6

Content 1 Introduction... 5 2 LIN-CAN-RS232 Gateway API (L2CAPI)... 6 2.1 Basic ure... 6 2.2 Creating the API object... 6 2.3 Overview of interfaces... 7 2.4 Interface IUnknown... 8 2.5 Interface ILIN2CAN_API_Ctrl... 9 2.6 Interface ILIN2CAN_GeneralConfig2... 10 2.7 Interface ILIN2CAN_GatewayConfig2... 12 2.8 Interface ILIN2CAN_SlaveConfig... 14 2.9 Interface ILIN2CAN_MasterConfig2... 15 2.10 Interface ILIN2CAN_LINMsgQueue2... 16 2.10.1 Error overview... 17 2.11 Interface ILIN2CAN_Master_Slave2... 18 2.12 Overview: Permitted API calls / operation mode... 19 2.13 Brief overview of API... 20 2.13.1 Interface: ILIN2CAN_GeneralConfig2... 20 2.13.2 Interface: ILIN2CAN_GatewayConfig2... 22 2.13.3 Interface: ILIN2CAN_SlaveConfig... 23 2.13.4 Interface: ILIN2CAN_MasterConfig2... 23 2.13.5 Interface: ILIN2CAN_LINMsgQueue2... 24 2.13.6 Interface: ILIN2CAN_Master_Slave2... 25 2.13.7 Data type definitions... 26 3 L2C-API Manual, Version 1.6

Introduction 1 Introduction The LIN2CAN Gateway API (in short: L2CAPI) serves as an interface for the configuration and controlling of the LIN2CAN Gateway hardware and for the access to the LIN message traffic. All functions of the LIN2CAN device can be used in own programs with the LIN2CAN gateway API. Specific test applications or PC based network simulations can be realized. (For further information read the LIN2CAN Gateway manual.) The LIN2CAN device with the L2CAPI can be used as a developer platform. The functions are divided into function groups according to type of function or operation mode. 5 L2C-API Manual, Version 1.6

2 LIN-CAN-RS232 Gateway API (L2CAPI) 2.1 Basic ure The ure of the API is similar to that of a COM object. The API is sub-divided into interfaces and has a reference counter used for releasing the API. If an interface is requested, the counter is increased by one. If an interface is no longer required, it must be released with Release. If the counter reaches 0, the L2CAPI object is deleted. Each interface is derived from the interface IUnknown. This interface contains the methods QueryInterface, AddRef and Release. Every method of the API (except AddRef and Release) returns an HRESULT value as an error code. S_OK (0) stands for success. 2.2 Creating the API object The following files are required to be able to work with the API: L2CAPI.lib L2CAPI.dll L2CAPI.hpp The LIB file must be integrated in the program to be created. It loads the DLL file when the program is started. The methods of the API are defined in the HPP file. In addition, the line #define INITGUID must be contained in a CPP file of the project. This serves to provide memory space for the GUIDs (Global Unique Identifiers). Every interface of the API has one of these 128-bit IDs for unambiguous definition. First the API object must be created with L2CAPI_CreateInstance(). The hand-off parameters are the ID for the required interface and a pointer for the required interface. The call is as follows: HRESULT hresult = E_FAIL; IUnknown* piunknown = NULL; hresult = L2CAPI_CreateInstance(IID_IUnknown, (void**)&piunknown); If successful, every other interface of the API can now be called with this interface pointer. If unsuccessful, the error code can be converted into a readable string by calling L2CAPI_FormatError(). If the interface is no longer required, it is released again by the following call. if(piunknown!= NULL) piunknown->release(); piunknown = NULL; } A project example (L2CAPI_CONSOLE_APP) and a project template (L2CAPI_App- Template) is included for the easier beginning to implement an own application. 6 L2C-API Manual, Version 1.6

2.3 Overview of interfaces The API implements the following interfaces: ILIN2CAN_API_Ctrl Serves to connect the API with the device or to disconnect the connection and query the connection status. ILIN2CAN_GeneralConfig2 Serves to query or make the basic settings of the device such as name, LIN baud rate and startup operation. ILIN2CAN_GatewayConfig2 Serves to make the settings that are required for the gateway mode. These include the CAN baud rate and the CAN transceiver mode and the translation table for translating LIN to CAN objects and vice versa. ILIN2CAN_SlaveConfig Defines the response to a LIN identifier. ILIN2CAN_MasterConfig2 Defines the schedule table for the master operation mode. ILIN2CAN_LINMsgQueue2 Serves to read out messages from the LIN message queue and query their status. ILIN2CAN_Master_Slave2 With this interface it is possible to place LIN IDs and LIN objects on the LIN bus by PC call and to connect a wakeup signal to the BUS. The methods of the interfaces can only be called if the device is either in L2C_OP_MODE_SLAVE_PC or L2C_OP_MODE_MASTER_PC mode! 7 L2C-API Manual, Version 1.6

2.4 Interface IUnknown The interface provides the following methods: HRESULT QueryInterface([in] REFIID riid, [out] LPVOID *ppvobj) With QueryInterface, one of the interfaces listed in 2.3 can be queried. The call is the same as for L2CAPI_CreateInstance, the only difference being that here no new instance of the class is created, but a pointer of the required interfaces is returned. By calling QueryInterface, the reference counter is automatically increased by one. ULONG AddRef() AddRef increases the reference counter of the object by one. The return value is the new status of the reference counter. This method must be called if an interface pointer itself is cloned. ULONG Release() With Release, an interface that is no longer required is released again. The new reference counter status is returned. 8 L2C-API Manual, Version 1.6

2.5 Interface ILIN2CAN_API_Ctrl This interface provides the following methods: Connect([in] PCHAR pszname, [in] PCHAR pszmode) With Connect the API is connected to the device by the stated interface. The name of the interface to be used is given in pszname e.g. COM1 or COM2. In pszmode, baud=115200 parity=n data=8 stop=1 must always be transmitted. If the connection was made successfully, S_OK is returned, otherwise an error code that can be converted into a readable string with L2CAPI_FormatError(). Disconnect() With Disconnect the connection to the device is disconnected again. IsConnected() IsConnected is used to query whether the device is still connected. This function checks the status of the DSR line. In this way disconnection of the device can also be detected during operation. 9 L2C-API Manual, Version 1.6

2.6 Interface ILIN2CAN_GeneralConfig2 This interface implements the following methods: GetDeviceName([out] PSTRING psdevicename) SetDeviceName([in] PSTRING psdevicename) Get/SetDeviceName serves to give the device a name. 16 characters are permitted including \0. GetVersionInformation([out] PL2C_VersionInformation pversioninfo); GetVersionInformation queries the version information of the device. The ure is as follows: char strfirmwareversion[8]; char strhardwareversion[8]; }L2C_VersionInformation, *PL2C_VersionInformation; Each string is terminated with 0. GetLINBaudrate([out] PWORD pwbaudrate); SetLINBaudrate([in] WORD wbaudrate); Get/SetLINBaudrate defines the baud rate of the LIN bus. The following values are possible: 2400, 9600 and 19200 bauds. GetOperationMode([out] PL2C_OperationMode pnoperationmode); SetOperationMode([in] L2C_OperationMode noperationmode); Define the current operation mode of the device. The following modes are possible: L2C_OP_MODE_SLAVE_PC L2C_OP_MODE_MASTER_PC GetStartUpOpMode([out] PL2C_OperationMode pnoperationmode); SetStartUpOpMode ([in] L2C_OperationMode noperationmode); These functions define the startup behavior of the device if the serial cable is not connected to the PC. The following startup operation modes are permitted: L2C_OP_MODE_SLAVE L2C_OP_MODE_MASTER L2C_OP_MODE_GATEWAY_SLAVE L2C_OP_MODE_GATEWAY_MASTER GetStandbyTime([out] PWORD pwstandbytime); SetStandbyTime([in] WORD wstandbytime); Here it is possible to define after how much time (in seconds) without bus traffic the device switches to standby mode (LIN and CAN). If the device is connected to the PC, it always remains awake. If the value 0xFFFF is transmitted, the device never goes into standby mode. 10 L2C-API Manual, Version 1.6

GetSystemTime([out] PDWORD pdwsystemtime); SetSystemTime([in] DWORD dwsystemtime); These functions serve to set and query the system time of the device. The system time is a counter value in millisecond steps that is used for the timestamp of the LIN messages of the message queue. GetLinMessageConfig ([out] PL2C_MessageConfig pmsgconfig); SetLinMessageConfig ([in] PL2C_MessageConfig pmsgconfig); These functions set or query the length and CRC calculation mode of the LIN message packages. The ure is as follows: BYTE bmsglen[64]; L2C_MessageCrcType nmsgcrctype[64]; }L2C_MessageConfig, *PL2C_MessageConfig; LoadSettingsFromFlash(); This reads out the setting from the flash. Settings that are not saved are lost. SaveSettingsToFlash; With this the current settings are stored non-volatile in the flash. This applies to the settings of GeneralConfig without system time, GatewayConfig, SlaveConfig and MasterConfig. 11 L2C-API Manual, Version 1.6

2.7 Interface ILIN2CAN_GatewayConfig2 Here the following settings can be made: GetCANConfig([out] PL2C_CAN_Config pcanconfig); SetCANConfig([in] PL2C_CAN_Config pcanconfig); This defines the setting of the CAN controller. The following ure is used: DWORD dwbaudrate; L2C_CANTransceiverMode ntransceivermode; }L2C_CANConfig, *PL2C_CANConfig; The following baud rates in kilobauds are permitted: 10 20 50 100 125 250 500 1000 The CAN transceiver can be set to one of the following modes: L2C_CAN_TRANSCEIVER_LOWSPEED L2C_CAN_TRANSCEIVER_HIGHSPEED GetGatewayTranslation([out] PL2C_TranslationConfig2 ptranslationconfig2) SetGatewayTranslation([in] PL2C_TranslationConfig2 ptranslationconfig2) These two functions are used for the configuration of the translation table from LIN to CAN and vice versa. A CAN ID can be stored here for each LIN ID. The LIN ID corresponds to the index of IdentifierTranslation. In addition it is possible to send a LIN error on the CAN bus, to store a CAN ID that activates the gateway (data bytes of the CAN message not equal to 0) or deactivated (data bytes equal to 0) and to store a CAN ID that switches the active schedule table in gateway master mode (data byte 0 specifies the number of the schedule table). The following ure is used: 12 L2C-API Manual, Version 1.6

L2C_IdentifierTranslation stlin_identifiertranslation[64]; L2C_IdentifierTranslation stlin_errortranslation; L2C_IdentifierTranslation stgatewayactivation; L2C_IdentifierTranslation stscheduleswitching; }L2C_TranslationConfig2, *PL2C_TranslationConfig2; Each of the 66 entries has the following ure: BOOL bvalid; L2C_TranslationDirection ntranslationdir; BOOL b29bitidentifier; DWORD dwcanid; }L2C_IdentifierTranslation, *PL2C_IdentifierTranslation; With bvalid it is possible to define whether the entry is valid (TRUE for valid). ntranslationdir defines the direction of the translation: L2C_LIN_TO_CAN_TRANSLATION L2C_CAN_TO_LIN_TRANSLATION b29bitidentifier defines whether it is a 29Bit CAN ID (TRUE for 29bit). dwcanid defines the CAN identifier. Make sure, that a CAN ID is not assigned twice. 13 L2C-API Manual, Version 1.6

2.8 Interface ILIN2CAN_SlaveConfig This interface serves to configure the action table. The following methods are provided: GetLINIDAction([in/out] PL2C_ActionEntry pactionentry); SetLINIDAction([in] PL2C_ActionEntry pactionentry); The methods serve to query or set an entry of the action table. The following ure is used: BYTE blinid; L2C_LINIDAction naction; BYTE pbaddinfo[64]; BYTE baddinfolen; }L2C_ActionEntry, *PL2C_ActionEntry; blinid is always an [in] parameter, which defines for which LIN ID the action is set or queried. naction defines the action to be executed. The following settings are valid: L2C_CAN_ACTION_IGNORE L2C_CAN_ACTION_SEND_LINDATA If the action is set to Ignore, no AddInfo data may be sent. If Send_LINData is selected, the data to be sent must be present in AddInfo with suitable length according to the LIN ID. The length is transmitted in baddinfolen. 14 L2C-API Manual, Version 1.6

2.9 Interface ILIN2CAN_MasterConfig2 The Master Schedule table can be edited here. The following methods are available for this: GetScheduleTable([in] BYTE bnumberscheduletable, [out] PL2C_ScheduleEntry pscheduletable, [out] PBYTE pbnumberentries); SetScheduleTable([in] BYTE bnumberscheduletable, [in] PL2C_ScheduleEntry pscheduletable,[in] BYTE bnumberentries); The schedule table to read or to write is specified with bnumberscheduletable. The number of supported schedule tables can be retrieved by a call of GetScheduleTableCount. Up to 64 entries can be written in the schedule table. The following ure is used, which is transferred in a field. When fetching, the field must have 64 entries (L2C_MAX_SCHEDULETABLE_SIZE). pbnumberentries gives the number of entries that were present. When setting, the number of entries must correspond to the size of the field and there must not be more than 64 entries. BYTE blinid; BYTE bwaitingtime; } L2C_ScheduleEntry; GetScheduleTableCount([out] PBYTE pbscheduletablecount); With this method the number of schedule tables supported by the device can be queried. 15 L2C-API Manual, Version 1.6

2.10 Interface ILIN2CAN_LINMsgQueue2 This interface serves to access the LIN message queue. The following functions are provided: GetLINMsgQueueStatus([out] L2C_QueueStatus pqueuestatus); The status of the LIN queue can be queried here. BOOL boverrun; BYTE bqueuesize; BYTE busedentries; }L2C_QueueStatus, *PL2C_QueueStatus; If an overrun has occurred in the LIN message queue, boverrun is set to TRUE. The queue size is returned in bqueuesize and the currently used entries in busesentries. ResetLINMsgQueueOverrun(); The function must be called to reset the overrun status of the queue. GetLINMsgQueueEntry([out] PL2C_LINMessage plinmessage); The function must be called to read out a message. The following ure is filled: DWORD dwtimestamp; BYTE blinid; BYTE pbdata[8]; BYTE bdatalen; L2C_MessageCrcType nmsgcrctype; }L2C_LINMessage2, *PL2C_LINMessage2; dwtimestamp contains the receiving time of the LIN object in [ms]. The timestamp is based on the system time of the device, which overruns every 48 days. blinid contains the received LIN ID or 0x40 if it is an error code. pbdata together with bdatalen contain the LIN data and the length if it is a valid LIN message. nmsgcrctype contains the CRC type with which the LIN message was transmitted on the LIN network. If a LIN error has occurred, this is signaled by the ID 0x40. Any LIN ID received is then found in data byte 0 (otherwise 0xFF) and the error code in data byte 1. 16 L2C-API Manual, Version 1.6

2.10.1 Error overview data byte 1 data byte 2 Description FF 01 Received data is not a valid sync field. FF 02 Received data is not a valid ID field. FF 03 Only sync break detected before timeout. FF 04 Only sync break and sync field detected before timeout. LIN-ID 05 Only sync break, sync field and ID field detected before timeout. (Slave does not respond!) LIN-ID 06 Only sync break, sync field, ID field and at least one data byte detected before timeout. LIN-ID 07 Calculated checksum does not match the received checksum. If the LIN2CAN GW is operating in LIN Spec. 2.0 mode, this error may occur due data collision or invalid CRC mode setting. LIN-ID 08 Received data does not match the sent data. The error may occur due data collision in LIN Spec. 2.0 mode. FF 09 UART error, received byte does not match UART standard (e.g. StopBit missing). FF 0A Dominant level transmitted on the LIN BUS (Wakeup signal) FF 0B Dominant level received on the LIN BUS, but it is too short to be a sync-break. (Note: This error code is only available in slave operation mode after at least one valid sync break was received. If another error code was received before, this error code has no relevance.) 17 L2C-API Manual, Version 1.6

2.11 Interface ILIN2CAN_Master_Slave2 This interface enables a master emulation by PC. The following functions are provided: SendLINID([in] BYTE blinid); The function sends the specified LIN ID on the bus. The LIN ID must be between 0x00 and 0x3F. SendLINIDandData([in] PL2C_LINMessage2 plinmessage2); The function sends a complete LIN object to the bus. The ure is described in 2.10 GetLINMsgQueueEntry. The timestamp has no significance for the transmission. SendWakeup([in] BYTE bsignalduration); The function connects a dominant level to the LIN bus according to the specified time. The duration bsignalduration is given in [ms] between 1 and 255. 18 L2C-API Manual, Version 1.6

2.12 Overview: Permitted API calls / operation mode Function Operation mode Slave with PC Master with PC Slave Stand Alone Master Stand Alone GetDeviceName x x - - - - SetDeviceName x x - - - - GetVersionInformation x x - - - - GetLINBaudrate x x - - - - SetLINBaudrate x x - - - - GetOperationMode x x x x x x SetOperationMode x x - - - - GetStartUpOpMode x x - - - - SetStartUpOpMode x x - - - - GetStandbyTime x x - - - - SetStandbyTime x x - - - - GetSystemTime x x - - - - SetSystemTime x x - - - - GetLinMessageConfig x x - - - - SetLinMessageConfig x x - - - - LoadSettingsFromFlash x x - - - - SaveSettingsToFlash x x - - - - GetCANConfig x x - - - - SetCANConfig x x - - - - GetGatewayTranslation x x - - - - SetGatewayTranslation x x - - - - GetLINIDAction x x - - - - SetLINIDAction x x - - - - GetScheduleTable x x - - - - SetScheduleTable x x - - - - GetScheduleTableCount x x - - - - GetLINMsgQueueStatus x x - - - - ResetLINMsgQueueOverrun x x - - - - GetLINMsgQueueEntry x x - - - - SendLINID - x - - - - SendLINIDandData - x - - - - SendWakeup - x - - - - X Call permitted in this mode. - Call not permitted in this mode. Gateway Slave Gateway Slave 19 L2C-API Manual, Version 1.6

2.13 Brief overview of API All methods return an HRESULT error code S_OK in the event of success, otherwise a Windows error code 2.13.1 Interface: ILIN2CAN_GeneralConfig2 GetDeviceName([out] PSTRING psdevicename) Name of the device: pointer to a string with max. 16 characters. The last valid character is \0. SetDeviceName([in] PSTRING psdevicename) Name of the device: pointer to a string with max. 16 characters. The last valid character must be \0. GetVersionInformation([out] PL2C_VersionInformation pversioninfo); char strfirmwareversion[8]; char strhardwareversion[8]; }L2C_VersionInformation, *PL2C_VersionInformation; GetLINBaudrate([out] PWORD pwbaudrate); Baud rates: 2400, 9600, 19200 SetLINBaudrate([in] WORD wbaudrate); GetOperationMode([out] PL2C_OperationMode pnoperationmode); typedef BYTE L2C_OperationMode; #define L2C_OP_MODE_SLAVE_PC 1 #define L2C_OP_MODE_MASTER_PC 2 20 L2C-API Manual, Version 1.6

SetOperationMode([in] L2C_OperationMode noperationmode); GetStartUpOpMode([out] PL2C_OperationMode pnoperationmode); #define L2C_OP_MODE_SLAVE 4 #define L2C_OP_MODE_MASTER 5 #define L2C_OP_MODE_GATEWAY_SLAVE 3 #define L2C_OP_MODE_GATEWAY_MASTER 3 SetStartUpOpMode ([in] L2C_OperationMode noperationmode); GetStandbyTime([out] PWORD pwstandbytime); Resolution in [s] 0xFFFF for never SetStandbyTime([in] WORD wstandbytime); GetSystemTime([out] PDWORD pdwsystemtime); Time in [ms] SetSystemTime([in] DWORD dwsystemtime); GetLinMessageConfig([out] PL2C_MessageConfig pmsgconfig) BYTE bmsglen[64]; L2C_MessageCrcType nmsgcrctype[64]; }L2C_MessageConfig, *PL2C_MessageConfig; SetLinMessageConfig([in] PL2C_MessageConfig pmsgconfig) LoadSettingsFromFlash(); SaveSettingsToFlash; 21 L2C-API Manual, Version 1.6

2.13.2 Interface: ILIN2CAN_GatewayConfig2 GetCANConfig([out] PL2C_CAN_Config pcanconfig); DWORD dwbaudrate; L2C_CANTransceiverMode ntransceivermode; }L2C_CANConfig; CAN transceiver baud rate 10, 20, 50, 100, 125, 250, 500, 1000 CAN transceiver modes #define L2C_CAN_TRANSCEIVER_LOWSPEED 0 #define L2C_CAN_TRANSCEIVER_HIGHSPEED 1 SetCANConfig([in] PL2C_CAN_Config pcanconfig); GetGatewayTranslation([out] PL2C_TranslationConfig2 ptranslationconfig2) L2C_IdentifierTranslation stlin_identifiertranslation[64]; L2C_IdentifierTranslation stlin_errortranslation; L2C_IdentifierTranslation stgatewayactivation; L2C_MessageCrcType nmsgcrctype; }L2C_TranslationConfig2, *PL2C_TranslationConfig2; BOOL bvalid; L2C_TranslationDirection ntranslationdir; BOOL b29bitidentifier; DWORD dwcanid; }L2C_IdentifierTranslation, *PL2C_IdentifierTranslation; SetGatewayTranslation([in] PL2C_TranslationConfig2 ptranslationconfig2) 22 L2C-API Manual, Version 1.6

2.13.3 Interface: ILIN2CAN_SlaveConfig GetLINIDAction([in/out] PL2C_ActionEntry pactionentry); [in] pactionentry->blinid [out] remaining BYTE blinid; L2C_LINIDAction naction; BYTE pbaddinfo[64]; BYTE baddinfolen; }L2C_ActionEntry; //*** Slave Mode (Standalone) LIN ID Actions #define L2C_CAN_ACTION_IGNORE 4 #define L2C_CAN_ACTION_SEND_LINDATA 5 SetLINIDAction([in] PL2C_ActionEntry pactionentry); 2.13.4 Interface: ILIN2CAN_MasterConfig2 GetScheduleTable([out] PL2C_ScheduleEntry pscheduletable, [out] PBYTE pbnumberentries); BYTE blinid; BYTE bwaitingtime; } L2C_ScheduleEntry; pbnumberentries out number of entries in the schedule table //*** Master Mode (Standalone) Schedule Table Size #define L2C_MAX_SCHEDULETABLE_SIZE 64 SetScheduleTable([in] PL2C_ScheduleEntry pscheduletable, [in] BYTE bnumberentries); GetScheduleTableCount ([out] PBYTE pbscheduletablecount); 23 L2C-API Manual, Version 1.6

2.13.5 Interface: ILIN2CAN_LINMsgQueue2 LIN-CAN-RS232 Gateway API (L2CAPI) GetLINMsgQueueStatus([out] L2C_QueueStatus pqueue- Status); BOOL boverrun; BYTE bqueuesize; BYTE busedentries; }L2C_QueueStatus; ResetLINMsgQueueOverrun(); GetLINMsgQueueEntry([out] PL2C_LINMessage2 plin- Message2); DWORD dwtimestamp; BYTE blinid; BYTE pbdata[8]; BYTE bdatalen; L2C_MessageCrcType nmsgcrctype; }L2C_LINMessage2, *PL2C_LINMessage2; If a LIN error has occurred, this is signaled by the ID 0x40. Any LIN ID received is then found in data byte 0 (otherwise 0xFF) and the error code in data byte 1. 24 L2C-API Manual, Version 1.6

2.13.6 Interface: ILIN2CAN_Master_Slave2 LIN-CAN-RS232 Gateway API (L2CAPI) SendLINID([in] BYTE blinid); blinid LIN ID between 0x00 and 0x3F SendLINIDandData([in] PL2C_LINMessage2 plinmessage2); plinmessage dwtimestamp not used SendWakeup([in] BYTE bsignalduration); bsignalduration Duration of the wakeup signals in [ms], value between 1 and 255 25 L2C-API Manual, Version 1.6

2.13.7 Data type definitions /***************************************************************************** ** constants and macros *****************************************************************************/ //*** Define LIN2CAN Error Facility Code #define L2C_ERROR_FACILITY 0xE0670000 //*** max lenght of an error string #define L2C_MAX_ERRORSTR 256 //*** LIN Message CRC Types #define L2C_MSG_CRC_TYPE_DEFAULT 0 #define L2C_MSG_CRC_TYPE_SPEC_1_3 1 #define L2C_MSG_CRC_TYPE_SPEC_2_0 2 //*** Operation Modes #define L2C_OP_MODE_SLAVE_PC 1 #define L2C_OP_MODE_MASTER_PC 2 #define L2C_OP_MODE_SLAVE 4 #define L2C_OP_MODE_MASTER 5 #define L2C_OP_MODE_GATEWAY_SLAVE 3 #define L2C_OP_MODE_GATEWAY_MASTER 6 //*** Gateway Mode (Standalone) CAN Transceiver Modes #define L2C_CAN_TRANSCEIVER_LOWSPEED 0 #define L2C_CAN_TRANSCEIVER_HIGHSPEED 1 //*** Gateway Mode Translation Direction #define L2C_LIN_TO_CAN_TRANSLATION 0 #define L2C_CAN_TO_LIN_TRANSLATION 1 //*** Slave Mode (Standalone) LIN ID Actions #define L2C_LIN_ACTION_IGNORE 4 #define L2C_LIN_ACTION_SEND_LINDATA 5 //*** Master Mode (Standalone) Schedule Table Size #define L2C_MAX_SCHEDULETABLE_SIZE 64 /***************************************************************************** ** s and types *****************************************************************************/ //*** LIN Message CRC type typedef BYTE L2C_MessageCrcType, *PL2C_MessageCrcType; //*** Operation Mode type typedef BYTE L2C_OperationMode, *PL2C_OperationMode; //*** Gateway Mode (Standalone) Transceiver Mode type typedef BYTE L2C_CANTransceiverMode, *PL2C_CANTransceiverMode; //*** Gateway Translation Mode typedef BYTE L2C_TranslationDirection, *PL2C_TranslationDirection; //*** Slave Mode (Standalone) Action type typedef BYTE L2C_LINID_Action, *PL2C_LINID_Action; 26 L2C-API Manual, Version 1.6

//*** Version Information Structure typedef char strfirmwareversion[8]; //Firmware Version String char strhardwareversion[8]; //Hardware Version String }L2C_VersionInformation, *PL2C_VersionInformation; //*** LIN Message Config typedef BYTE bmsglen[64]; //LIN Data Length: 0-8 Bytes L2C_MessageCrcType nmsgcrctype[64]; //LIN CRC calculation type }L2C_MessageConfig, *PL2C_MessageConfig; //*** Gateway Mode (Standalone) CAN Controller Configuration Structure typedef DWORD dwbaudrate; //CAN Baudrate in [kbaud] L2C_CANTransceiverMode ntransceivermode; //Mode of CAN Transceiver //(High or Lowspeed) }L2C_CANConfig, *PL2C_CAN_Config; //*** Gateway Mode (Standalone) Identifier Translation typedef BOOL bvalid; //Translation valid? (Valid = TRUE) L2C_TranslationDirection ntranslationdir; //Translation Direction (LIN 2 CAN CAN 2 LIN) //only valid for LIN Identifier Translation BOOL b29bitidentifier; //Is CAN ID a 29 Bit Identifier // (29bit = TRUE) DWORD dwcanid; //CAN ID (0-2047 [11bit]) // (0-536870911 [29bit]) }L2C_IdentifierTranslation, *PL2C_IdentifierTranslation; 27 L2C-API Manual, Version 1.6

//*** Gateway Mode (Standalone) Translation Configuration typedef L2C_IdentifierTranslation stlin_identifiertranslation[64]; //Field for Identifier Translation //(LIN ID = Index) L2C_IdentifierTranslation stlin_errortranslation; //LIN Error to CAN ID Translation L2C_IdentifierTranslation stgatewayactivation; //Gateway Activation CAN ID L2C_IdentifierTranslation stscheduleswitching; //Master Schedule table switching CAN ID }L2C_TranslationConfig2, *PL2C_TranslationConfig2; //*** Slave Mode (Standalone) LINID Action Table entry Structure typedef BYTE blinid; //LIN ID (0-63) L2C_LINID_Action naction; BYTE //Action to perform on LINID pbaddinfo[64]; //Additional Info for Action //LIN Data for instance BYTE baddinfolen; //Length of pbaddinfo }L2C_ActionEntry, *PL2C_ActionEntry; //*** Master Mode (Standalone) Schedule Table entry Structure typedef BYTE blinid; //LIN ID (0-63) BYTE bwaitingtime; //Time to wait before sending the next LIN Identifier }L2C_ScheduleEntry, *PL2C_ScheduleEntry; //*** Slave Mode (with PC) Queue Status Structure typedef BOOL boverrun; //Indicates a LIN Queue Overrun (TRUE = Overrun) BYTE bqueuesize; //Size of the LIN Message Queue BYTE busedentries; //Used Entries of the LIN Message Queue }L2C_QueueStatus, *PL2C_QueueStatus; //*** Master / Slave Mode (with PC) LIN Message Structure typedef DWORD dwtimestamp; //Timestamp of LIN Message in [ms] BYTE blinid; //LIN ID (0-63) LIN Error (64) BYTE pbdata[8]; //LIN Data BYTE bdatalen; //Length of pbdata L2C_MessageCrcType nmsgcrctype; //LIN CRC calculation type }L2C_LINMessage2, *PL2C_LINMessage2; 28 L2C-API Manual, Version 1.6

//*** Error List Lookup Table Structure typedef BOOL fidvalid; //Flag if ID is valid BYTE berrorcode; //Error Code char strerrormessage[512]; //Human readable error string }L2C_LINErrorLookupTable, *PL2C_LINErrorLookupTable; //*** Error List Lookup Table Structure #define L2C_LIN_ERROR_LOOKUP_TABLE_ENTRY_COUNT 12 const L2C_LINErrorLookupTable L2C_k_stLINErrorLookupTable[L2C_LIN_ERROR_LOOKUP_TABLE_ENTRY_COUNT] = FALSE, 0x00, "" }, FALSE, 0x01, "Received data is not a valid sync-field." }, FALSE, 0x02, "Received data is not a valid ID-field." }, FALSE, 0x03, "Only sync-break detected before timeout." }, FALSE, 0x04, "Only sync-break and sync-field detected before timeout." }, TRUE, 0x05, "Only sync-break, sync-field and ID-field detected before timeout. (Slave does not respond!)" }, TRUE, 0x06, "Only sync-break, sync-field, ID-field and at least one data byte detected before timeout." }, 29 L2C-API Manual, Version 1.6

TRUE, 0x07, "The calculated checksum does not match the received checksum. If the LIN2CAN GW is operating in LIN Spec. 2.0 mode, this error may occur due data collision or invalid CRC mode setting." }, TRUE, 0x08, "The received data does not match the sent data. this error may occur due data collision in LIN Spec. 2.0 mode." }, FALSE, 0x09, "UART error, received byte was not like UART standard (\"StopBit missing\" for instance)." }, FALSE, 0x0A, "A dominant level was transmitted on the LIN BUS. (Wakeup signal)" }, FALSE, 0x0B, "A dominant level was received on the LIN BUS, but it was to short to be a sync-break. (Note: This error code is only available in slave operation mode after at least one valid sync-break was received. If an other error code was received before, this error code has no relevance.)" } }; 30 L2C-API Manual, Version 1.6

/***************************************************************************** ** LIN Error (LIN ID 0x40) ** ** An Error is signaled if blinid is set to 0x40 ** The LIN ID of the error message (if available) is stored in pbdata[0] ** else it is 0xFF, while the errorcode is stored in pbdata[1] ** ** Error Overview! ** - 0x01 Received data is not a valid sync-field. ** - 0x02 Received data is not a valid ID-field. ** - 0x03 Only sync-break detected before timeout. ** - 0x04 Only sync-break and sync-field detected before timeout. ** - 0x05 Only sync-break, sync-field and ID-field detected before timeout. ** (Slave does not respond!) ** - 0x06 Only sync-break, sync-field, ID-field and at least one data byte ** detected before timeout. ** - 0x07 The calculated checksum does not match the received checksum. ** If the LIN2CAN GW is operating in LIN Spec. 2.0 mode, this error ** may occur due data collision or invalid CRC mode setting. ** - 0x08 The received data does not match the sent data. this error may ** occurre due data colission in LIN Spec. 2.0 mode. ** - 0x09 UART error, received byte was not like UART standard ** ("StopBit missing" for instance). ** - 0x0A A dominant level was transmitted on the LIN BUS. (Wakeup signal) ** - 0x0B A dominant level was received on the LIN BUS, but it was to short ** to be a sync-break. ** (Note: This error code is only available in slave operation ** mode after at least one valid syncbreak was received. If an other ** error code was received before, this error code has no relevance.) *****************************************************************************/ 31 L2C-API Manual, Version 1.6