Home

dearborn protocol adapter family user`s manual

image

Contents

1. unsigned char bRequestBuffer 8 MailBoxType RequestHandle NULL load Receive MailBox for request memset amp LoadMailBoxData 0 sizeof LoadMailBoxType oadMailBoxData bProtocol eJ1939 oadMailBoxData bRemote Data eRemoteMailBox oadMailBoxData bBitlidentSize 29 oadMailBoxData bTransportType eTransportNone oadMailBoxData dwMailBoxIdent 0x00001234L oadMailBoxData dwMailBoxIdentMask 0x0000ffffL oadMailBoxData bTransparentUpdateEnable FALSE oadMailBoxData bTimeStampInhibit FALSE ijoadMailBoxData bIDInhibit FALSE oadMailBoxData wDataCount 8 oadMailBoxData pfApplicationRoutine NULL oadMailBoxData vpData bRequestBuffer oadMailBoxStatus LoadMailBox dpaHandle amp LoadMailBoxData if LoadMailBoxStatus eNoError RequestHandle LoadMailBoxData pMailBoxHandle if RequestHandle NULL ReceiveMailBoxStatus ReceiveMailBox dpaHandle RequestHandle unload mailbox now that we are done UnloadMailBoxStatus UnloadMailBox RequestHandle RequestHandle NULL 57 DPA FAMILY USER S MANUAL 2004 Example 4 This example illustrates the creating of a mailbox used to transmit on command using only the TransmitMailBox function include lt windows h gt include dpam32 h void TestLoadMailBox short dpaHandle LoadMailBoxType LoadMailBoxData ReturnStatusType LoadMailBoxStatus Transmi
2. oadMailBoxData bProtocol eJ1939 oadMailBoxData bRemote Data eRemoteMailBox oadMailBoxData bBitldentSize 29 oadMailBoxData bTransportType eTransportNone oadMailBoxData dwMailBoxIdent 0x00001234L ioadMailBoxData dwMailBoxIdentMask 0x00000000L oadMailBoxData bTransparentUpdateEnable TRUE oadMailBoxData bTimeStamplnhibit FALSE ijoadMailBoxData bIDInhibit FALSE oadMailBoxData wDataCount 8 oadMailBoxData pfApplicationRoutine NULL oadMailBoxData vpData TransUpdateDataBuffer oadMailBoxStatus LoadMailBox dpaHandle amp LoadMailBoxData if LoadMailBoxStatus eNoError TransUpdateHandle LoadMailBoxData pMailBoxHandle save the point er to the new mailbox for fu unload mailbox now that we are done ture loading UnloadMailBoxStatus UnloadMailBox dpaHandle TransUpdateHandle TransUpdateHandle NULL 55 DPA FAMILY USER S MANUAL 2004 Example 2 This example illustrates the creation of a Receive mailbox using a callback routine include lt windows h gt include dpam32 h unsigned char bCallBackBuffer 8 void CALLBACK CallBackRoutine MailBoxType Handle Copy data memcpy Handle gt vpData Handle gt bData Handle gt wDataCount void TestLoadMailBox short dpaHandle LoadMailBoxType oadMailBoxData ReturnStatusType oadMailBoxStatus UnloadMailBoxStatus MailBoxTy
3. If CommLink was successful then check DataLink i e if InitCommStatus eNoError Select protocol No Error Callback No CAN TX Callback No CAN Receive Callback Set Baud 29 bit preferred InitDataLink dpaHandle amp InitDataLinkData InitDataLinkType InitDataLinkData ReturnStatusType InitDataLinkStatus InitDataLinkData bProtocol eJ1939 InitDataLinkData pfDataLinkError NULL InitDataLinkData pfTransmitVector NULL InitDataLinkData pfReceiveVector NULL InitDataLinkData bParam0 0x41 InitDataLinkData bParaml 0x58 InitDataLinkData bParam2 0x00 InitDataLinkStatus process the returned status switch InitDataLinkStatus 43 DPA FAMILY USER S MANUAL case eNoError MessageBox NULL DataLink successfully initialized InitDataLink MB OK break case eDeviceTimeout MessageBox NULL DataLink not responding InitDataLink MB OK break case eProtocolNotSupported MessageBox NULL Requested protocol is not supported InitDataLink MB OK break case eSyncCommandNotAllowed Example 2 MessageBox NULL Cannot call from within a callback ISR InitDataLink MB OK break Initializing the J1708 Data link to 9600 baud include lt windows h gt include lt st dio h gt include dpam32 h void DisplayInitDataLink short dpaHandle InitDataLinkType InitDataLinkData
4. A Defines Number of mailboxes define NumberOfCANMailBoxs 16 define NumberOfJ1708MailBoxs 32 max size of data buffer for mailbox define MAILBOX BUFFER SIZE 2048 define MAILBOX J1939 BUFFER SIZE 1785 define MAX TRANSFER SIZE 2000 define MaxBufferSize 2048 Maximum size of check data link string define MAX CHECKDATALINK SIZE 80 ifndef CALLBACK define CALLBACK huge pascal endif Update transmit mailbox flag parameter definitions define UPDATE DATA LOCATION 0x80 A update data location define TRANSMIT IMMEDIATE Ox40 transmit immediately Zdefine UPDATE DATA COUNT 0x20 update data count Zdefine UPDATE BROADCAST TIME 0x10 update broadcast time define UPDATE BROADCAST COUNT 0x08 update broadcast count define UPDATE TIME STAMP 0x04 update time define UPDATE ID 0x02 update ID MID PID Priority 111 DPA FAMILY USER S MANUAL 2004 define UPDATE DATA 0x01 update data Inhibit flags define TimeStamp Inhibit 0x20 define ID_ Inhibit 0x40 define Data_Inhibit 0x80 Update mailbox flag definitions define UPDATE DATA LOCATION 0x80 update data location define TRANSMIT IMMEDIATE 0x40 transmit immediatly define UPDATE DATA COUNT 0x20 update data count define UPDATE BROADCAST TIME 0x10 update broadcast time Zdefine UPDATE BROADCAST COUNT 0x08 update broadcast count Zdefine UPDATE TIME STAMP 0x04 update time Zdefine UPDATE ID 0x02 update ID MID PID Pri
5. 2 5 4 Installing the ISA card Once you have configured the resources and settings for your DPA power down the PC Locate an available ISA slot and insert the adapter Once the adapter is installed in the PC you must install the appropriate drivers as described in the following section 2 5 5 Checking communication Check to see that the DPA is communicating with the PC by running the CHECKDPA EXE utility once the DPA drivers have been installed as described in section 2 2 This utility is installed along with the drivers and will prompt you for information about your DPA Answer the questions presented and if the DPA is working properly the application will report information about the DPA 2 6 PC 104 hardware The DPA PC 104 requires the following hardware for operation e AT compatible computer or higher e Free PC 104 Bus Slot e Interrupt 5 7 or 10 available e UO Address Range 200 220 300 or 320 available Before installing the DPA PC 104 card it is important to check your PC s current configuration to identify an unused IRQ and address region In Windows 95 or Windows 98 you may identify these regions using the device manager in Windows NT you may check the current configuration using the WINMSD EXE program 11 DPA FAMILY USER S MANUAL 2004 2 6 1 Setting the jumpers The DPA III PC 104 card uses jumpers to set the resources IRQ and Base Address that the adapter will use The DPA supports four base address
6. RET 0 OK RET 1 TIME OUT COMMAND Action 98 DPA FAMILY USER S MANUAL 2004 This command shall set communication parameters in the network adapter This command does not result in a KWP message The AddrPresenceByte parameter shall configure the Header field of KWP messages sent from network adapter via the SEND_MESSAGE and STOP_COMMUNICATION command The first two most significant bits of the Format byte and the presence of the address bytes in the Header field shall be configured according to ISO 14230 2 definition is also repeated in the details section below Valid Values for this parameter are limited to the values listed below Note The Key Bytes returned from the ECU in the StartCommunication Positive Response Message shall override this setting UNLESS the returned key byte value is Ox8FDO according to ISO14230 2 section 5 2 4 1 Ox8FDO indicates the ECU is not driving the header field values This parameter setting shall not affect the StartCommunication KWP message sent via the START COMMUNICATION API command as the address bytes are always required for this message according to ISO 14230 2 Valid AddrPresenceByte Values ADDRPRESENCEBYTE MODE No address information with address information physical addressing with address information functional addressing The TargetAddress and SourceAddress parameters shall be used by the network adapter in Header fields as appropriate Default Values Parameter
7. 0 then the additional length byte is included ADDRPRESENCEBYTE TABLE ADDRPRESENCEBYTE _ MODE o O 0 No address information 1 lol 2 with address information physical addressing with address information functional addressing 100 DPA FAMILY USER S MANUAL 2004 Use of Header bytes len Data bytes 9 Checksum H _ 4 Checksum calculation gt 4 1 byte gt Header without address Information no additional length byte Data bytes 4 Checksum Checksum calculation 4 1 byte gt Header without address Information additional length byte Data bytes 9 Checksum Checksum calculation 1 byte gt Header with address Information no additional length byte Data bytes Checksum Checksum calculation gt 1 byte Header with address Information additional length byte Format byte Sid Service identification Byte Target address optional Data depending on service Source address optional CS Checksum byte additional lenath bvte optional 4 5 6 SET BAUDRATE API Example RET SET BAUDRATE LONG BaudRate RET 0 gt OK RET 1 TIME OUT COMMAND 101 DPA FAMILY USER
8. J1708 media attachment all DPAs The J1708 interface is connected as specified by the SAE J1708 document The connections are referenced as ATA and ATA ALDL GM UART media attachment select DPAs The GM UART connections follow the GM ALDL standard The DPA normally operates in slave mode but Master mode can be selected by connecting a jumper between Master Slave 1 and Master Slave 2 pins on the connector See Appendix D for pinouts J1850 VPW Class 2 DCX media attachment select DPAs The J1850 VPW connection is made with a connection for J1850 The ground on the DPA should be tied to the ground on both the power supply and the network For J1850 VPW a Motorola SBCC controller is used with connection provided via J1850 and J1850 See Appendix D for pinouts DPA FAMILY USER S MANUAL 2004 J1850 PWM SCP media attachment select DPAs For J1850 PWM a Motorola SBCC controller is used with connection provided via J1850 and J1850 No termination is provided on the DPA but an optional endplate with 360 ohm termination resistors is available from Dearborn Group See Appendix D for pinouts ISO 9141 KWP2000 media attachment select DPAs K line is connected on all DPAs with L line available on select versions See Appendix D for pinouts ATEC media attachment select DPAs ATEC connection follow the standard with ATEC Diag and ATEC Data provided on the connector See Appendix D for pinouts 2 4 RS 232 H
9. and CAN Bit Timing Registers Appendix C Driver Summary Appendix D Connector Pinouts 12 Technical support In the U S technical support representatives are available to answer your questions between 9 a m and 5 p m EST You may also fax or e mail your questions to us Please include your voice telephone number for prompt assistance Non U S users may want to contact their local representatives FN Call us for technical support DPA FAMILY USER S MANUAL 2004 Phone 248 488 2080 Fax 248 488 2082 E mail techsupp dgtech com Web site http www dgtech com 1 3 Related documents The following product publications can be accessed through their respective authors as indicated below Intel 800 628 8686 87C196CA 87C196CB 20 MHz Advanced 16 Bit CHMOS Document 272405 Microcontroller with Integrated CAN 2 0 data sheet 82527 Serial Communications Controller Architectural Philips IPCA82C250 CAN Controller Interface data sheet Data Book IC20 Society of Automotive Engineers 877 606 7323 Recommended Practice for a Serial Control and 1939 Communication Vehicle Network Recommended Practice 1708 Recommended Practice 1587 Recommended Practice 1850 DPA FAMILY USER S MANUAL International Standards Organization 41 22 749 01 11 oad Vehicles Interchange of Digital Information Controller Area Network for high speed communications Amendment 1 Technology and Maintenance Council
10. argetAddress SourceAddress AddrPresenceByte Default Value Ox00 O no addr info It could be set by our application with SET COM PARAMETER 2 API 99 DPA FAMILY USER S MANUAL 2004 Detail This note describes the structure of a message This information is taken from and complies with ISO 14230 2 The message structure consists of three parts e Header e Data bytes e Checksum Header Data bytes Checksum Max 4 byte max 255 bytes 1 byte Bytes are optional depending on the format byte Service identification part of data bytes Header The header consists of maximum 4 bytes A format byte includes information about the form of the message Target and source address bytes are optional for use with multi node connections An optional separate length byte allows message lengths up to 255 bytes The different ways of using header bytes is shown in the figure below Format Byte The format byte contains 6 bit length information and 2 bit address mode information The tester is informed about use of header bytes by the key bytes in the StartCommunication positive response message A Ay define the form of the header which will be used by the message see below L L define the length of a message from the beginning of the data field service identification byte included to the checksum byte not included A message length of 1 to 63 bytes is possible If L to L
11. the following ReturnStatusType messages may appear eDeviceTimeout Example This example initializes a USB DPA at full speed include windows h include lt stdio h gt include dpam32 h void main void short dpaHandle USBLinkType USBLinkData ReturnStatusType InitUSBStatus 108 DPA FAMILY USER S MANUAL 2004 ReturnStatusType RestoreUSBStatus USBLinkData wInterface 0 USBLinkData bHS_FS eFullSpeeg InitUSBStatus InitUSBLink amp dpaHandle amp USBLinkData 109 DPA FAMILY USER S MANUAL 2004 5 0 VSI Emulation The DPA III Plus V features a VSI Vehicle Serial Interface emulator and has the ability to act like a VSI box and can be used to run VSI legacy software both old and new This tool features a pass through mode that allows the DPA to emulate the VSI box In addition to VSI support the DPA III Plus V also can support CAN and J1708 channels and can be operated on MS DOS Windows 95 98 ME 2000 and NT For further instruction on the VSI programs and capabilities please consult the Vehicle Serial Interface for Class 2 manual Note When in the VSI mode earlier releases of DPA VSI allowed the use of a subset of DPA commands With current and future releases no DPA functions are possible when in the VSI mode 110 DPA FAMILY USER S MANUAL 2004 Appendix A DEFINES AND STRUCTURES Dearborn Group Copyright c 1999 vi Dearborn Protocol Adapter W
12. void ReadAppIDIOBuffer short dpaHandle unsigned char AppID int iLength void ReadDPABuffer dpaHandle ucAppID iLength 21 69 DPA FAMILY USER S MANUAL 2004 4 4 15 ReadDPAChecksum Function Returns the value of the DPA checksum for software verification of changes or corruption Syntax ReturnStatusType ReadDPAChecksum short dpaHandle unsigned int varname Prototype dpaml6 or dpam32 h Remarks ReadDPAChecksum checks the DPA checksum value for any corruption of the DPA Flash memory The memory can become corrupted when the Flash memory fades is improperly programmed or is physically damaged ReadDPAChecksum returns the checksum and puts it in varname a user defined variable Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommLink InitPCCard InitUSBLink or InitDPA varname User defined variable where checksum is copied to Return Value ReadDPAChecksum returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout Example The following code demonstrates one example of how the ReadDPAChecksum function may be used The variable uiChecksum can represent anything you wish void TestFlash short dpaHandle ReturnStatusType status unsigned int uiChecksum status DPAReadDPAChecksum dpaHandle amp uiChecksum i
13. 119 DPA FAMILY USER S MANUAL 2004 eJ1708 J1708 eJ1850 J1850 eJ1939 J1939 eCAN CAN bActive Active or in use flag Loaded when mailbox is active cleared when mailbox inactive bFilterType Pass or Block filtering ePass Send data up eBlock Block data bMailBoxDirectionData Used to identify mailbox direction either transmit or receive bTransportType Type of transport to use eTransportNone No Transport Layer eTransportBAM Use Broadcast Announcement Message eTransportRTS Use Request to Send bTimeAbsolute Flag for setting the timestamp function to absolute or relative time TRUE absolute FALSE relative pfApplicationRoutine Address of callback routine NULL disables pfMailBoxReleased Address of callback routine NULL disables dwTimeStamp Time a message is received dwTransmitTimeStamp Time a message is transmitted dwBroadcastTime Specifies the time interval between broadcast messages iBroadcastCount Specifies the number of times a broadcast message is to be sent wDataCount Number of bytes per message maximum of MAILBOX BUFFER SIZE bytes bData MAILBOX BUFFER SIZE Temporary holding buffer for message data bTransparentUpdateEnable Flag for enabling a transparent update bTimeStampInhibit Flag for removing timestamp from a receive data message bIDInhibit Flag to remove the mailbox identifier in a received data message bDataCountInhibit Flag for removing da
14. 200 220 300 or 320 available Before installing the DPA ISA card it is important to check your PC s current configuration to identify an unused IRQ and address region In Windows 95 or Windows 98 you may identify these regions using the device manager in Windows NT you may check the current configuration using the WINMSD EXE program 2 5 2 Setting the jumpers The DPA III ISA card uses jumpers to set the resources IRQ and Base Address that the adapter will use The DPA supports four base address choices and three IRQ selections as defined in the following charts This information is also printed on the adapter itself for simple configuration JP5 IRQ ADDRI ADDR2 Base Address 5 default O O 0x200 default 7 O C 0x220 10 C O 0x300 C C 0x320 Plug and play support is not yet available leave the PNP jumper intact 2 5 3 Power network connection to the DPA III ISA The pinout for the ISA card s DB15 connector is as follows 5 J1850 BUS O Ground CAN SHIELD 5 6 10 DPA FAMILY USER S MANUAL 2004 Data link Power optional Data link Ground optional GM_UART Master Select B Reserved Reserved E To make this GM UART node a master jumper pin 2 to pin 10 in the connector To terminate the CAN link with a 120 ohm resister jumper pin 3 to pin 4 in the connector See section 2 3 for more information about these protocols and their physical connections
15. 2004 Driver installation The DPA drivers are provided on the Installation CD The DPA drivers are installed by inserting the disk into your PC s CD rom drive Using Windows Explorer navigate to the DPAS amp xx Drivers folder and select and open run the file named dgdpa exe Follow the instructions on the screen There are currently six driver interfaces delivered with the DPA consult the guidelines in Appendix C to determine which driver should be used 23 Power network connections Power and network connections are made through a female DP15 connector There are several connector styles please consult your DPA endplate and reference Appendix D for a list of all connector pinouts The following is a list protocols supported Power and Ground Attachment all DPAs A power supply of 9 32 V capable of supplying a minimum of 250 mA must be connected to the DPA The ground on the DPA should be tied to the ground on both the power supply and the network Often these connections are provided on the same connector as the network See Appendix D for pinouts CAN J1939 media attachment all DPAs CAN connections CANH and CANL are connected through the on board Philips 82C251 transceiver The CAN shield is also provided with an RC filter A termination resistor of 120 ohms may be added to the CAN link through the placement of a jumper between pins on the DB 15 connector See pinouts in Appendix D CAN Term 1 and CAN Term 2
16. Example 2 Retrieves data last received in a J1708 mailbox specified by the mailbox handle J1708ReceiveHandle if J1708ReceiveHandle NULL amp amp J1708ReceiveHandle gt bActive 0 void ReceiveMailBox dpaHandle J1708ReceiveHandle 72 DPA FAMILY USER S MANUAL 2004 4 4 17 ResetDPA Function Resets the DPA based upon the parameter passed Syntax ReturnStatusType ResetDPA short dpaHandle ResetType ResetData Prototype dpaml6 h or dpam32 h Remarks ResetDPA is used to command a low level reset of the DPA It can be used to perform a full reset of the hardware or a communications only reset Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA The ResetType are as follows typedef enum eFullReset eCommReset eResetType eFullReset Reset the entire DPA this has the same effect as a power cycle eCommReset Reset only the communication port Return Value ResetDPA returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout Example include windows h include lt stdio h gt include dpam32 h void main void Comm LinkType CommLinkData ReturnStatusType InitCommStatus RestoreCommStatus ReturnStatusType ResetStatus Rese Shor C
17. Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA MailBoxType Structure defined in Appendix A 3 pMailBoxHandle A pointer to the mailbox s unique name or handle bUpdateFlag Identifies which fields of the mailbox should be updated Valid values for bUpdateFlag are defined in section A 1 Return Value UpdateReceiveMailBox returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eMailBoxNotActive eCommLinkNotInitialized eSyncCommandNotAllowed Example Example of how to update a previously opened receive J1708 mailbox J1708ReceiveHandle This example will update the ID and data count using the UpdateReceiveMailBox function MailBoxType J1708ReceiveHandle ReturnStatusType UpdateReceiveStatus unsigned char bUpdateFlag J1708ReceiveHandl gt wDataCount 6 J1708ReceiveHandl gt bMID 0x80 J1708ReceiveHandl gt bPID 0x34 bUpdateFlag UPDATE ID UPDATE DATA COUNT UpdateReceiveStatus UpdateReceiveMailBox dpaHandle amp J1708ReceiveHandle bUpdateFlag 88 4 4 31 Function Syntax Prototype Remarks DPA FAMILY USER S MANUAL 2004 UpdateReceiveMailBoxAsync Updates the data count data location identifier and identifier mask of an open receive mailbox ReturnStatusType ReceiveMailBox sho
18. InitCommLink is used to initialize communications between the PC and the serial DPA II I or III by identifying the COM port and baud rate It also sets the flags so that all other calls will know which COM port to use This function must be called before any other library functions are called When nitCommLink is called the appropriate interrupt vector pointers are saved so that they can be restored using RestoreCommLink The serial DPA 4 uses a different driver and to initialize it you have to use InitDPA Function Parameters dpaHandle Identifies the DPA handle use when calling other commands The CommLinkType structure is as follows typedef struct unsigned char bCommPort unsigned char bBaudRate CommLinkType bCommPort The serial communication port on the PC eComml COMI See Appendix A 2 for complete list of CommPortType bBaudRate The serial communication baud rate The DPA only supports 1 15K baud upon initialization If you have a communication port that is capable of faster communication the DPA can be set to communicate at 230K baud using the SetBaudRate command 32 bit only eB115200 115200 baud See Appendix A 2 for complete list of BaudRateType Return Value nitCommLink returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eSerialIncorrectPort 37 DPA FAMILY USER S MANUAL 6200
19. J1939 2 transport layer support The DPA is not a stand alone device In normal operation it is a slave to the PC being told when and where to send and receive messages as well as setting and resetting the timer and other functions However it is an asynchronous device that can inform the PC of data link messages without being polled The DPA hardware and PC layers and functions are described at length in the chapters that follow DPA FAMILY USER S MANUAL 2004 DPA DB 9 function connector blocks Host communications API P DLL DOS Application PC Client Figure 1 Functional overview 1 1 Documentation organization This manual contains several chapters an appendix and an index This chapter Chapter 1 provides an overview of the manual and summarizes the contents of the remaining chapters and appendices The remainder of this chapter provides reference to related documentation and technical support The chapters that follow address these subjects Chapter 2 Hardware Getting Started Instructions for proper installation and setup of the DPA Chapter 3 Functional Overview Overview of main DPA functions Chapter 4 API Overview Introduction to the Dynamic Link Library DLL used in creating programs to interface with the DPA Chapter 5 VSI Emulation Overview of VSI Emulation Appendix A Defines and Structures Appendix B Filters Masks
20. K Line only BProtocol eJ1708 bParam0 0x12 b xxx xxxx signifies 9141 and b xxxx 0002 is baud rate bParami interbyte timing Time between bytes of a message bParam2 0x04 xxxx Xxxl is No RX checksum XXXX xxx2 is No TX checksum xxxx xxx4 is No PID used init timeout values bParam3 0x00 not used bParam4 is used to set redundant filtering 0 disabled 1 enabled 41 DPA FAMILY USER S MANUAL 2004 For pass through mode DPA II does not support bProtocol eJ1708 bParam0 0x80 bParam1 is used to set CD Carrier Detect bParam2 is used to set DSR Data Terminal Ready bParam3 is used to set RTS Request to Send value bParam4 is used to set RI Ring Indicator value The above parameters are configured by the following bit configuration 0 Off 1 On for the byte Priority 0000 0 End of Message 0001 Priority 1 0010 Priority 2 0011 Priority 3 0100 Priority 4 0101 Priority 5 0110 Priority 6 0111 Priority 7 1000 Priority 8 CALLBACK pfDataLinkError MailBoxType DataLinkErrorType Calls a routine from the address pointed by pfDataLinkError if a DPA error occurs NULL disables this function MailBoxType definition is located in Appendix A 3 DataLinkErrorType Structure returns any errors during data link initialization typedef struct unsigned char bProtocol unsigned char bErrorCode DataLinkErrorType bProtocol Network pro
21. ReadDataLinkType ReadDataLinkData InitStatus InitDPA amp dpaHandle 601 if InitStatus eNoError ReadStatus ReadDataLink dpaHandle eCAN amp ReadDataLinkData RestoreStatus RestoreDPA dpaHandle 68 DPA FAMILY USER S MANUAL 2004 4 4 14 ReadDPABuffer Function Reads data from the DPA s I O buffer internal scratch memory Syntax ReturnStatusType ReadDPABuffer short dpaHandle unsigned char bData unsigned int wLength unsigned int wOffset Prototype dpaml6 h or dpam32 h Remarks ReadDPABuffer allows the host to read data out of the I O Buffer That data may be loaded into the DPA by another application or via any attached mailbox Due to limitations in 16 bit operating systems it may be necessary to break the reading of large buffers into multiple calls to ReadDPABuffer Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA bData Pointer to the location for the data wLength Number of data bytes to be read wOffset Address in the buffer where reading should begin Return Value ReadDPABuffer returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eCommLinkNotInitialized Example This example demonstrates the reading of data stored at the buffer s Address 21
22. ReturnStatusType InitDataLinkStatus send I nit DataLink command 2004 routine memset amp InitDataLinkData 0 sizeof InitDataLinkType InitDataLi InitDataLi InitDataLi InitDataLi InitDataLi InitDataLi nkData bProtocol eJ1708 nkData bParamO 0x00 nkData pfDataLinkError NULL nkData pfTransmitVector NULL nkData pfReceiveVector NULL nkStatus InitDataLink dpaHandle amp InitDataLinkData process returned status switch InitDataLinkStatus 44 DPA FAMILY USER S MANUAL 2004 case eNoError MessageBox NULL DataLink successfully initialized InitDataLink MB OK break cas DeviceTimeout MessageBox NULL DataLink not responding InitDataLink MB OK break case eProtocolNotSupported MessageBox NULL Requested protocol not supported InitDataLink MB OK break case eSyncCommandNotAllowed MessageBox NULL Cannot call from within a callback ISR routine InitDataLink MB OK break Example 3 J1850 InitDataLink Set the protocol equal to eJ1850 and all parameters equal to zero ReturnStatusType Status InitDataLinkType intiStruct memset amp initStruct 0 sizeof InitDataLinkType initStruct bProtocol eJ1850 Status InitDataLink dpaHandle amp initStruct Redundant Filtering Redundant filtering for
23. Single Wire CAN physical layer you will need to set bit 4 of Param2 when initializing the data link This setting switches the transceiver being used by the hardware All other CAN functions are unchanged Please note that the transceiver for the Single Wire CAN physical layer has a maximum baud rate of 100 Kbaud For J1708 bParam0 is used to set the baud rate used for the J1708 link 0x00 9600 baud 0x01 19 2K baud 0x02 10 4K baud 0x03 38 4K baud bParaml is not used for J1708 bParam32 sets the use of automatic checksum creation in J1708 0 Full automatic checksum for transmit and receive 1 Automatic checksum for receive only 2 Automatic checksum for transmit only 3 No automatic checksum 4 No PID communication bParam3 is not used for J1708 bParam4 is used to set redundant filtering 0 disabled 1 enabled 40 DPA FAMILY USER S MANUAL 2004 For GMJ1850 bParam0 is used to set the baud rate 0x00 10 4 kbps 0x01 41 6 kbps bParam4 is used to set redundant filtering 0 disabled 1 enabled For Ford J1850 bParam0 baud rate 0 10 4kbps 1 20 8kbps 2 41 6kbps 3 83 3kbps bParam1 node address Sets the physical address of the DPA on the network Used as the Source Address in transmitted messages bParam4 is used to set redundant filtering 0 disabled 1 enabled All other bParams should be set to zero For Ford ISO 9141 Supported on
24. The default power and network connection for the DPA 4 USB is the T connector It is defined Appendix D Note Your DPA 4 requires driver Version 8 03 or higher 14 DPA FAMILY USER S MANUAL 2004 2 7 4 Checking communication Check to see that the DPA is communicating with the PC by running the CHECKDPA EXE utility once the DPA drivers have been installed as described in section 2 2 This utility is installed along with the drivers and will prompt you for information about your DPA Answer the questions presented and if the DPA is working properly the application will report information about the DPA 15 DPA FAMILY USER S MANUAL 2004 2 8 RF Hardware The DPA RF hardware consists of two hardware adapter units the Base Station and the Remote Station This section describes installation and setup of these units Dearborn Protocol Adapter Dearborn Protocol Adapter ep 1939 RS 232 DB 9 Radio Frequency DPA RF DB 9 Radio Frequency DPA RF DB 15 cable 4 He PC Power Base Station fr PC Power Remote Station i to PC e Network Network Address 1 11708 diagnostic Y cable DPA Power to truck 2 8 1 Connect the Base Station Connect one end of the RS 232 serial cable to the Base Station The other end of the cable is connected to a serial port on your PC Connect the barrel connector of the AC power supply to the Base Station and plug the AC power supply into a standard electrical outlet Once installed
25. choices and three IRQ selections as defined in the following charts CH HD HRAS Add Adds PNP id 9 Default JP5 IRQ ADDRI ADDR2 Base Address 5 default O O 0x200 default 7 O C 0x220 10 C O 0x300 C C 0x320 Plug and play support is not yet available leave the PNP jumper intact 2 6 2 Power network connection to the DPA III PC 104 The pinout for the PC 104 card s 16 pin connector is as follows 12 DPA FAMILY USER S MANUAL 2004 Unused 8 CAN LO 9 11850 BUS O To make this GM UART node a master jumper pin 3 to pin 4 in the connector To terminate the CAN link with a 120 ohm resister jumper pin 5 to pin 7 in the connector 2 6 3 Installing the PC 104 card Once you have configured the resources and settings for your DPA power down the PC Locate an available PC 104 slot and insert the adapter Once the adapter is installed in the PC you must install the appropriate drivers as described in the following section 2 6 4 Checking communication Check to see that the DPA is communicating with the PC by running the CHECKDPA EXE utility once the DPA drivers have been installed as described in section 2 2 This utility is installed along with the drivers and will prompt you for information about your DPA Answer the questions presented and if the DPA is working properly the application will report information about the DPA 27 USB Hardware T
26. eInvalidExtendedFlags eInvalidCommand eInvalidTransportType eSerialOutputError eInvalidBufferOffset elnvalidBufferLocation eOutOfMemory eInvalidDpa eInvalidDpaHandle elnvalidPointer eBaudRateConflict elrqConflict elncorrectDriver eInvalidDriverSetup DPA FAMILY USER S MANUAL 2004 114 DPA FAMILY USER S MANUAL 2004 elnvalidBaseAddress eInvalidINI elnvalidDII eCommVerificationFailed elnvalidLock eServerDisconnect elnvalidSocket eWinSockError eInvalidDisplayType eModemError eInvalidResetType eProtocolNotInitialized eOperatingSystemNotSupported ReturnStatusType eNoError Success eDeviceTimeout Unable to communicate with the DPA before the timeout period expired eProtocolNotSupported Invalid protocol passed in eBaudRateNotSupported Invalid baud rate passed in eInvalidBitIdentSize Invalid identifier size CAN supports only 11 or 29 bit identifiers eInvalidDataCount Invalid data count CAN supports only 8 bytes of data eInvalidMailBox Attempting to transmit or receive with an unopened mailbox eNoDataAvailable No data in mailbox eMailBoxInUse Not used by 8 x drivers eMailBoxNotActive Mailbox was not open eMailBoxNotAvailable All available mailboxes 16 are in use eTimerNotSupported Timer not supported eTimeoutV alueOutOfRange A period greater than 1 minute 60 000ms was specified eInvalidTimerValue Timer valu
27. ee ee 118 Structure for PC copy Of Ma lBox a araia aa aeaaea aana aia ankaa a akaa 119 Structure for initializing the DPA Data link ee 121 Structure for Timer A eU ES tiu e RR E e E HER e e Re Eu es 125 Structure for Transport Protocol seen 125 AA Function Eternal 126 AGF cpluspl us ierat nr E tre pes EE ME n eer RES 726 B FILTERS MASKS AND CAN BIT TIMING REGISTERS 127 B 1 Filters Masks for CAN ENER 127 B 2 Filters masks for 11708 ten AEN ENEE deen 128 B 3 CAN Bit timing registers sisirin nanana erm eme eebe 129 C DRIVER SUMMARY serae Eco r an se oov enu panne n ant dr EEN 133 D CONNECTOR PINOUTS ciae eov venu pa n En px Ru aya vaca pa E ra MuR eoxRY us 135 INDEX CRM CT 137 k v Dearborn Group Technology Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 DPA FAMILY USER S MANUAL 2004 Table of Figures Functional overvieWw 2 eege 2 DPA II Plus and DPA III Plus RS 232 hardware iii 8 RS 232 DB9 connector pinout ENNEN ENNEN ENEE EEN 9 Successful communication using CHECKDPA EXE cesses enn 9 DPA architecture map cccce cce ccc cce eco ci ac oc cce ce ccce EEEEENEESegEEeEEEEENEE EEN EEEEEEEEEeER 18 Ulud 19 Tr nsmit mailbox map reir es DEENEN 20 Receive mailbox map ic ss ode ttt icio ee doe tenue cR
28. error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eProtocolNotSupported eCommLinkNotInitialized Example This example disables the J1850 datalink on power up include lt windows h gt include lt stdio h gt include dpam32 h void DisableJ1850Settings void ReturnStatusType InitStatus DisableStatus RestoreStatus short dpaHandle InitStatus InitDPA amp dpaHandle 601 if InitStatus eNoError DisableStatus DisableDataLink dpaHandle eJ1850 RestoreStatus RestoreDPA dpaHandle 34 DPA FAMILY USER S MANUAL 2004 4 4 4 EnableTimerlnterrupt Function Syntax Prototype Remarks Enables a timer interrupt from the DPA The interrupt initiates a user supplied callback function ReturnStatusType EnableTimerInterrupt short dpaHandle EnableTimerInterruptType pEnableTimerInterruptData dpam16 h or dpam32 h EnableTimerInterrupt specifies an interrupt time interval and callback function The current DPA timer value is passed to the callback function as a parameter Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA typedef struct unsigned long dwTimeOut void CALLBACK pTimerFunction unsigned long EnableTimerInterruptType dwTimeOut Specifies the period of th
29. handling functions timer functions and buffer host scratch pad functions These function names and functionality are the same for both the single DPA and the multiple DPA interfaces but the parameter lists will differ slightly A brief description of each function appears below along with a reference to its corresponding detailed description in section 4 4 where the functions appear alphabetically 25 DPA FAMILY USER S MANUAL 2004 4 3 1 X System functions InitDPA Specifies and initializes communication between the PC and the DPA InitCommLink Specifies and initializes communication between the PC and the serial DPA For future development Use of this command is discouraged Use InitDPA instead InitPCCard Specifies and initializes communication between the PC and the ISA PC104 DPA For future development Use of this command is discouraged Use InitDPA instead InitUSBLink Specifies and initializes communiation between the PC and the USB DPA For future development Use of this command is discouraged Use InitDPA instead RestoreDPA Restores the communication port between the PC and the DPA to its previous pre InitDPA state RestoreCommLink Restores the communication port between the PC and the serial DPA to its previous pre InitCommLink state RestorePCCard Restores the communication port between the PC and the ISA PC104 DPA to its previous pre nitPCCard state RestoreUSBLink Restores the USB port betw
30. majority logic 0 1 sample Time Segment 2 Determines the length of time that follows the sample point within a bit time Valid values 1 7 Time Segment 1 Defines the length of time that precedes the sample point within a bit time Valid values 2 15 1 bit time t Tseg1 t Tseg2 lt 1 time quantum tq sample point transmit point 130 DPA FAMILY USER S MANUAL 2004 The bus speed can be calculated as follows Bus Frequency Fosc 2 x BRP 1 x 3 TSEG1 TSEG2 Fosc Input Clock Frequency If BTRO 01 SJW 0 BRP 1 BTR1 1C SPL 0 TSEG2 1 TSEG1 12 Bus Frequency 16MHz 250 000 2x 1 1 x 3 1 12 131 DPA FAMILY USER S MANUAL 2004 APPENDIX C DRIVER SUMMARY DPAMI6 Description The DPAM16 interface should be used to develop 16 bit Windows applications This interface supports one ISA and one serial DPA simultaneously This interface is recommended for all new code development Operating system s Windows 3 1 Windows 95 Windows 98 Interface Multiple DPA DPA s supported Serial ISA DLL name DPAMI6 DLL Borland Import LIB DPAMI6B LIB Microsoft Import LIB DPAM16 LIB C header files DPAMI6 H DPA6XT H DPA16 Description The DPA16 interface should be used to develop 16 bit Windows applications This interface supports one DPA at a time It will support either the ISA or the serial DPA Operat
31. may be returned see Appendix A 2 for error descriptions eBaudRateNotSupported eDeviceTimeout eCommVerificationFailed eSerialOuputError To use the SetBaudRate function simply make the following call in your program Sel cBaudType baudRates BaudRates bPCBaud eb230400 Ba Sel udRates bDPABaud eb230400 tBaudrate dpaHandle baudRates 81 DPA FAMILY USER S MANUAL 2004 4 4 25 StoreDataLink DPA 4 Only Function Stores the currently initialized datalink information to the power up state for a given protocol Syntax ReturnStatusType StoreDataLink short dpaHandle BYTE bProtocol Prototype dpam32 h or dpa32 h Remarks StoreDataLink takes the current protocol parameters from the latest call to InitDataLink and saves them as the power up parameters for that protocol This allows the DPA 4 to power up with data links already initialized This command is only available on the DPA 4 Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA bProtocol Identified the protocol that you would like to store power up commands for Return Value StoreDataLink returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eProtocolNotSupported eCommLinkNotInitialized Example 1 This example initializes t
32. may be set to control the timing of outgoing broadcast messages and to set a base time for the time stamping of incoming messages The PC commands used to 18 DPA FAMILY USER S MANUAL 2004 control the timer allow the user to reset the timer request synchronization with the DPA s internal timer pause and resume timer function and suspend timer interrupts Interrupt functions can be used to help process messages The EnableTimerInterrupts function allows the operator to specify time intervals for interrupts from the DPA while DisableTimerInterrupts suspends the timed interrupts The suspension of timer interrupts allows transmits and callbacks to continue without interrupts to the PC while the pausing of the timer suspends interrupts transmits and callbacks from the DPA hardware Figure 6 Timer map 19 DPA FAMILY USER S MANUAL 2004 3 2 Transmit Mailbox A Transmit Mailbox is typically used to send messages over a network The DPA allows the user to customize each message by specifying the following e When the network message is to be sent e When relative to the DPA timer message transmission is to begin e The number of times the message is to be sent e The desired time interval between transmissions e The ID and data to be sent e The conditions for a callback announcing a successful transmission e The number of times the message should be sent before auto deletion occurs e Whether to enable a callbac
33. or just place the LoadTimer call in directly into your code void GoLoadTimer short dpaHandle ReturnStatusType LoadTimerStatus Initialize the timer with a value of 1000ms LoadTimerStatus LoadTimer dpaHandle 10001 65 DPA FAMILY USER S MANUAL 2004 4 4 12 PauseTimer Function Syntax Prototype Remarks Pauses the DPA s internal timer which suspends all transmits and callbacks interrupts ReturnStatusType PauseTimer short dpaHandle dpam16 h or dpam32 h PauseTimer stops the timer along with all transmits and callback interrupts Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommLink InitPCCard InitUSBLink or InitDPA Return Value PauseTimer returns eNoError on success Example In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eCommLinkNotlInitialized eSyncCommandNotAllowed To use the Pause Timer function simply make the following call in your program PauseTimer dpaHandle 66 DPA FAMILY USER S MANUAL 2004 4 4 13 ReadDataLink DPA 4 Only Function Reads the currently initialized datalink information for a given protocol Syntax ReturnStatusType StoreDataLink short dpaHandle BYTE bProtocol ReadDataLinkType ReadDataLinkData Prototype dpam32 h or dpa32 h Remarks ReadDataLink gets the lates
34. the Base Station does not need to be moved It uses an RF signal to communication with the Remote Station and will easily do so through brick or metal walls 2 8 2 Connecting the Remote Station Connect the DB 15 end of the diagnostic cable to the Remote Station Connect the other end of the diagnostic cable to the vehicle diagnostic connector Note The Remote Station receives its power from the vehicle through this cable 2 8 3 Installation and setup Your DPA RF package includes a DG Installation CD ROM with the program files needed to operate and use this product To install the program files insert the DG Installation CD ROM into your CD ROM drive If the computer using this CD ROM is unable to automatically start the Installation program use Windows Explorer to display the content of your CD ROM drive Double click the DPAInstall EXE file to run the Installation program 16 DPA FAMILY USER S MANUAL 2004 2 84 Configuring the OEM software tool The procedure for configuring your OEM software tool will vary depending on the manufacturer Refer to the manufacturer of the OEM tool s documentation for additional information 2 8 5 Checking communication Each DPA Base and Remote Station pair are configured at the factory with the same Network ID address so they can communicate exclusively with each other After using the DG DPA Installation CD to install the drivers see sections 2 2 and 2 8 3 check to see that the DP
35. the current DPA timer value The timer value is placed into dwTimerValue Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA Return Value RequestTimerValue returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eCommLinkNotlInitialized eSyncCommandNotAllowed Example include lt windows h gt include lt stdio h gt include dpam32 h void TestRequestTimerValu short dpaHandle ReturnStatusType LoadTimerStatus RequestTimerValueStatus long unsigned int dwRequestedTime char szBuffer 81 load timer with 1000 1 second LoadTimerStatus LoadTimer dpaHandle 1000L request timer value and display RequestTimerValueStatus RequestTimerValue dpaHandle amp dwRequestedTime sprintf szBuffer Current DataLink timer value is ld dwRequestedTime MessageBox NULL szBuffer RequestTimerValue MB OK 79 DPA FAMILY USER S MANUAL 2004 4 4 23 ResumeTimer Function Syntax Prototype Remarks Resumes a previously paused timer function and re starts all transmits and callback interrupts ReturnStatusTyp ResumeTimer short dpaHandle dpam16 h or dpam32 h ResumeTimer restarts the DPA s internal timer previously stopped by the PauseT
36. the load on your application This is accomplished using parameters in the LoadMailBox Type structure dwMID The identifier for the MID mailbox dwPID The identifier for the PID mailbox dwMIDMask The mask for the MID in mailbox dwPIDMask The mask for the PID mailbox bFilterType The filter type for the mailbox The filters work like those used in CAN filtering bit by bit across the identifier and mask fields The identifier ID field determines whether the bit value is or 0 The Mask field determines whether the bit is care 1 or don t care 0 Thus all ID bits matched with Mask bits equal to are set to their respective values 0 or 1 All ID bits matched with Mask bits equal to 0 are set as don t care a don t care bit is represented with an X The filter type determines whether all the messages that satisfy the result are to be saved pass or whether all the messages that do not match the result are to be saved block 128 DPA FAMILY USER S MANUAL 2004 The following examples each use only one data byte but the same filtering principles would be applied to additional bytes in the dialog boxes Example A HexVae a el ID 28H fo fof 1 lofi o lolol Mask roH 1 1 1 0 01 0 0 0 Result 20H 3FH 0 0 1 X xX x X x The result is that all messages from 20H to 3FH will satisfy the filter or trigger condition Example B To create a single ID filter or trigger a Mask
37. unsigned char bErrorCode DataLinkErrorType Structure for USBLinkType Typedef struct WORD wlInterface BYTE bHS FS USBLinkType DPA FAMILY USER S MANUAL 2004 118 DPA FAMILY USER S MANUAL Structure for PC copy of MailBox typedef struct unsigned char unsigned char unsigned char unsigned char int unsigned long unsigned char unsigned char bProtocol bActive bBitIdentSize bMailBoxNumber iVBBufferNumber dwMailBoxlIdent bMailBoxDirectionData bTimeAbsolute void CALLBACK pfApplicationRoutine void void CALLBACK pfMailBoxReleased void unsigned long unsigned long unsigned long int unsigned int unsigned char unsigned char unsigned char unsigned char unsigned char unsigned char unsigned char unsigned char unsigned char unsigned char unsigned char unsigned char unsigned char unsigned int unsigned int unsigned char unsigned char unsigned char void void MailBoxType dwTimeStamp dwTransmitTimeStamp dwBroadcastTime iBroadcastCount wDataCount bData MAILBOX BUFFER SIZE bTransparentUpdateEnable bTimeStamplnhibit bIDInhibit bDataCountInhibit bDatalnhibit bLinkType bLink bPriority bMID bPID bJ1708ExtendedDataMode bJ1708ExtendedPtrMode wJ1708ExtendedOffset wJ1708ExtendedLength bDataRequested bReceiveFlags bDataUpdated vpData vpUserPointer bProtocol the protocol selected for the mailbox elSO9141 ISO9141 2004
38. 3 The DPA API functions list irit EE es ae nr 25 43 1 System functions sessi einn ses 26 43 2 Data link configuration functions 27 43 3 Message handling functions 27 4 3 4 Timer functions nr H4 4E RR RR RR IEEE RREN AAAA RAAR RR anaa EEA 28 43 5 Buffer host scratch pad functions 28 4 4 DPA API function descriptions alphabetical order 29 4241 CheckDataLink i uu tee e aevo pul e Eye y yo E oa Dee eve YE ei A FERNER ERR Uo A 29 442 ConfigureTransportProtocol sise 31 44 3 DisableDataLink DPA 4 Oo 34 444 Enablelimerinterrupt eoi papaya pua a Ea apu RERERIR ER FREE EENS FRREREFERRREPEEERRRERRRRERERRUE 35 4 425 e TEE 37 44 6 AED ATALINAK EE 39 44 7 InitDPA Windows Only nr mme 47 448 INP OCard est EE E AT PFE A AAE TT 50 4 4 9 LoadDPABuffet ee 52 410 lLoadMallBOX EE 53 441 11 LoadlimeF niiun dee An ner e loin tte e ean ey vp eo REPE N dava sue REESE Reo ees 65 Y P My E LL TELT Ta a c 66 44 13 ReadDataLink DPA 4 On 67 E E E ER E e EE 69 4415 HeadDPAChecksum 52 A ee BE ee Ee 70 4 4 16 ReceiveMailBOx SERRE 71 4417 ResetDPA EE 73 4418 Restore Om e Eed ege E Eege Eege EE ee aes 75 44 19 RestoreDataLink DPA 4 On 76 44 20 RestoreDPA Windows On 77 44 21 JRestorePCCard uoi ntium titii 78 4422 JRequestIimerValue uineis kees Ded ad eu pneu Pe eege ees 79 44 23 hes meTImer EE 80 44 24 SetBaudRate 32 bit Windows ONY ii ERR RRRR RES ER R
39. 4 eSerialIncorrectBaud eSerialPortNotFound eSyncCommandNotAllowed Example This example initializes COM2 to communicate with the DPA at 115K baud include lt windows h gt include lt stdio h gt include dpam32 h void main void CommLinkType CommLinkData ReturnStatusType InitCommStatus RestoreCommStatus short dpaHandle CommLinkData bCommPort eComm2 CommLinkData bBaudRate eB115200 InitCommStatus InitCommLink amp dpaHandle amp CommLinkData RestoreCommStatus RestoreCommLink dpaHandle 38 4 4 6 Function Syntax Prototype Remarks DPA FAMILY USER S MANUAL 2004 InitDataLink Initializes the specified vehicle data link with data link information empties all mailboxes associated with the specified data link and identifies the protocol being implemented ReturnStatusType InitDataLink short dpaHandle InitDataLinkType pInitDataLinkData dpam16 h or dpam32 h InitDataLink initializes the hardware for specified protocols The DPA II hardware currently supports J1939 and J1708 protocols The DPA III and 4 hardware currently supports J1939 J1850 and J1708 Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA The InitDataLinkType structure is as follows typedef struct unsigned char bProtocol unsigned char bParam0 unsigned char bParaml unsigned char bPara
40. 703 838 1763 TMC s RP1210 Windows Communication Application RP1210A Program Interface APT Dearborn Group 248 488 2080 Description of how to use the various Dearborn Group INI DG INI useage doc files 2004 LU IMPORTANT please read this section before using the DPA DPA FAMILY USER S MANUAL 2004 2 0 HARDWARE GETTING STARTED Before using your DPA hardware please read this chapter It describes the software hardware and settings necessary for successful installation and operation of your DPA unit It will also direct you to the appropriate appendices for setup information specific to your hardware unit 2 1 Checking package contents Your DPA package should include the following items DPA hardware unit DPA Family User s Manual this document RS 232 straight through cable RS 232 option only USB cable USB option only 15 pin network connector Dearborn Group DPA Driver Installation CD DPA Drivers DPA RP1210a Drivers DPA Manual Sample RP1210 application and Adobe Acrobat Reader 2 2 Software The API library consists of one or more DLLs for Windows 3 1 95 98 NT and Windows 2000 Copy the required files to the appropriate directory on your hard drive typically the project directory where the application resides The files should include a DLL a library file and a header file L Note See Appendix D for a list of all DPA pin outs DPA FAMILY USER S MANUAL
41. 96 START COMMUNICATION 102 STOP COMMUNICATION 104 masks See filters Message handling functions 27 message structure 100 network connections 6 138 DPA FAMILY USER S MANUAL 2004 oversized messages 22 PC 104 card 1 installation 13 network connection 13 power connection 13 setting jumpers 12 Philips 82C250 3 PCA82C250 3 physical layer ISO 11898 1 J1939 11 1 J1939 15 1 power connections 6 protocols CAN J1939 1 J1708 1 J1850 1 Receive Mailbox 21 redundant filtering 45 46 related publications 3 Remote Station connecting the DPA 16 RP1210A driver 1 RS 232 9 RS 232 installation and setup 7 startCommunication 100 Structures Structure for DPA error 118 Structure for InitCommLink 118 Structure for initializing the DPA Data link 121 Structure for PC copy of MailBox 119 Structure for Timer Interrupts 125 Structure for Transport Protocol 125 Structure for USBLinkType 118 System functions 26 technical support contacting 2 timer 18 Timer functions 28 Transmit Mailbox 20 transport layer J1939 21 1 Typedefs Enumerations for BaudRateType 113 Enumerations for CommPortType 112 Enumerations for DPA errors 117 Enumerations for MailBoxDirectionType 117 Enumerations for ProtocolType 113 Enumerations for ResetType 113 Enumerations for ReturnStatusType 114 Enumerations for TransmitMailBoxType 117 USB API functions InitUSBLink 108 RestoreUSBLink 107 USB hardware 13 insta
42. A Remote Station is communicating with the DPA Base Station and the PC computer by running the CheckDPA exe program which can be found in C Program Files Dearborn Group 8xDrivers WIN32 CHECKDPA along with several code examples When you run the CheckDPA exe program it will prompt you for information about your DPA Answer the questions presented and if the DPA is working properly the application will report information about the DPA If not the program will report the problem it encountered The Quick Start Card that is included with your DPA product also contains common troubleshooting information Copies of this card in PDF format are on our website as well as on your DG Installation CD ROM disc in the Manual directory folder 17 DPA FAMILY USER S MANUAL 2004 3 0 FUNCTIONAL OVERVIEW The DPA embedded architecture is comprised of four main parts that manage the PC and network interfaces a Timer or clock the Tx Mailbox CAN J1708 J1850 the Rx Mailbox CAN J1708 J1850 and an IO Buffer or Host Scratch Pad The following diagram shows the basic architecture EE eg 7 Figure 5 DPA architecture map 3 1 Timer The timer is a free running millisecond clock that runs 49 5 days before rolling over to zero It is used to determine when a message is to be sent by transmit to timestamp incoming messages with their respective times received and to set timed interrupts to the PC The timer
43. C CAN TX NC CAN RX NC SW CAN NC ALDL 1 ALDL RX NC Master Slave 1 2 NC Master Slave 2 6 NC 9141 K Line 1 NC 9141 L Line NC J1850 14 J1850 NC External Power NC External Ground NC ATEC Data NC ATEC Diag NC Discrete In NC Discrete Out NC UNUSED SEVERAL 136 Index 87C196CB 3 API functions 25 API library 5 API overview 24 Application Program Interface See API Bit Timing Registers 129 Buffer functions 28 CAN ti 3 Bit Timing Registers 129 CAN J1939 1 CHECKDPA EXE 17 compiler information 24 connections network 6 power 6 Connector Pinouts 135 Data link configuration functions 27 Dearborn Protocol Adapter See DPA Defines Inhibit flags 112 Maximum size of check data link string 111 Number of mailboxes 111 Update mailbox flag definitions 112 Update transmit mailbox flag parameter definitions 111 DEFINES AND STRUCTURES 111 DLL 24 DLLs 5 DPA checking communication 9 connecting to the PC 8 functional overview 18 introduction to 1 DPA II Plus 1 DPA III ISA card 1 setting jumpers 10 DPA III Plus 1 DPA ISA card install and setup 10 DPA PC 104 card 11 DPA FAMILY USER S MANUAL 2004 INDEX DPA RF 16 driver RP1210A 1 driver installation 6 Drivers DPA16 133 DPA32 134 DPAMI6 133 Dynamic Link Library See DLL e mail 3 filtering redundant 45 46 filters 127 J1708 128 format byte 100 function descriptions 29 Function Prototypes ifd
44. Dearborn Group Technology DEARBORN PROTOCOL ADAPTER FAMILY USER S MANUAL Version 1 26 1 Includes the following products DPA II Plus DPA III ISA and PC 104 versions DPA III Plus serial versions DPA 4 USB version DPA RF wireless version 2003 Dearborn Group Inc 27007 Hills Tech Court Farmington Hills MI 48331 Phone 248 488 2080 Fax 248 488 2082 http www dgtech com DPA FAMILY USER S MANUAL 2004 This document is copyrighted by the Dearborn Group Inc Permission is granted to copy any or all portions of this manual provided that such copies are for use with the product provided by the Dearborn Group and that the name Dearborn Group Inc remain on all copies as on the original IMPORTANT NOTICE The DPA is intended to be used as an evaluation tool only Damage to the tool if caused by misuse is not covered under the seller s product warranty When using this manual please remember the following e This manual may be changed in whole or in part without notice Current updates to this manual may be found on Dearborn Group s web site at http www dgtech com e Dearborn Group Inc does not assume responsibility for any damage resulting from any accident or for any other reason while the DPA is in use e Examples of circuitry described herein are for illustration purposes only and do not necessarily represent the latest revisions of hardware or software Dearborn Group Inc ass
45. Eann dine daiane e TRE ERR nec 10 2 5 1 ISA card hardware installation and setup ss 70 25 2 Setting E ET 70 25 3 Power network connection to the DPA III sa 70 254 nstalling the ISA cad EE 11 2 5 5 Checking communicatio iriennerien uuu ya eH ka asser ten REERTE BER FERNER EN XE HR e ELE FERRE Yay PERS 11 2 6 PC 104 EE 11 2 6 1 Setting the Jumpers i iiie ies enaar Fh aa ERE aiie dei nii EEEREEREFREREEEEEFEEREERYFEREFEEEFERS 12 26 2 Power network connection to the DPA III PC 104 ui nnn nnn nana nana 12 2 6 3 Installing the PC T04 EE 13 26 4 Checking communication 13 2 4 USB HArAWArR eege da Ferr a ca Kcd a ecd Kos ba nda KR RO RC RA DR ER ota 13 ZZT Connection to Th EE 13 2 7 2 Hardware installation and setup 14 2 7 3 Power network connection to the DPA 4 USB sss esee nn nnn nnn n nnn nna nhanh na nna 14 274 Checking communication 15 28A RE FARO WV AEG ed ee tee ee eege 16 261 Connect EE EE 76 2 8 2 Connecting the Remote Station 76 26 3 Installation and setup EE 76 2 8 4 Configuring the OEM software Tool 17 2 8 5 Checking Communication 17 3 0 FUNCTIONAL OVERVIEW ege tore cxx ee Re ee 18 coUe eC rU MER ME 18 3 2 Transmit Dette tedious 20 B25 Receive MAlbox Dennen ee e EE Ee 21 3 4 1 0 Buffer host scratch pad 22 4 0 API OVERVIEW sn raid dre nacre a en sente ect Res 24 Dearborn Group Ko Technology DPA FAMILY USER S MANUAL 2004 41 nl TEE 24 4 2 The APLChOICOS EE 25 4
46. Handle PCCardType PCCardData dpam16 h or dpam32 h InitPCCard is used to initialize communications between the PC and the DPA by identifying the base address and the IRQ It also sets the flags so that all other calls will know which DPA to use This function must be called before any other library functions are called When nitPCCard is called the appropriate interrupt vector pointers are saved so that they can be restored using RestoreCommLink Function Parameters dpaHandle Identifies the DPA handle use when calling other commands The CommLinkType structure is as follows typedef struct unsigned short bBaseAddress unsigned char bIrq PCCardType bBaseAddress The base address of the PC Card 0x200 0x220 0x300 0x320 bIrq The IRQ of the PC Card 5 7 10 Return Value On success a handle to the DPA is opened is placed in the dpaHandle variable and eNoError is returned In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions elrqConflict eIncorrectDriver eInvalidDriverSetup eInvalidBaseAddress eInvalidDIl eSyncCommandNotAllowed 50 Example DPA FAMILY USER S MANUAL 2004 This example initializes port 200 to communicate with the DPA on IRQ 7 include lt windows h gt include lt stdio h gt include dpam32 h void main void PCCardType PCCardData ReturnStatusType InitCommStatus RestoreCo
47. NI record is invalid eInvalidDII There is a bad or missing DLL eCommVerificationFailed Could not communicate after change eInvalidLock Lock not found eServerDisconnect The TCP IP server disconnected eInvalidSocket Invalid socket eWinSockError Win socket error occurred eInvalidDisplay Type Invalid display type eModemError A modem error occurred 116 DPA FAMILY USER S MANUAL 2004 eInvalidResetT ype Invalid reset type eProtocolNotInitialized Protocol not initialized eOperatingSystemNotSupported OS not supported Enumerations for MailBoxDirectionType typedef enum MailBoxDirectionType eRemoteMailBox used for receiving data from link eDataMailBox used for sending data across link 1 MailBoxDirection Type Enumerations for TransmitMailBoxType typedef enum TransmitMailBoxType eResident MailBox remain active and can be used again eRelease MailBox is automatically unloaded after used TransmitMailBoxType Enumerations for DPA errors typedef enum DataLinkCANErrorCodeType eBusOff 1 eCanOverRun eErrorSendingAsync DataLinkCANErrorCodeType typedef enum LinkType eNoLink eLinkHead eLinkBody eLinkTail LinkType 117 A3 Structures Structure for InitCommLink typedef struct 1 unsigned char bCommPort unsigned char bBaudRate CommLinkType Structure for DPA error typedef struct unsigned char bProtocol
48. O buffer map Oversized messages J1708 and CAN networks sometimes transmit oversized messages A normal J1708 message for example may be up to 21 bytes long however special modes may utilize longer messages The DPA accommodates these oversized messages by putting the J1708 mailbox into extended mode and attaching it to a location in the I O buffer scratch pad The J1939 transport layer also makes use of this buffer scratch pad to ensure that transport timing requirements are met Reference the ConfigureTransportProtocol function for further details The MailBoxType structure must be set to extended mode in order to make use of the extended or oversized messages This is accomplished through the setting of the following parameters 22 DPA FAMILY USER S MANUAL 2004 bExtendedPtrMode True wExtendedOffset Scratch pad address Concatenated messages The storing of multiple messages in the DPA s I O buffer scratch pad reduces multiple reads and writes to the DPA hardware The concatenation of these short messages in turn reduces the overhead on the serial port The LoadDPABuffer function is used to re assign mailboxes so that their data is stored in the scratch pad for concatenation Example I O Buffer scratch pad use Mailbox 1 Mailbox 2 Mailbox 4 I O Buffer 23 DPA FAMILY USER S MANUAL 2004 4 4 0 API OVERVIEW The PC client software can be broken
49. R anas 81 4425 StoreDataLink DPA 4 On 82 4426 SuspendTimerinterrupt isses esee enean nnn nna nha a nah nn aa dadaran di iaaa a nass 84 2427 Transmit Mall EE 85 4428 TransmitMailBOXASYN C is ue 86 44 29 Unlo dMailBOX EE 87 4430 Upda teR ceiveMail BOK EE 88 4431 UpdateReceiveMa ilBoxASync sers 89 4432 UpdateTransMailBoxData seen 90 4433 UpdateTransMa ilBoxDataASync uissccccccccccccccecccennssnnsnnnsnnnsnnnsnnasnnannnannnannnannassnnanannnnasanes 91 44 34 UpdateTransmitMailBox ii iisssererrneeneeeneeennnenneeneeeenennnes 92 4435 UpdateTransmitMailBOxASYnc seen 94 4 5 KWP2000 DPA API function descriptions E 95 45 1 INIT KWP2000 E 95 4 5 2 RELEASE KWP2000 iii tii ua eege EES 95 LETICEY I dE TT c 96 4 5 4 SET COM PARAMETER 3 97 4 5 5 SET COM PARAMETER Dm eam ali sad cate anc tala 98 4 5 6 SET_BAUDRATE 101 4 5 7 START a Ee KE 102 Dearborn Group a Technology DPA FAMILY USER S MANUAL 62004 45 8 STOP COMMUNICATION iieri iiie ivan cbs ieu ar rena ed ai n aua RU ova Sande yesh i aaa ERE NEEN 704 45 9 GET STATUS EE 705 45 10 SEND MESSAGE itii e acl a a ra Ea pede euro ve Ea aa le 705 4 511 INITIANZAUON 2 55 M P 706 45 12 Fester EE 106 4 6 USB DPA API function descriptions EEN 107 46 1 RestoreUSBEIDk EE 707 46 2 THE ETE 708 5 0 VSI EMULATION sn tui cea Sow x duca v
50. S MANUAL 2004 4 4 33 UpdateTransMailBoxDataAsync Function Syntax Prototype Remarks Updates information being sent from a previously opened transmit mailbox For use inside a callback routine ReturnStatusType UpdateTransMailBoxDataAsync short dpaHandle MailBoxType pMailBoxHandle dpam16 h or dpam32 h UpdateTransMailBoxDataAsync is used to update only the data being sent from a previously opened mailbox for use inside a callback routine Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL ink InitPCCard InitUSBLink or InitDPA MailBoxType Structure defined in Appendix A 3 pMailBoxHandle A pointer to the mailbox s unique name or handle Return Value UpdateTransMailBoxDataAsyncreturns eNoError on success Example In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eMailBoxNotActive eCommLinkNotInitialized eSyncCommandNotAllowed This is an example of how to update and retransmit data in a transmit callback routine ReturnStatusType CALLBACK TransmitCallBack void unsigned char TransmitMailBoxBroadcastData strcpy char TransmitMailBoxBroadcastData 12345678 void UpdateTransMailBoxDataAsync dpaHandle TransmitCANHandle 91 DPA FAMILY USER S MANUAL 2004 4 4 34 UpdateTransmitMailBox Function Updates any infor
51. S MANUAL 2004 This command shall set the baud rate at which the network adapter communicates to the ECU This value is NOT the baud rate at which the PC communicates with the network adapter The baud rate set for this communication shall be used for KWP messages sent via the SEND_MESSAGE START COMMUNICATION and STOP COMMUNICATION command It is the responsibility of the application software to synchronize the baud rate of the network adapter to that of the ECU If this command is not used the network adapter shall use the default value listed below Valid BaudRate Values Baud Rate Value 8 192 Kbaud 9 6 Kbaud 19 2 Kbaud 10 4 Kbaud 38 4 Kbaud 115 2 Kbaud Default BaudRate Value Parameter Default Value BaudRate 10 4Kbaud 4 5 7 START COMMUNICATION API Example RET START COMMUNICATION BYTE KEY BYTES RET 0 gt OK RET 1 TIME OUT COMMAND 102 DPA FAMILY USER S MANUAL 2004 This command shall start the communication with the ECU The sequence of events shall be 1 Fast Initialization and 2 a StartCommunication Request message The network adapter shall use the Timelnit_Low and Timelnit High parameter values to perform the Fast Initialization After Fast Initialization the baud rate in the network adapter shall be set to the value of the BaudRate parameter NOTE 5 baud and CARB initialization is not supported via this API The StartCommunication Request mess
52. T COUNT void UpdateTransmitMailBoxAsync dpaHandle TransmitCANHandle bUpdateFlag 94 DPA FAMILY USER S MANUAL 2004 4 5 KWP2000 DPA API function descriptions The following API functions are not available for a standard DPA They are only available for DPA s which have ISO 9141 K and L line support installed These functions are implemented in the DGKWP2K dll not the single or multi DPA interface DPAxx dll or DPAMxx dll 4 5 1 INIT KWP2000 DPA API Example INT RET INIT KWP2000 DPA INT DPAiniEntry RET 0 gt OK RET 1 gt TIME OUT COMMAND Action This API command shall be the first command called by the application software at the time that the application software is initialized This will allow the network adapter to perform initializations for KWP communications This command shall not result in a KWP message to the ECU 4 5 2 RELEASE KWP2000 API Example INT RET RELEASE KWP2000 RET 0 gt OK RET 1 gt TIME OUT COMMAND Action This API command shall be the last command called by the application software before the application shuts down This will allow the network adapter to release resources used for KWP communications This command shall not result in a KWP message to the ECU 95 DPA FAMILY USER S MANUAL 2004 4 5 3 SET TIMING API Example INT RET SET TIMING INT Pl INT P2 INT P3 INT P4 RET 0 gt OK RET 1 gt TIME OUT COMMAND Action This com
53. able TRUE loadMailbox pfApplicationRoutine loadMailbox vpUserPointer NULL loadMailbox bProtocol eJ1850 loadMailbox bBitIdentSize 24 loadMailbox vpData receiveData loadMailbox bTransportType eTransportNone loadMailbox wDataCount 9 loadMailbox dwMailBoxIdent 0x00000000ul loadMailbox dwMailBoxIdentMask 0x00000000u1 dgStatus LoadMailBox dpaHandle amp loadMai lbox 64 DPA FAMILY USER S MANUAL 2004 4 4 11 LoadTimer Function Sets the timer for the time stamping of received and transmitted messages Syntax ReturnStatusType LoadTimer short dpaHandle long unsigned int dwTime Prototype dpaml6 h or dpam32 h Remarks LoadTimer sets the timer used for the time stamping of received and transmitted messages It takes the parameter passed in dwTime and loads it in the DPA s timer The timer has a 1 millisecond mS resolution and count wrapping occurs every 49 5 days Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA dwTime Time that to set the DPA timer to Return Value LoadTimer returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eCommLinkNotlInitialized eSyncCommandNotAllowed Example To use this function you can create a function such as the one below
54. age is sent with a three byte Header field Format byte Source Address byte and Target address byte The address bytes shall be included regardless of the setting of the AddrPresenceByte Parameter StartCommunication Request Message Example Byte Parameter Name Hex Value Comment 1 Format byte alue determined by the physical addressing AddrPresenceByte parameter alue determined by E argetAdd parameter SourceAdd parameter Service Id 14230 2 As defined by ISO 14230 2 THE NETWORK ADAPTER SHALL BE PREPARED TO RECEIVE A STARTCOMMUNICATION POSITIVE RESPONSE THE NETWORK ADAPTER SHALL USE THE KEY BYTES RETURNED HERE TO DEFINE THE HEADER FIELDS OF THE KWP MESSAGES SENT TO THE ECU VIA THE SEND COMMUNICATION THE KEY BYTES ARE DEFINED IN ISO 14230 2 SECTION 5 2 4 1 THE KEY BYTES SHALL OVERRIDE THE SETTINGS DETERMINED BY THE ADDRPRESENCEBYTE UNLESS THE KEY BYTE VALUE TOGETHER IS OX8FDO ACCORDING TO ISO 14230 2 SECTION 5 2 4 1 103 DPA FAMILY USER S MANUAL 2004 Byte Parameter Name Hex Comment alue 1 2 Target address buten Conditional Note 1 3 Source address byte x Conditional Note 1 4 Additional length byte xx Conditional Note 2 5 ele as defined by ISO 14230 2 Response Service Id 6 Network adapter shall use these key x bytes as defined in ISO14230 2 sec 5 2 4 1 7 Checksum X As defined by ISO 14230 2 Note 1 Format byte is 10xx xxxx or 11
55. ailBoxStatus eNoError get handle of mailbox if successful 61 DPA FAMILY USER S MANUAL 2004 TransmitHandle LoadMailBoxData pMailBoxHandle Example 8 This example illustrates the creation of a Receive mailbox for transport protocol using a callback routine include lt windows h gt include dpam32 h unsigned char bCallBackBuffer 8 void CALLBACK CallBackRoutine MailBoxType Handle d Copy data memcpy Handle gt vpData Handle gt bData Handle wDataCount void TestLoadMailBox short dpaHandle LoadMailBoxType oadMailBoxData ReturnStatusType oadMailBoxStatus UnloadMailBoxStatus MailBoxType CallBackHandle NULL load Receive MailBox for callback memset amp LoadMailBoxData 0 sizeof LoadMailBoxType oadMailBoxData bProtocol eJ1939 oadMailBoxData bRemote Data eRemoteMailBox oadMailBoxData bBitlidentSize 29 oadMailBoxData dwMailBoxIdent 0x00001234L ioadMailBoxData dwMailBoxIdentMask 0x00L oadMailBoxData bTransparentUpdateEnable FALSE oadMailBoxData bTimeStampInhibit FALSE ijoadMailBoxData bIDInhibit FALSE oadMailBoxData wDataCount 1785 largest message size oadMailBoxData pfApplicationRoutine CallBackRoutine oadMailBoxData vpData bCallBackBuffer The following elements are for transport Extended pointer mode must
56. ailBoxType J1708ReceiveAsyncHandle ReturnStatusType UpdateReceiveAsyncStatus unsigned char bUpdateFlagAsync 89 DPA FAMILY USER S MANUAL 2004 bUpdateFlagAsync UpdateReceiveAsyncStatus UpdateReceiveMailBoxAsync dpaHandle amp J1708ReceiveAsyncHandle bUpdateFlagAsync 4 4 32 UpdateTransMailBoxData Function Updates information being sent from a previously opened transmit mailbox Syntax ReturnStatusType UpdateTransMailBoxData short dpaHandle MailBoxType pMailBoxHandle Prototype dpaml6 h or dpam32 h Remarks UpdateTransMailBoxData updates only the data being sent from a previously opened mailbox Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA MailBoxType Structure defined in Appendix A 3 pMailBoxHandle A pointer to the mailbox s unique name or handle Return Value UpdateTransMailBoxData returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eMailBoxNotActive eCommLinkNotInitialized eSyncCommandNotAllowed Example unsigned char TransmitMailBoxBroadcastData ReturnStatusType UpdateTransMailBoxData strcpy char TransmitMailBoxBroadcastData 12345678 UpdateTransMailBoxData UpdateTransMailBoxData dpaHandle TransmitCANHandle 90 DPA FAMILY USER
57. all protocols is set up in the InitDataLink To enable redundant filtering set Param4 to 1 Param4 0x01 Redundant Filtering Enabled Param4 0x00 Redundant Filtering Disabled 45 DPA FAMILY USER S MANUAL 2004 Turning redundant filtering on for one protocol does not turn it on for the others If redundant filtering is required for all protocols InitDataLink must be called with Param4 set for each of the protocols When redundant filtering is enabled the DPA checks all receive mailboxes to see if the incoming data matches that mailbox Non redundant filtering will stop checking for mailbox matches once a matching mailbox is found This extra checking of the mailboxes can cause a significant delay and for this reason redundant filtering is not enabled by default in the DPA II II and IIIs Because there is the possiblity of receiving multiple callbacks for one message see example 2 the bandwidth between the DPA and host PC can also be reduced when redundant filtering is enabled The default receive methodology for these DPAs is to stop checking the receive mailboxes once a match has been found Because you have to store the default initialization parameters for the various protocols in the DPA 4 and DPA RF redundant filtering may or may not be enabled by default Example 1 Redundant Filtering Disabled You turn on redundant filtering and load one non filtering mailbox with callbacks and one filtering mailbox with cal
58. ameter1 gt lt List of parameters lt Parametern gt lt Parameter Name gt Parameter Name CS Checksum Byte MsgLen is the number of the data byte in the KWP2000 message request 4 5 11 Initialization This API shall not support 5 baud or CARB initialization 4 5 12 Tester Present After a successful START COMMUNICATION API call and in lack of any other KWP message being called from the application software the network adaptor shall continuously send a TesterPresent message out before 90 P3 milliseconds has expired This is to keep the communication link from expiring according to 1ISO14230 3 Section 6 4 106 DPA FAMILY USER S MANUAL 2004 4 6 USB DPA API function descriptions For USB support there are two function calls added to the native DPA 8 X drivers InitUSBLink and RestoreUSBLink RestoreUSBLink is just like RestoreCommLink but it restores the DPA attached to the USB port InitUSBLink described below because it utilizes a new USBLinkType structure 4 6 1 RestoreUSBLink Function Restores the USB port between the PC and the DPA to its previous pre InitUSBLink state Syntax ReturnStatusType RestoreUSBLink short dpaHandle Prototype dpam32 h or dpa32 h Remarks RestoreUSBLink is used to restore any and all interrupt vectors that were set up during nitUSBLink Once RestoreUSBLink is called no other library functions for the restored device can be called until communication t
59. ardware 2 4 1 Hardware installation and setup The DPA requires the following hardware for operation e AT compatible computer or higher e 9 32 volt 250mA power supply The DPA serial unit uses an 80C196CA processor with a 16 MHz crystal and requires 9v 32v at 250 ma of power To PC flashes at 1 Hz when RS 232 bus is active DB 9 RS 232 Connector Power LED CAN LED flashes at 1Hz when CAN bus is active DPA FAMILY USER S MANUAL DG Dearborn Group N ToPC Power Dearborn e Protocol A plus LE EN dapter 37632 Hills Tech Drive Farmington Hills MI 48331 248 488 2080 FAX 248 488 2082 http www dgtech com CAN e wh Z 7 e 1708 Indicates that internal CPU is running Mode LED red indicates Normal DPA mode green indicates Pass Through mode 2 4 2 Connection to the PC J1708 LED flashes at IMHz when J1708 bus active Figure 2 DPA II Plus and DPA III Plus RS 232 hardware 2004 DB 15 Power and Netowrk Connector J1850 Protocol LEDs flashes red or green indicating when corresponding bus is active Once power is supplied to the DPA unit the RS 232 DB 9 female connector RS 232 needs to be joined to a PC serial port with the supplied straight through DB9 cable It is interfaced pin to pin with a standard nine pin AT type serial connector DPA FAMILY USER S MANUAL 2004 Pin number Host RS 232 s
60. ata if LoadMailBoxStatus eNoError get handle of mailbox if successful TransmitHandle LoadMailBoxData pMailBoxHandle update data TransmitHandle gt vpData bNewData UpdateStatus UpdateTransMailBoxData dpaHandle TransmitHandle unload mailbox now that we are done UnloadMailBoxStatus UnloadMailBox dpaHandle TransmitHandle TransmitHandle NULL F 60 Example 7 This example illustrates the creation of a mailbox used to transmit a transport message This example may differ depending on wether you are using the 32 bit or 16 bit drivers The InitDataLink call must have been called with the transport layer enabled see CAN InitDataLink parameters under section 4 4 6 for more detail include lt windows h gt include void CALLBACK CallBackRoutine dpa32 h D PA FAMILY USER S MANUAL 2004 MailBoxType Handle Message Transmitted Perform required processing here bTransmitData 1000 NULL void TestLoadMailBox void LoadMailBoxType oadMailBoxData ReturnStatusType oadMailBoxStatus unsigned char MailBoxType TransmitHandle extern short dpaHandle load structure with data index memset amp LoadMailBoxData 0 sizeof LoadMailBoxType oadMailBoxData bProtocol eJ1939 oadMailBoxData bRemote Data eDataMailBox oadMailBoxData bResidentO
61. be used anytime that the data is longer than 8 bytes The extended offset is the offset into the dpa buffer where the data will be stored In 16 bit it may be necessary to use the ReadDPABuffer command to read the data from the buffer after a receive callback is received If you use this method set the bDataInhibit flag to TRU telling the driver that the data will be read later from the buffer The CTSSource element is the address of the node that will be sending the CTS messages of the transport session For receive this is the address of the DPA on the link BI ioadMailBoxData bDatalInhibit FALSE oadMailBoxData bTransportType eTransportRTS oadMailBoxData bExtendedPtrMode TRUE oadMailBoxData wExtendedOffset 1785 Offset in the Buffer oadMailBoxData bCTSSource OurLocalAddress oadMailBoxStatus LoadMailBox dpaHandle amp LoadMailBoxData 62 DPA FAMILY USER S MANUAL 2004 if LoadMailBoxStatus eNoError CallBackHandle LoadMailBoxData pMailBoxHandle unload mailbox now that we are done UnloadMailBoxStatus UnloadMailBox dpaHandle CallBackHandle CallBackHandle NULL Example 9 This example illustrates the creation of a J1850 Load Transmit Mailbox by loading a transmit resident mailbox with transmitCallback as the callback without transmitting LoadMailBoxType loadMailboxStruct ReturnStatusType loadMb
62. box The filters work like those used in CAN filtering bit by bit across the identifier and mask fields The identifier ID field determines whether the bit value is or 0 The Mask field determines whether the bit is care 7 or don t care 0 Thus all ID bits matched with Mask bits equal to 1 are set to their respective values 0 or 1 All ID bits matched with Mask bits equal to 0 are set as don t care a don t care bit is represented with an X The filter type determines whether all the messages that satisfy the result are to be saved pass or whether all the messages that do not match the result are to be saved block The following examples each use only one data byte but the same filtering principles would be applied to additional bytes in the dialog boxes 127 DPA FAMILY USER S MANUAL 2004 Example A Hex Value Byte BCEE KH ESEOERSRR AER EE AE Result 20H 3FH 0 0 TX X X X X The result is that all messages from 20H to 3FH will satisfy the filter or trigger condition Example B To create a single ID filter or trigger a Mask of FFH should be used HexVale Byte 7 o zm ojoo i ooo Mak FFH TTT Result 28H ojo r oj t 0 0 0 The result is that only the 28H value will satisfy the filter or trigger condition B 2 Filters masks for J1708 The DPA uses filters or masks to eliminate messages at the hardware level to help restrict
63. callback ISR Syntax ReturnStatusType TransmitMailBoxAsync short dpaHandle MailBoxType pMailBoxHandle Prototype dpaml6 h or dpam32 h Remarks TransmitMailBoxAsync is identical to TransmitMailBox except for its use of the DPA s Non Verbose mode for turning off the DPA response inside the application interrupt Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA MailBoxType Structure defined in Appendix A 3 pMailBoxHandle A pointer to the mailbox s unique name or handle Return Value 7ransmitMailBoxAsync returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eInvalidMailBox eCommLinkNotlInitialized eSyncCommandNotAllowed Example This example illustrates the transmission in response to a receive callback of a previously loaded transmit mailbox void ReceiveCallBack MailBoxType TransmitMailBoxAsync dpaHandle TransmitCANHandle 86 DPA FAMILY USER S MANUAL 2004 4 4 29 UnloadMailBox Function Closes a previously opened mailbox Syntax ReturnStatusType UnloadMailBox short dpaHandle MailBoxType MailBoxHandle Prototype dpaml6 h or dpam32 h Remarks UnloadMailBox closes a mailbox and disables all related callback functions Function Parameters dpaHandle Identifies the DPA to send this command t
64. curs and the connection is aborted iBam BAMTXTime The maximum time allowed between the BAM message and the first data message transmitted before a timeout occurs and the connection is closed 1 bit 1 millisecond iBam_DataTXTime The maximum time allowed between data messages ina BAM session 1 bit 10 millisecond iRTS_Retry The maximum number of times the DPA will send request to send packets without receiving a CTS iRTS_RetryTransmitTime The time delay between RTS request messages 1 bit 1 millisecond iRTS TX Timeout The DPA timeout value for a unit waiting for a CTS after starting a data transmission 1 bit 10 millisecond iRTS TX TransmitTime The interval between data message transmissions iRTS RX TimeoutData The maximum amount of time the DPA will wait for a message before aborting a connection iRTS RX TimeoutCMD The timeout value for the interval between CTS and first data packet iRTS RX CTS Count The number of packets to CTS when receiving messages from a sender J1939 Reference PGN 60416 Control byte 17 byte 2 iRTS TX CTS Count The message sender s number of messages to CTS J1939 Reference PGN 60416 Control byte 16 byte 5 Return Value ConfigureTransportProtocol returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eCommLinkNotlInitialized Example 32 This function ca
65. dle to the DPA is opened is placed in the dpaHandle Example variable and eNoError is returned In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eSerialIncorrectPort eSerialIncorrectBaud eSerialPortNotFound elrqConflict eIncorrectDriver eInvalidDriverSetup eInvalidBaseAddress eInvalidDII eInvalidINI eSyncCommandNotAllowed This example initializes DPA number 101 for communications incl incl incl void ude lt windows h gt ude lt stdio h gt ude dpam32 h main void ReturnStatusType InitCommStatus RestoreCommStatus short dpaHandle InitCommStatus InitDPA amp dpaHandle 101 47 DPA FAMILY USER S MANUAL 2004 RestoreCommStatus RestoreDPA dpaHandle 32 bit Native Driver INI File Changes In the 32 bit version of 7 22 driver the native driver started looking in DG DPA32 ini file for information to be used when InitDPA was called The key words that it looked for remained the same as the ones used in DG121032 ini In 7 24 and all the following releases if no device exists with the specified device id in the DG_DPA32 ini the driver will try and get the information from the DG121032 ini file If there is no device with that id then it return an error indicating that the ini file was invalid The 16 bit native driver still uses DG1210 ini for InitDPA The DG DPA32 ini file format is as follows DPAInforma
66. down in to two parts the host communication level and the API DLL The host communication level is the lowest level of communication The API structures and usage are described in Appendix A the functions for the API are described this chapter If you need further assistance with this level of programming please contact Dearborn Group s Technical Support staff for further assistance The Protocol Adapter Library API Application Program Interface was developed to provide a programming interface to the Protocol Adapter The API has been developed as a linkable library and as a DLL VxD Dynamic Link Library Virtual Device Driver for Windows 4 1 Compilers Borland The API was compiled using the Microsoft C compiler For use with Borland simply include the Borland import library included in the Borland directory and call the functions as labeled in this manual For use with older Borland compilers you may be required to explicitly load the DLL and map the functions Microsoft For use with Microsoft products include the library in the directory with each DLL NOTE You must change the project settings so that the struct member alignment value is one byte To set this value select Project Settings click the C C tab select Code Generation and specify one byte in the Struct member alignment box 24 DPA FAMILY USER S MANUAL 2004 4 2 The API Choices The DPA is delivered with two interface choices There is a
67. e Single DPA DPA s supported Serial DLL name N A Borland LIB DPAS16B LIB Microsoft LIB DPAS16 LIB C header files DPA6X H DPA6XT H DPAI16 Static Library Description The DPAII6 interface should be used to develop DOS applications This interface supports one ISA DPA at a time Operating system s DOS Interface Single DPA DPA s supported ISA DLL name N A Borland LIB DPAI16B LIB Microsoft LIB DPAI16 LIB C header files DPA6X H DPA6XT H 134 DPA FAMILY USER S MANUAL 2004 APPENDIX D Connector Pinouts ooo o ET ne DPA II T DPA III DPA Ill M DPA 4 T or RF DPA Il DDE DPA III MH 6 9 9 6 6 9 Ground 9 Power 9 32 vdc 10 J1708 11 J1708 12 CAN Shield 13 CAN Lo 14 CAN Hi CAN Term 1 CAN Term 2 CAN TX CAN RX SW CAN ALDL ALDL RX NC NC NC Master Slave 1 NC NC 2 2 NC Master Slave 2 NC NC 6 6 NC 9141 K Line NC NC NC 9141 L Line NC NC NC J1850 NC NC NC J1850 NC NC NC External Power NC NC NC External Ground NC NC NC ATEC Data NC NC 7 NC ATEC Diag NC NC 8 NC Discrete In NC NC NC Discrete Out NC NC NC UNUSED 1 2 3 4 5 6 7 1 2 5 9 10 11 1 2 5 9 10 11 depends on endplate 135 DPA FAMILY USER S MANUAL 2004 DPA Ill nM DPA Ill C TSW DPA IllI MMSW DPA IIl SCP DPAISA DPAPC 104 9 6 9 6 6 11 Ground 23 24 Power 9 32 vdc 10 3 4 J1708 11 NC J1708 12 NC CAN Shield 13 NC CAN Lo 14 NC CAN Hi NC CAN Term 1 NC CAN Term 2 N
68. e Data X unsigned char bTransportType unsigned char bResidentOrRelease unsigned char bBitIdentSize unsigned long dwMailBoxldent byte bCTSSource unsigned long dwMailBoxIdentMask byte bFilterType X unsigned char bTransparentUpdateEnable X unsigned char bTimeStamplnhibit X unsigned char bIDInhibit X unsigned char bDataCountInhibit X unsigned char bDatalnhibit X unsigned char bTimeAbsolute unsigned long dwTimeStamp unsigned long dwBroadcastTime int iBroadcastCount unsigned char bLinkType unsigned char bLink unsigned char bPriority unsigned char bMID X unsigned char bPID X unsigned char bMIDMask X unsigned char bPIDMask X byte bExtendedPrtMode X word wExtendedOffset X void CALLBACK pfApplicationRoutine MailBoxType X unsigned char bMailBoxReleased void CALLBACK pfMailBoxReleased MailBoxType void vpUserPointer X unsigned int wDataCount X void vpData X LoadMailBoxType 2004 CAN CAN RCV XMIT WS Ge X X X 122 DPA FAMILY USER S MANUAL 2004 bProtocol The protocol selected for a particular mailbox elSO9141 ISO9141 eJ1708 J1708 eJ1850 J1850 eJ1939 J1939 eCAN CAN pMailBoxHandle Address of Mailbox handle returned if a load was successful bRemote Data Used to identify the Mailbox direction eRemoteMailBox Receive eDataMailBox Transmit bTransportType Transport type to be used eTransportNone No Transport Lay
69. e interrupt in milliseconds CALLBACK pTimerFunction unsigned long Address of callback routine for timer NULL disables this function Return Value EnableTimerInterrupt returns eNoError on success Example incl incl incl far void In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eTimeoutV alueOutOfRange eCommLinkNotlInitialized eSyncCommandNotAllowed ude lt windows h gt ude lt stdio h gt ude dpam32 h long unsigned intdwTimeValue CALLBACK TimerFunction long unsigned int dwLocalTimerValue dwTimeValue dwLocalTimerValue void TestEnableTimerInterrupt short dpaHandle 35 DPA FAMILY USER S MANUAL 2004 ReturnStatusType EnableTimerStatus long unsigned int dwRequestedTime enable 1 sec heart beat timer EnableTimerInterruptData dwTimeOut 10001 EnableTimerInterruptData pTimerFunction TimerFunction void EnableTimerInterrupt dpahandle EnableTimerInterruptData ge GJ turn off timer interrupt SuspendTimerInterrupt dpaHandle 36 4 4 5 Function Syntax Prototype Remarks DPA FAMILY USER S MANUAL 2004 InitCommLink Specifies and initializes communication between the PC and the Protocol Adapter ReturnStatusType InitCommLink short dpaHandle CommLinkType CommLinkData dpam16 h or dpam32 h
70. e out of range eInvalidMailBoxDirection Not used by 8 x drivers eSerialIncorrectPort Incorrect com port eSerialIncorrectBaud Incorrect baud rate eSerialPortNotFound Com port not found eSerialPortTimeout Not used by 8 x drivers 115 DPA FAMILY USER S MANUAL 2004 eCommLinkNotInitialized Serial port not opened eAsyncCommBusy Still waiting for a previous asynchronous command to finish processing eSyncCommInCallBack Not used by 8 x drivers eAsyncCommandNotAllowed Not used by 8 x drivers eSyncCommandNotAllowed Cannot call from within callback ISR eLinkedMailBox Mailbox is linked eInvalidExtendedFlags Not used by 8 x drivers eInvalidCommand Not used by 8 x drivers eInvalidTransportType Invalid transport type eSerialOuputError Could not set PC baud eInvalidBufferOffset Invalid buffer offset eInvalidBufferLocation Invalid buffer location eOutOfMemory Driver needs more memory on computer eInvalidDpa Invalid dpa type eInvalidDPA Handle Invalid dpa handle being passed to a command eInvalidPointer Invalid pointer eBaudRateConflict Trying to initialize a comport that is already initialized at a different baud rate elrqConflict Irq in use eIncorrectDriver The driver is the wrong driver eInvalidDriverSetup The driver is set up incorrectly eInvalidBaseAddress The base adderss is invalid eInvalidINI The I
71. ed for flexibility of design Currently ISO 14230 2 does not allow any change to these parameters If this command is not used by the application the network adapter shall use the default parameters defined below The parameters Timelnit Low and Timelnit High expressed in milliseconds shall set the timing of the fast initialization of the ECU as defined in ISO14230 2 97 DPA FAMILY USER S MANUAL 2004 The Parameter DataBit sets the number of data bits that the network adapter uses in a data byte Valid values for this parameter are limited to the values listed below Valid DataBit Values DataBit Value Description 7 Seven data bits per byte 8 Eight data bits per byte The Parameter ParityBit sets the use of parity in the communication of the network adapter Valid Values for this parameter are limited to the values listed below Valid ParityBit Values ParityBit Value Description 0 No Parity used in communication 1 Odd Parity used in communication 2 Even Parity used in communication Default Values Parameter imelnit_Low imelnit_High DataBit ParityBit Default Value 25ms 4 5 5 SET COM PARAMETER 2 API Example RET SET COM PARAMETER 2 INT TargetAdd INT SourceAdd BYTE AddrPresenceByte TargetAdd SourceAdd Target and Source address see comments below AddrPresenceByte 0 1 2 3 see comments below
72. een the PC and the DPA to its previous pre nitUSBLink state CheckDataLink Returns an identifier specifying the manufacturer name the DLL version the version of firmware installed on the DPA and installed hardware capabilities ReadDPAChecksum Verifies the checksum of the DPA s Flash memory ResetDPA Performs a low level reset of the DPA or its communications SetBaudRate Serial only Allows the calling application to command the DPA to run at a different baud rate 26 DPA FAMILY USER S MANUAL 2004 4 3 2 Data link configuration functions InitDataLink Initializes the specified vehicle data link with data link information empties all mailboxes associated with the specified data link and identifies the protocol being implemented ConfigureTransportProtocol Allows the user to configure J1939 Transport Protocol characteristics DisableDataLink Disables a datalink on power up ReadDataLink Reads the currently initialized datalink information for a given protocol RestoreDataLink Restores a datalink to its power up parameters StoreDataLink Stores the currently initialized datalink information to the power up state for a given protocol 4 3 3 Message handling functions LoadMailBox Opens creates mailboxes for the receiving and transmitting of messages TransmitMailBox Sends messages using previously opened mailboxes TransmitMailBoxAsync Sends messages asynchronously using previously opened mailboxes f
73. ef cplusplus 126 functions Buffer 28 ConfigureTransportProtocol 31 Data link configuration 27 DisableDataLink DPA 4 Only 34 EnableTimerInterrupt 35 InitCommLink 37 InitDataLink 39 InitDPA Windows Only 47 InitPCCard 50 LoadDPA Buffer 52 LoadMailBox 53 LoadTimer 65 Message handling 27 PauseTimer 66 ReadDataLink DPA 4 Only 67 ReadDPABuffer 69 ReadDPAChecksum 70 ReceiveMailBox 71 RequestTimerValue 79 ResetDPA 73 RestoreCommLink 75 137 RestoreDataLink DPA 4 Only 76 RestoreDPA Windows Only 77 RestorePCCard 78 ResumeTimer 80 SetBaudRate 32 bit Windows Only 81 StoreDataLink DPA 4 Only 82 SuspendTimerInterrupt 84 system 26 Timer 28 TransmitMailBox 85 TransmitMailBoxAsync 86 UnloadMailBox 87 UpdateReceiveMailBox 88 UpdateReceiveMailBoxAsync 89 UpdateTransMailBoxData 90 UpdateTransMailBoxDataAsync 91 UpdateTransmitMailBox 92 UpdateTransmitMailBoxAsync 94 header 100 I O Buffer 22 1ECM96 PC 3 Intel 3 inter block time 96 inter byte time 96 ISA card installing 11 network connection 10 power connection 10 ISO 11898 physical layer 1 J1708 filters 128 J1708 protocol 1 J1850 protocol 1 J1939 protocol 1 J1939 11 physical layer 1 J1939 15 physical layer 1 J1939 21 transport layer 1 KWP 2000 functions GET STATUS 105 INIT KWP2000 DPA 95 RELEASE KWP2000 95 SEND MESSAGE 105 SET BAUDRATE 101 SET COM PARAMETER 1 97 SET COM PARAMETER 2 98 SET TIMING
74. er eTransportBAM Broadcast Announcement Message eTransportRTS RTS CTS bResidentOrRelease Specifies transmit mailbox Resident or Release eResident The mailbox is permanent it will remain active and can be used again eRelease The mailbox is automatically unloaded after it is used bBitIdentSize Specifies the length of the Mailbox identifier 32 bits maximum dwMailBoxIdent Mailbox Identifier 32 bits maximum bCTSSource Destination address for RTS Transport dwMailBoxIdentMask Mailbox Identifier mask match 0 don t care bFilterType Identifies a filter a block or pass type ePass Pass pass only messages that match the filter eBlock Block do not pass messages that match the filter bTransparentUpdateEnable Flag for enabling a transparent update of data TRUE ON FALSE OFF bTimeStampInhibit Flag for removing the timestamp from a receive data message TRUE ON FALSE OFF bIDInhibit Flag for removing the MailBox identifier from a receive data message TRUE ON FALSE OFF bDataCountInhibit Flag for removing the data count from a receive data message TRUE ON FALSE OFF bDatalnhibit Flag for removing the data from a receive data message 123 DPA FAMILY USER S MANUAL 2004 TRUE ON FALSE OFF bTimeAbsolute Flag for setting the timestamp format to absolute or relative time TRUE absolute FALSE relative dwTimeStamp Specifies a time or delay for the first m
75. es das REC ve E ove aUud 110 A DEFINES AND STRUCTURES ne enne 111 war et 111 Number of mailboxes ise crea ka de e ear dang Ee Ra re eA Rea aon rd 111 Maximum size of check data link string sei iiis e siii inne nn nnns n hinh nans a sanas nna 111 Update transmit mailbox flag parameter definitions ii isses eiit 111 ee TAOS EE 112 Update mailbox flag definitions eise isses sessi init nn nhanh nni an nans a nasa sain ninh nana n ns nana 112 EN EE CEET 112 Enumerations for CommPortType sessi iia ane enean nani t nnn anas a sana ann n nsns s sas asa na nnno nss s sanas sauna 112 Enumerations for BaudRateType sise 113 Enumerations for ProtocolType ses 113 Enumerations for R SCtT 0G gt 2 2538 ovens pee E HE EET ede eve eda HA aue ovy BA ep Tea edo int 113 Enumerations for ReturnStatusT pe rs 114 Enumerations for Ma lBoxDirectionType ss 117 Enumerations for TransmitMailBoxType 117 Enumerations for DPA errors annees nana ani h tnn nna sah s hanno nana nn ss ss sa sanant annes nass sis in na 117 A3 Structures MM 118 Structure for InitCommLink RE 118 Structure for DPA error oii E gare MA ean aee vu ane eaa RE Rs Xon A ae ge AERE 118 Structure for USBLINKT pe ee ba eee ee ee es ne
76. essage to be transmitted from the DPA dwBroadcastTime Identifies the time interval between broadcast messages iBroadcastCount Specifies the number of times broadcast message should be sent bLinkType Unused bLink Unused bPriority J1708 priority bMID J1708 MID bPID J1708 PID bMIDMask J1708 MID mask bPIDMask J1708 PID mask bExtendedPrtMod Specifies whether the scratch pad should be used for data TRUE ON FALSE OFF wExtendedOffset The location of data in the buffer scratch pad CALLBACK pfApplicationRoutine MailBoxType Mailbox Release flag to keep the active flag current bMailBoxReleased Unused CALLBACK pfMailBoxReleased MailBoxType Address of a mailbox release callback routine vpUserPointer A user defined pointer wDataCount Number of bytes per message a maximum of MAILBOX BUFFER SIZE bytes vpData The address of message data 124 DPA FAMILY USER S MANUAL 62004 Structure for Timer Interrupts typedef struct d unsigned long dwTimeOut void CALLBACK pTimerFunction unsigned long EnableTimerInterruptType Structure for Transport Protocol typedef struct BYTE bProtocol WORD iBamTimeout Inter message timeout for BAM receive WORD iBAM BAMTXTime Time between BAM and first data packet WORD iBAM DataTXTime Time between BAM Data packets WORD
77. f status eNoError if uiChecksum uiVer707Checksum do whatever here 70 DPA FAMILY USER S MANUAL 2004 4 4 16 ReceiveMailBox Function Retrieves the latest message from a specific mailbox Syntax ReturnStatusType ReceiveMailBox short dpaHandle MailBoxType pMailBoxHandle Prototype dpaml6 h or dpam32 h Remarks ReceiveMailBox retrieves the latest message from a specific mailbox Previous messages are overwritten If called multiple times and no new message has come in then the latest message is returned multiple times Be sure to check the message timestamp for this situation Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA MailBoxType Structure found in section A 3 pMailBoxHandle Pointer to the mailbox s unique name handle Return Value ReceiveMailBox returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eInvalidMailBox eCommLinkNotlInitialized eSyncCommandNotAllowed Example 1 Retrieves data last received ina CAN mailbox specified by the mailbox handle J1939ReceiveHandle if J1939ReceiveHandle NULL amp amp J1939ReceiveHandle bActive 0 void ReceiveMailBox dpaHandle J1939ReceiveHandle 71 DPA FAMILY USER S MANUAL 2004
78. he CAN Data link to 250K bps 29 bit identifier preferred and then stores the parameters so the DPA powers up with these datalink setting already enabled finclude lt windows h gt include lt stdio h gt include dpam32 h void DisplayInitDataLink short dpaHandle void main void ReturnStatusType InitStatus StoreStatus RestoreStatus short dpaHandle 82 DPA FAMILY USER S MANUAL 2004 InitStatus InitDPA amp dpaHandle 601 If InitDPA was DisplayInitDataLink dpaHandle successful then check RestoreStatus RestoreDPA dpaHandle DataLink i e if InitStatus eNoError void DisplayInitDataLink short dpaHandle Note InitDataLinkType InitDataLinkData ReturnStatusType InitDataLinkStatus InitDataLinkData bProtocol eJ1939 Select protocol InitDataLinkData pfDataLinkError NULL No Error Callback InitDataLinkData pfTransmitVector NULL No CAN TX Callback InitDataLinkData pfReceiveVector NULL No CAN Receive Callback InitDataLinkData bParam0 0x41 Set Baud InitDataLinkData bParaml 0x58 InitDataLinkData bParam2 0x00 29 bit preferred InitDataLinkStatus InitDataLink dpaHandle amp InitDataLinkData process the returned status if InitDataLinkStatus eNoError MessageBox NULL DataLink successfully initialized InitDataLink MB OK StoreStatus StoreDataLink dpaHandle eJ1939 if StoreStatus eNoErr
79. he DPA USB hardware has two connectors a standard USB interface and a network power connector The network power connector types are described Appendix D See section 2 3 for more information about these protocols and their physical connections 2 7 1 Connection to the PC Once power is supplied to the DPA unit the USB interface needs to be joined to a PC via a USB 2 0 A to B cable 13 DPA FAMILY USER S MANUAL 2004 2 7 2 Hardware installation and setup The first time that you have a powered DPA connected to the computer s USB port the operation system will prompted you for device drivers via a Found New Hardware Wizard box Found New Hardware Wizard Welcome to the Found New Hardware Wizard This wizard helps you install a device driver for a hardware device Click Next to locate the driver on the CDROM If the file is auto located the box will appear below Otherwise search the CDROM for the dg usb dpaiv inf file Once located click Next Found New Hardware Wizard river Files Search Results N The wizard has finished searching for driver files for your hardware device NS The wizard found a driver for the following device e Dearborn Protocol Adapter IV Windows found a driver for this device To install the driver Windows found click Next e dpa netchip dg_usb_dpaiv inf The driver will be installed Click Finish to close the box 2 7 3 Power network connection to the DPA 4 USB
80. iRTS Retry Number of times to send RTS without CTS WORD iRTS_RetryTransmitTime Time between retries of RTS TX WORD iRTS TX Timeout Time to wait for a CTS after RTS TX WORD iRTS TX TransmitTime Time between data packets on RTS TX WORD iRTS_RX_TimeoutData Timeout between data packets on RTS RX WORD iRTS_RX_TimeoutCMD Timeout between CTS and 1st data packet BYTE iRTS RX CTS Count Number of packets to CTS for BYTE iRTS TX CTS Count Number of packets to CTS for ConfigureTransportType 125 DPA FAMILY USER S MANUAL 2004 AA Function Prototypes ifdef cplusplus extern C ReturnStatusType far InitCommLink short dpaHandle CommLinkType CommLinkData ReturnStatusType far RestoreCommLink short dpaHandle ReturnStatusType far InitDataLink short dpaHandle InitDataLinkType I nitDataLinkData ReturnStatusType far CheckLock short dpaHandle char szSearchString EE char bFound ReturnStatusType far CheckDataLink short dpaHandle char cVersion ReturnStatusType far LoadDPABuffer short dpaHandle unsigned char bData E int wLength unsigned int wOffset ReturnStatusType far DE dpaHandle unsigned char bData unsigned int wLength unsigned int wOffset ReturnStatusType far LoadMailBox short dpaHandle LoadMailBoxType pLoadMailBox Data ReturnStatusType far TransmitMailBox short dpaHandle MailBoxType pMailBoxHandle ReturnStatusType far TransmitMailBoxAsync sho
81. ignal name No connection crs ts CTS Clear to Send No connection Figure 3 RS 232 DB9 connector pinout 2 4 3 Checking communication Check to see that the DPA is communicating with the PC by running the CHECKDPA EXE utility once the DPA drivers have been installed as described in section 2 2 This utility is installed along with the drivers and will prompt you for information about your DPA Answer the questions presented and if the DPA is working properly the application will report information about the DPA e CHECKDPA Be x Auto z ES El ajs Al fire you using an ISA DPA or a Serial DPA ISA DPA 1 Serial DPA Please select a number and press lt Enter gt 1 Select a CommPort lt i 10 gt 1 Select a BaudRate 9608 19208 28808 38408 576080 or 11526 DPA gt 115266 DPA Type Serial DPA CommPort 1 BaudRate 115266 Company Dearborn Driver Version 6 24 Hardware Version 3 10 9 38 Protocols J1768 CAN lt 16MHz gt Buffer Size BUF6144 BaudRate H115K Would you like to add this information to your ini files CY or ND n Press any key to quit Figure 4 Successful communication using CHECKDPA EXE DPA FAMILY USER S MANUAL 2004 2 5 ISA HARDWARE 2 5 1 ISA card hardware installation and setup The DPA requires the following hardware for operation e AT compatible computer or higher e Free ISA Bus Slot e Interrupt 5 7 or 10 available e I O Address Range
82. imer function Transmit and callback interrupt functions are also resumed Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA Return Value ResumeTimer returns eNoError on success Example In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eCommLinkNotlInitialized eSyncCommandNotAllowed To use the ResumeTimer function simply make the following call in your program ResumeTimer dpaHandle 80 DPA FAMILY USER S MANUAL 2004 4 4 24 SetBaudRate 32 bit Windows Only Function Syntax Prototype Remarks Send a command to change to baud rate on the serial link between the DPA and the PC ReturnStatusType SetBaudRate short dpaHandle BaudRateType baudRate dpam16 h or dpam32 h SetBaudRate performs 3 steps Sets the DPA baud to the requested value sets the PC baud to the requested value and verifies that the DPA and the PC can still communicate Baud rates higher than 115200 are only available on serial ports that will support these baud rates Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommLink InitPCCard InitUSBLink or InitDPA Return Value SetBaudRate returns eNoError on success Example In the event of an error one of the following error codes
83. ing system s Windows 3 1 Windows 95 Windows 98 Interface Single DPA DPA s supported Serial ISA DLL name DPA16 DLL Borland Import LIB DPA16B LIB Microsoft Import LIB DPA16 LIB C header files DPA16 H DPA6XT H DPAM32 Description The DPAM32 interface should be used to develop 32 bit Windows applications This interface supports multiple ISA and multiple serial DPA s simultaneously This interface is recommended for all new code development Operating system s Windows 95 Windows 98 Windows NT Interface Multiple DPA 133 DPA FAMILY USER S MANUAL 2004 DPA s supported Serial ISA PC104 USB DLL name DPAM32 DLL Borland Import LIB DPAM32B LIB Microsoft Import LIB DPAM32 LIB C header files DPAM32 H DPA6XT H DPA32 Description The DPA32 interface should be used to develop 32 bit Windows applications This interface supports one DPA at a time This interface is recommended only to support code that was developed for previous versions of the DPA drivers Operating system s Windows 95 Windows 98 Windows NT Interface Single DPA DPA s supported Serial ISA PC104 USB DLL name DPA32 DLL Borland Import LIB DPA32B LIB Microsoft Import LIB DPA32 LIB C header files DPA32 H DPA6XT H DPAS16 Static Library Description The DPAS16 interface should be used to develop DOS applications This interface supports one serial DPA at a time Operating system s DOS Interfac
84. iod epa eae diae 21 VO butter map aou ee bone I eae Dt 22 vi Dearborn Group Technology DPA FAMILY USER S MANUAL 2004 CHAPTER 1 0 INTRODUCTION The Dearborn Protocol Adapter DPA product family is a group of tools used to interconnect serial communication networks and PCs or other hosts It is provided with a software library that is common to all DPA family products to provide flexibility across all hardware platforms and networks The DPA family software includes an RP1210A interface and a C library API for Windows DPA hardware is available in the following formats Serial RS 232 versions The DPA II Plus and DPA II Plus are small packages providing a CAN J1939 and J1708 interface to a serial connection The RS 232 hardware supports a special pass through mode which allows the DPA to emulate current interface products on the market The DPA III Plus provides additional support for the J1850 protocol ISA card PC 104 card and USB Interface The DPA III ISA card PC 104 card and USB interface support the CAN J1939 J1708 and J1850 protocols The DPA supports the following features e Platform independence for software development e RS 232 interface port serial versions e Support for CAN 11 and 29 bit Identifiers and J1708 modified RS 485 protocols DPA III and III Plus versions also support J1850 e DPA API DLL VxD RP1210A driver e J1939 11 J1939 15 and ISO 11898 compatible physical layer e
85. k announcing the time of a message deletion f Tm S1708 Figure 7 Transmit mailbox map 20 DPA FAMILY USER S MANUAL 2004 3 3 Receive Mailbox A Receive Mailbox is typically used to receive messages from a network The options for receiving allow the user to specify the following e Which protocol to scan e Which bits should be masked and which ones should be matched in hardware level filtering See Appendix B Filter Masks e What information e g mailbox number timestamp identifier length of data and or data should be sent to the host immediately upon message receipt e How the application will be notified when a message is received Transparent Update Receive Callbacks Polling A J1850 Uu l L j Rx S Figure 8 Receive mailbox map 21 DPA FAMILY USER S MANUAL 2004 3 4 VO Buffer host scratch pad The host scratch pad or I O Buffer is a space reserved in the DPA s memory it is used for temporary storage of data for transmit or receive mailboxes It adds flexibility to the transmitting and receiving of messages regardless of network type CAN J1708 or J1850 by providing the following resources Note The scratch pad in both the DPA 3 and DPA 4 is 6 144 bytes e atemporary message storage location e redirection of mailbox data storage for oversized messages such as J1939 Transport Protocol messages concatenation of small messages Figure 9 I
86. lbacks A message matches the non filtering and filtering mailbox The DPA will send two callbacks to the PC one for the non filtering mailbox and one for the filtering mailbox Example 2 Redundant Filtering Enabled You turn off redundant filtering and load one non filtering mailbox with callbacks and one filtering mailbox with callbacks A message matches the non filtering and filtering mailbox The DPA will send only one callback to the PC Once the data is matched to the first mailbox the DPA will stop checking for matches and will not send a callback to the second mailbox 46 DPA FAMILY USER S MANUAL 2004 4 4 7 InitDPA Windows Only Function Syntax Prototype Remarks Specifies and initializes communication between the PC and the DPA ReturnStatusType InitDPA short dpaHandle short DPANumber dpam16 h or dpam32 h InitDPA is used to initialize communications between the PC and the DPA by identifying the number of the DPA This function will read the parameters of the DPA from the DG1210 INI 16 bit or DG DPA32 ini 32 bit The entry for the DPANumber 101 in the INI file is listed below Function Parameters dpaHandle Identifies the DPA handle use when calling other commands DPANumber The device number in the DG1210 ini 16 bit or DG DPA32 ini 32 bit file that the DPA is initializing DPAInformation101 DPAParams DPAII COMI Return Value On success a han
87. llation and setup 13 network connection 15 DPA FAMILY USER S MANUAL 2004 power connection 15 USB interface 1 Vehicle Serial Interface See VSI VSI 110 VSI Emulation 110 web site 3 139
88. llowing error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eCommLinkNotlInitialized eSyncCommandNotAllowed 29 DPA FAMILY USER S MANUAL 2004 Example include lt windows h gt include lt stdio h gt include dpam32 h void DisplayCheckDataLink void void main void CommLinkType CommLinkData ReturnStatusType InitCommStatus RestoreCommStatus short dpaHandle CommLinkData bCommPort eComm2 CommLinkData bBaudRate eB115200 InitCommStatus InitCommLink amp dpaHandle amp CommLinkData DisplayCheckDataLink dpaHandle If CommLink was successful then check RestoreCommStatus RestoreCommLink dpaHandle DataLink i e if void DisplayCheckDataLink short dpaHandle char szVersion 81 ReturnStatusType CheckDataStatus CheckDataStatus CheckDataLink dpaHandle szVersion if CheckDataStatus eNoError MessageBox NULL szVersion CheckDataLink MB OK else MessageBox NULL DataLink is not responding CheckDataLink MB OK 30 Cd Reference the J1939 Specification for more information regarding BAM and RTS CTS 4 4 2 Function Syntax Prototype Remarks DPA FAMILY USER S MANUAL 2004 ConfigureTransportProtocol Sets the timing and size parameters necessary for a J1939 Transport Protocol session ReturnStatusType ConfigureTransportProtocol short dpaHandle Configu
89. m2 unsigned char bParam3 unsigned char bParam4 void CALLBACK pfDataLinkError MailBoxType DataLinkErrorType void CALLBACK pfTransmitVector MailBoxType void CALLBACK pfReceiveVector void InitDataLinkType bProtocol the network protocol types elSO9141 ISO9141 protocol eJ1708 J1708 protocol eJ1939 J1939 protocol eCAN CAN protocol bParam0 bParam4 Specific parameters for the various protocol types described in the following section Three callback functions for DataLinkError TransmitVector and ReceiveVector are provided see below 39 DPA FAMILY USER S MANUAL 2004 For CAN bParam0 is an unsigned character hex that will be loaded into the Intel 82527 s Bit Timing Register 0 Reference Appendix B 3 bParaml is an unsigned character hex that will be loaded into the Intel 82527 s Bit Timing Register 1 Reference Appendix B 3 bParam2 CAN Datalink Control parameters 0x00 DPA Hardware prioritizes 29 bit CAN Identifiers 0x01 DPA Hardware prioritizes 11 bit CAN Identifiers 0x03 Enable J1939 Transport Protocol Layer DPA Hardware prioritizes 29 bit CAN Identifiers Note LoadMailbox Settings for the J1939 transport protocol have no effect unless this datalink parameter is used bParamd is used to set redundant filtering 0 disabled 1 enabled Single Wire CAN Physical Layer DPA II DPA II Plus do support In order for the DPA hardware to utilize the
90. mand shall set the protocol timing parameters within the network adapter Calling of this command does not result in a KWP message to the ECU Parameters shall be expressed in units of milliseconds Prior to this command being used the network adapter shall use the default values defined below SET_TIMING PARAMETERS TABLE VALUE DESCRIPTION Inter byte time in the ECU response message P Time between end of tester request and start of ECU response inter block time P Time between end of ECU response and start of new tester request inter block time P 3 Inter byte time in the tester request message MESSAGE FLOW TIMING Tester ECU Tester request response request e block message a icin i RES 96 DPA FAMILY USER S MANUAL 2004 4 5 4 SET COM PARAMETER 1 API Example RET SET COM PARAMETER 1 INT Timelnit Low INT Timelnit High BYTE DataBit BYTE ParityBit Timelnit Low Timelnit High expressed in milliseconds DataBit ParityBit Communication parameters RET 0 OK RET 1 TIME OUT COMMAND Action This command shall set communication parameters in the network adapter The application software must call this command successfully before the START COMMUNICATION command is called The network adapter shall only process this command BEFORE communication has been initialized with the ECU This command does not result in a KWP message Parameters in this command are only includ
91. mation e g ID transmit time broadcast time broadcast count or data from a previously opened transmit mailbox Syntax ReturnStatusType UpdateTransmitMailBox short dpaHandle MailBoxType pMailBoxHandle unsigned char bUpdateFlag Prototype dpaml6 h or dpaM32 h Remarks UpdateTransmitMailBox allows the application to change any of the parameters included inside a transmit mailbox If you update the data in the pMailBoxHandle but do not set the bUpdateFlag for that data to be updated then the data will no be updated Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA MailBoxType Structure defined in Appendix A 3 pMailBoxHandle A pointer to the mailbox s unique name or handle bUpdateFlag Identifies which fields of the mailbox should be updated Valid values for bUpdateFlag are defined in section A 1 Return Value UpdateTransMailBox returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eMailBoxNotActive eCommLinkNotlInitialized eSyncCommandNotAllowed Example 1 This example illustrates an update of the data inside a transmit mailbox void UpdateCANData MailBoxType TransmitCANHandle unsigned char ucUpdateData 9 unsigned char bUpdateFlag strcpy char UpdateData 12345678 T
92. mmStatus short dpaHandle PCCardData bBaseAddress 0x200 PCCardData bIrq 7 InitCommStatus InitPCCard amp dpaHandle amp PCCardData RestoreCommStatus RestorePCCard dpaHandle 51 DPA FAMILY USER S MANUAL 2004 4 4 9 LoadDPABuffer Function Loads data into the DPA s internal buffer scratch pad Syntax ReturnStatusType LoadDPABuffer short dpaHandle unsigned char bData unsigned int wLength unsigned int wOffset Prototype dpaml6 h or dpam32 h Remarks LoadDPABuffer points to the current data location assigns a length value for the data and indicates an offset for data placement There are limits on the amount of data that can be passed across the serial link in a single call These limits will differ between 16 bit and 32 bit applications Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA bData Pointer to the data to be loaded into the buffer wLength Number of bytes to transfer wOffset Buffer address to which writing should start Return Value LoadDPABuffer returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eCommLinkNotInitialized Example This example loads data into the IO buffer at address 21 void WriteAppID unsigned char ucAppID int iLength void LoadDPAB
93. n be used when it is necessary to implement the J1939 Transport DPA FAMILY USER S MANUAL 2004 Protocol The Transport Protocol is only used by J1939 Shown below is a sample function calling the ConfigureTransportProtocol function void Tes Co GE CE ct et et et ct ct CE ct CE CE Co tConfigureTransportProtocol short dpaHandle nfigureTransportType cth h bProtocol eJ1939 h iBamTimeout 1000L h i BAM BAMTXTime 1000L h iBAM DataTXTime 10001 h iRTS Retry 23 h iRTS RetryTransmitTime 101 h iRTS TX Timeout 1000L h iRTS TX TransmitTime 100L h iRTS_RX_TimeoutData 5000L h iRTS_RX_TimeoutCMD 10001 h iRTS RX CTS Count 2 h iRTS TX CTS Count 5 nfigureTransportProtocol dpaHandle amp cth 33 DPA FAMILY USER S MANUAL 2004 44 3 DisableDataLink DPA 4 Only Function Disables a datalink on power up Syntax ReturnStatusType DisableDataLink short dpaHandle BYTE bProtocol Prototype dpam32 h or dpa32 h Remarks DisableDataLink sets a datalinks power up state to disabled This command is only available on the DPA 4 Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommLink InitPCCard InitUSBLink or InitDPA bProtocol Identified the protocol that you would like disabled on power up Return Value DisableDataLink returns eNoError on success In the event of an
94. nd timer callbacks ResumeTimer Resumes a previously paused timer function and re starts all transmits and callback interrupts 4 3 5 Buffer host scratch pad functions LoadDPABuffer Loads data into the DPA s I O buffer internal scratch memory ReadDPABuffer Reads data from the DPA s I O buffer internal scratch memory 28 DPA FAMILY USER S MANUAL 2004 4 4 DPA API function descriptions alphabetical order 4 4 1 CheckDataLink Function Returns an identifier specifying the manufacturer name the DLL version the version of firmware installed on the DPA and installed hardware capabilities Syntax ReturnStatusType CheckDataLink short dpaHandle char szVersion Prototype dpaml6 h or dpam32 h Remarks CheckDataLink returns an ASCII character string to szVersion The response is a NULL terminated ASCII string using as a delimiter and identifying the manufacturer the software version the hardware version the firmware version the protocol s available the buffer size and the host communication link Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA Manufacturer Hardware Version Protocols Comm Link Dearborn 5 00 2 00 Serial8 20 J1708 CAN 16Mhz BUF4096 H115K Software Version E Version Buffer Size Return Value CheckDataLink returns eNoError on success In the event of an error one of the fo
95. o The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA MailBoxType Structure defined in Appendix A 3 pMailBoxHandle A pointer to the mailbox s unique name or handle Return Value UnloadMailBox returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eMailBoxNotActive eCommLinkNotInitialized eSyncCommandNotAllowed Example This example illustrates the unloading of the mailbox specified by the mailbox handle TransmitCANHandle void UnloadMailBox dpaHandle TransmitCANHandle 87 DPA FAMILY USER S MANUAL 2004 4 4 30 UpdateReceiveMailBox Function Updates the data count data location identifier and identifier mask of an open receive mailbox Syntax ReturnStatusType UpdateReceiveMailBox short dpaHandle MailBoxType pMailBoxHandle unsigned char bUpdateFlag Prototype dpaml6 h or dpam32 h Remarks Updates the receive mailbox parameters data count identifier identifier filter etc fo ra specific mailbox Any message that has already been placed inside the DPA s internal buffer will not be overwritten After this command is received by the DPA the filtering of messages for that mailbox will be modified If you update the data in the pMailBoxHandle but do not set the bUpdateFlag for that data to be updated then the data will no be updated Function Parameters dpaHandle
96. o it is initialized again The entries in the DG DPA32 ini file are as follows DPAParams DPAIV USB Interface 0 HS or FS Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitUSBLink InitPCCard or InitDPA Return Value RestoreUSBLink returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout Example RestoreUSBLink dpaHandle 107 DPA FAMILY USER S MANUAL 2004 4 6 2 InitUSBLink Function Specifies and initializes communication between the PC and the Protocol Adapter Syntax ReturnStatusType InitUSBLink short dpaHandle USBLinkType USBLinkData Prototype In dpam32 h or dpa32 h Remarks InitUSBLink is used to initialize communications between the PC and the DPA by identifying the USB speed This function must be called before any other library functions are called When nitUSBLink is called the appropriate interrupt vector pointers are saved so that they can be restored using RestoreUSBLink The USBLinkType structure is as follows typedef struct WORD wInterface BYTE bHS FS USBLinkType wInterface The USB interface to use Set to 0 bHS FS High speed or Full speed USB eFullSpeed 0 default eHighSpeed 1 Return Value nitUSBLink returns eNoError on success In the event of an error return
97. of FFH should be used HexVale Byte Lm x opoo ooro Mak FER r1j 1 t 1 1 1 I l Result 28H OjO 1 0 1 0 0 0 The result is that only the 28H value will satisfy the filter or trigger condition B 3 CAN Bit timing registers The CAN Bit Timing Registers BTRs are the registers that determine bus speed They also set up sampling and re synchronization of the CAN controller Different networks use different parameters for these values In fact there are several combinations that can all generate the same bus speed The DPA uses an 80C196CA micro controller with an 82527 CAN controller on board The crystal is 16 MHz The following is a brief overview of the bit timing registers Please reference the documents listed in section 1 3 for more information The CAN controller has two registers BTRO and BTR1 used to determine bus speed Common values for networks are as follows DeviceNet 125 kbps 0x03 Ox1C 250 Kbps 0x01 0x1C 500 Kbps 0x00 Ox1C 129 DPA FAMILY USER S MANUAL 2004 Register BTRO 7 6 5 4 3 2 1 0 Synchronization Jump Width Defines the maximum number of time quanta by which re synchronization can modify tseg1 and tseg2 Baud rate Prescaler Defines the length of one time quantum tq Register BTR1 TSEG2 2 TSEG2 1 TSEG2 0 TSEG1 3 TSEG1 2 TSEG1 1 TSEG1 0 Sampling Mode Specifies the number of samples when determining a valid bit value 1 3 samples using
98. omm Comm tType ResetData DpaHandle LinkData bCommPort eComm2 LinkData bBaudRate eB115200 InitCommStatus InitCommLink amp DpaHandle amp CommLinkData Rese tData bResetType eFullReset 73 DPA FAMILY USER S MANUAL 2004 ResetStatus ResetDPA DpaHandle ResetData RestoreCommStatus RestoreCommLink DpaHandle 74 DPA FAMILY USER S MANUAL 2004 4 4 18 RestoreCommLink Function Syntax Prototype Remarks Restores the communication port between the PC and the DPA to its previous pre nitCommLink state ReturnStatusType RestoreCommLink short dpaHandle dpam16 h or dpam32 h RestoreCommLink is used to restore any and all interrupt vectors that were set up during InitCommLink Once RestoreCommLink is called no other library functions for the restored device can be called until communication to it is initialized again Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommLink InitPCCard InitUSBLink or InitDPA Return Value RestoreCommLink returns eNoError on success Example incl incl incl void In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eSyncCommandNotAllowed ude lt windows h gt ude lt stdio h gt ude dpam32 h main void CommLinkType CommLinkData ReturnStatusType InitCommStat
99. on command using the TransmitMailBox function TransmitMailBox can be used an unlimited number of times include lt windows h gt include dpam32 h void TestLoadMailBox short dpaHandle LoadMailBoxType oadMailBoxData ReturnStatusType oadMailBoxStatus TransmitStatus UnloadMailBoxStatus unsigned char bTransmitData 8 index MailBoxType TransmitHandle NULL load structure with data memset amp LoadMailBoxData 0 sizeof LoadMailBoxType oadMailBoxData bProtocol eJ1939 oadMailBoxData bRemote Data eDataMailBox oadMailBoxData bResidentOrReleas eResident oadMailBoxData bBitlidentSize 29 oadMailBoxData bTransportType eTransportNone oadMailBoxData dwMailBoxIdent 0x00001234L oadMailBoxData wDataCount 8 oadMailBoxData bTimeAbsolute FALSE oadMailBoxData dwTimeStamp 0x00L oadMailBoxData dwBroadcastTime 0x00L oadMailBoxData iBroadcastCount 1 oadMailBoxData pfApplicationRoutine NULL oadMailBoxData vpData bTransmitData oadMailBoxStatus LoadMailBox dpaHandle amp LoadMailBoxData if LoadMailBoxStatus eNoError TransmitHandle LoadMailBoxData pMailBoxHandle if TransmitHandle NULL if mailbox was succesfully created then transmit data 4 times for index 0 index lt 4 index TransmitStatus TransmitMailBox dpahandle TransmitHandle
100. or MessageBox NULL DataLink successfully stored StoreDataLink MB OK StoreDataLink is now a stand alone program that is included with and works only with the DPA 4 including the DPA 4 Serial and USB versions and also the DPA RF Base Station The program is used to customize the DPA 4 power up parameters so it can be used either in the Passenger Car or Truck amp Bus market The StoreDataLink program is used to define and set the data link defaults used by the DPA 4 during power up The StoreDataLink program writes the power up parameters to the DPA 4 Flash Memory and only needs be done once The DPA 4 needs to be connected to the computer that is running the StoreDataLink program The StoreDataLink program requires the DPA 4 Firmware v33 12 or later 83 DPA FAMILY USER S MANUAL 2004 4 4 26 SuspendTimerlnterrupt Function Disables a DPA timer interrupt Syntax ReturnStatusType SuspendTimerInterrupt short dpaHandle Prototype dpaml6 or dpam32 h Remarks SuspendTimerInterrupt disables the DPA timer interrupt Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA Return Value SuspendTimerInterrupt returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eCommLinkNotlInitialized eSyncCommandNotAll
101. ority define UPDATE ID MASK 0x10 update ID MASK MID PID Priority ONLY valid for receive define UPDATE DATA 0x01 update data inihibit flags define TimeStamp Inhibit 0x20 define ID_ Inhibit 0x40 define Data_Inhibit 0x80 A 2 Typedefs Enumerations for CommPortType typedef enum CommPortType eComml eComm2 eComm3 eComm4 eComm eComm6 eComm7 eComm 112 DPA FAMILY USER S MANUAL 2004 eComm9 CommPortType Enumerations for BaudRatelype typedef enum BaudRateType eB9600 eB19200 eB28800 eB38400 eB57600 eB115200 eB230400 eB460800 BaudRateType Enumerations for Protoco Type typedef enum ProtocolType elSO9141 eJ1708 eJ1850 eJ1939 ePassThru eUSB eRS232 eCAN 3 ProtocolType Enumerations for Reset7ype typedef enum eFullReset eCommReset eResetType 113 Enumerations for ReturnStatusType typedef enum ReturnStatusType eNoError eDeviceTimeout eProtocolNotSupported eBaudRateNotSupported eInvalidBitIdentSize elInvalidDataCount eInvalidMailBox eNoDataA vailable eMailBoxInUse eMailBoxNotActive eMailBoxNotAvailable eTimerNotSupported eTimeoutValueOutOfRange eInvalidTimerValue eInvalidMailBoxDirection eSerialIncorrectPort eSerialIncorrectBaud eSerialPortNotFound eSerialPortTimeout eCommLinkNotInitialized eAsyncCommBusy eSyncCommlInCallBack eAsyncCommandNotAllowed eSyncCommandNotAllowed eLinkedMailBox
102. owed Example To use this function simply make the following call in your program SuspendTimerInterrupt dpaHandle 84 DPA FAMILY USER S MANUAL 2004 4 4 27 TransmitMailBox Function Sends messages using previously opened mailboxes Syntax ReturnStatusType TransmitMailBox short dpaHandle MailBoxType pMailBoxHandle Prototype dpaml6 h or dpam32 h Remarks TransmitMailBox is used to transmit already loaded mailboxes Once established data can only be updated with the UpdateTransMailBoxData function before the TransmitMailBox function is re called Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL ink InitPCCard InitUSBLink or InitDPA MailBoxType Structure defined in Appendix A 3 pMailBoxHandle A pointer to the mailbox s unique name or handle Return Value 7ransmitMailBox returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions DeviceTimeout eInvalidMailBox eCommLinkNotInitialized eSyncCommandNotAllowed Example This example sends the specified mailbox once with no modification to any of the mailbox parameters void TransmitMailBox dpaHandle TransmitCANHandle 85 DPA FAMILY USER S MANUAL 2004 4 4 28 TransmitMailBoxAsync Function Sends messages asynchronously using previously opened mailboxes from a function within a
103. oxReturn unsigned char dummyData 9 memset amp loadMailboxStruct 0 sizeof LoadMailBoxType loadMailboxStruct bProtocol eJ1850 loadMailboxStruct bBitIdentSize 24 loadMailboxStruct dwMailBoxIdent 0x00000000ul loadMailboxStruct wDataCount 0 loadMailboxStruct vpData dummyData loadMailboxStruct bResidentOrRelease eResident retain mbox loadMailboxStruct bTransportType eTransportNone loadMailboxStruct loadMailboxStruct loadMailboxStruct loadMailboxStruct dwBroadcastTime 0 loadMailboxStruct bRemote_Data eDataMailBox loadMailboxStruct bTimeAbsolute FALSE loadMailboxStruct dwTimeStamp 0 loadMailboxStruct iBroadcastCount 0 loadMailboxStruct vpUserPointer NULL loadMailboxStruct pfApplicationRoutine transmitCallback ExtendedPtrMode FALSE ExtendedOffset 0 DataInhibit 0 ome oat om om cat loadMboxReturn LoadMailBox dpaHandle amp loadMailboxStruct 63 Example 10 DPA FAMILY USER S MANUAL 2004 This example loads a J1850 receive resident mailbox with receiveCallback as the callback No message filtering and max data count of 9 LoadMailBoxType loadMailbox ReturnStatusType dgStatus receiveCallback MailBoxType rxMailbox memset amp loadMailbox 0 sizeof LoadMailBoxType loadMailbox bRemote Data eRemoteMailBox loadMailbox bTransparentUpdateEn
104. pe CallBackHandle NULL load Receive MailBox for callback memset amp LoadMailBoxData 0 sizeof LoadMailBoxType oadMailBoxData bProtocol eJ1939 oadMailBoxData bRemote Data eRemoteMailBox oadMailBoxData bBitlidentSize 29 oadMailBoxData bTransportType eTransportNone oadMailBoxData dwMailBoxIdent 0x00001234L ioadMailBoxData dwMailBoxIdentMask 0x00L oadMailBoxData bTransparentUpdateEnable FALSE oadMailBoxData bTimeStampInhibit FALSE ioadMailBoxData bIDInhibit FALSE oadMailBoxData wDataCount 8 oadMailBoxData pfApplicationRoutine CallBackRoutine oadMailBoxData vpData bCallBackBuffer oadMailBoxStatus LoadMailBox dpaHandle amp LoadMailBoxData if LoadMailBoxStatus eNoError CallBackHandle LoadMailBoxData pMailBoxHandle unload mailbox now that we are done UnloadMailBoxStatus UnloadMailBox dpaHandle CallBackHandle CallBackHandle NULL 56 DPA FAMILY USER S MANUAL 2004 Example 3 This example illustrates the creation of a mailbox used to receive messages on request only using the ReceiveMailBox function include lt windows h gt include dpam32 h void TestLoadMailBox short dpaHandle LoadMailBoxType LoadMailBoxData ReturnStatusType LoadMailBoxStatus ReceiveMailBoxStatus UnloadMailBoxStatus
105. rReleas eRelease oadMailBoxData bBitlidentSize 29 oadMailBoxData dwMailBoxIdent 0x00001234L oadMailBoxData wDataCount 1000 1 to 1785 bytes oadMailBoxData bTimeAbsolute FALSE oadMailBoxData dwTimeStamp 0x00L oadMailBoxData dwBroadcastTime 0L oadMailBoxData iBroadcastCount 1L oadMailBoxData pfApplicationRoutine CallBackRoutine oadMailBoxData vpData bTransmitData The following elements are for transport Extended pointer mode must be used anytime that the data is longer than 8 bytes he dpa buffer where t it may be necessary to use the LoadDPABuffer load the data into the buffer befor extended of be stored command mailbox to TRU F fset is the offset into t In 16 bit to The he data will the load command tel If you use this me ling the driver that the 17 When using transport protocol inform the application when the transport pro a tra completed thod data is already in nsmit callback should you call set the bDataIn t hibit flag he buffer be used to n has tocol sessio oadMailBoxData bDatalnhibit FALSE oadMailBoxData bTransportType eTransportRTS oadMailBoxData bExtendedPtrMode TRUE oadMailBoxData wExtendedOffset 0 Offset into the DPA Buffer oadMailBoxData bCTSSource DestinationAddress oadMailBoxStatus LoadMailBox dpaHandle amp LoadMailBoxData if LoadM
106. ransmitCANHandle gt vpData UpdateData bUpdateFlag UPDATE DATA void UpdateTransmitMailBox dpahandle TransmitCANHandle bUpdateFlag 92 DPA FAMILY USER S MANUAL 2004 Example 2 This example shows the updating of the Broadcast count to zero in essence terminating broadcast void ShutOffTransmit MailBoxType TransmitCANHandle unsigned char ucUpdateData 9 unsigned char bUpdateFlag TransmitCANHandle iBroadcastCount 0 bUpdateFlag UPDATE_BROADCAST_COUNT void UpdateTransmitMailBox dpaHandle TransmitCANHandle bUpdateFlag Example 3 This example updates both the broadcast time and the broadcast count causing the specified mailbox to be broadcast the specified number of times at 100 millisecond intervals ReturnStatusType BroadCastCount100ms MailBoxType TransmitCANHandle signed int iBroadCastCount Update Broadcast Time TransmitCANHandle dwBroadcastTime 100 bUpdateFlag UPDATE BROADCAST TIME Load Broad Cast Count TransmitCANHandle gt iBroadcastCount bUpdateFlag UPDATE BROADCAST COUNT iBroadCastCount Send Command to DPA and return response return UpdateTransmitMailBox dpaHandle TransmitCANHandle bUpdateFlag 93 DPA FAMILY USER S MANUAL 2004 4 4 35 UpdateTransmitMailBoxAsync Function Syntax Prototype Remarks Updates any information e g ID transmit time broadcast time broadca
107. reTransportType dpam16 h or dpam32 This routine allows configuration of the Transport Protocol either as a Broadcast Announce Message BAM or a Request To Send Clear To Send RTS CTS session For BAM the transmit time and receive timeouts must be set For CTS RTS the timeouts data times and CTS size must be set The following LoadMailBoxType parameters must be configured for each mailbox bTransportType Identifies session type RTS CTS or BAM CTSSource Destination address for the RTS transport Note The J1939 data link must be initialized using the InitCommLink function call with the following parameters passed bProtocol J1939 bParam2 3 All undefined values will default to the J1939 recommended value Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommLink InitPCCard InitUSBLink or InitDPA typedef struct byte bProtocol word iBamTimeOut word iBam_BAMTXTime word iBam DataTXTime word iRTS Retry word iRTS RetryTransmitTime word iRTS TX Timeout word iRTS TX TransmitTime word iRTS RX TimeoutData word iRTS RX TimeoutCMD word iRTS RX CTS Count word iRTS TX CTS Count ConfigureTransportType 31 DPA FAMILY USER S MANUAL 2004 bProtocol The protocol selected for the mailbox Must be eJ1939 J1939 iBamTimeOut The BAM timeout 1 bit 10 millisecond the maximum time allowed between messages before a timeout oc
108. rom a function within a callback ISR UpdateTransMailBoxData pdates information in a previously opened broadcast mailbox C pdateTransMailBoxDataAsync pdates information from within a callback in a broadcast mailbox pdateTransmitMailBox pdates any information e g ID transmit time broadcast time broadcast count or data from a previously opened transmit mailbox U U U U UpdateTransmitMailBoxAsync For use inside a callback routine Updates any information e g ID transmit time broadcast time broadcast count or data from a previously opened transmit mailbox 27 DPA FAMILY USER S MANUAL 2004 Receive MailBox Retrieves the latest message from a specific mailbox UpdateReceiveMailBox Updates the data count data location identifier and identifier mask from a previously opened receive mailbox UpdateReceiveMailBoxAsync For use inside a callback routine Updates the data count data location identifier and identifier mask from a previously opened receive mailbox UnloadMailBox Closes a previously opened mailbox 4 3 4 Timer functions LoadTimer Sets the timer for the time stamping of received and transmitted messages RequestTimerValue Returns the current DPA timer value EnableTimerlnterrupt Enables a timer interrupt from the DPA to call a user supplied callback function SuspendTimerlnterrupt Disables a DPA timer interrupt PauseTimer Pauses the timer and suspends transmits a
109. rt dpaHandle MailBoxType pMailBoxHandle unsigned char bUpdateFlag dpam16 h or dpam32 h UpdateReceiveMailBoxAsync updates the receive mailbox parameters data count identifier identifier filter etc for a specific mailbox Any message that has already been placed inside the DPA a internal buffer will not be overwritten After this command is received by the DPA the filtering of messages for that mailbox will be modified This function is for use inside a callback routine If you update the data in the pMailBoxHandle but do not set the bUpdateFlag for that data to be updated then the data will no be updated Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommLink InitPCCard InitUSBLink or InitDPA MailBoxType Structure defined in Appendix A 3 pMailBoxHandle A pointer to the mailbox s unique name or handle bUpdateFlag Identifies which fields of the mailbox should be updated Valid values for bUpdateFlag are defined in section A1 Return Value UpdateReceiveMailBoxAsync returns eNoError on success Example In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eMailBoxNotActive eCommLinkNotlInitialized eSyncCommandNotAllowed This is an example of how to update and retransmit data in a receive callback routine ReturnStatusType CALLBACK ReceiveCallBack void M
110. rt dpaHandle MailBoxType pMailBoxHandle ReturnStatusType far UpdateTransMailBoxData short dpaHandle MailBox Type pMailBoxHandle ReturnStatusType far UpdateTransMailBoxDataAsync short dpaHandle MailBoxType pMailBoxHandle ReturnStatusType E UpdateTransmitMailBox short dpaHandle MailBoxType pMailBoxHandle unsigned char bUpdateFlag ReturnStatusType far UpdateTransmitMailBoxAsync short dpaHandle MailBoxType pMailBoxHandle unsigned char D pdatsFlagy ReturnStatusType far ReceiveMailBox short dpaHandle MailBoxType pMailBoxHandle ReturnStatusType far UnloadMailBox short dpaHandle MailBox Type pMailBoxHandle ReturnStatusType far LoadTimer short dpaHandle unsigned long dwTime ReturnStatusType far EnableTimerInterrupt short dpaHandle Enable TimerInterruptT ype pEnableTimerInterruptData ReturnStatusType far SuspendTimerInterrupt short dpaHandle ReturnStatusType far RequestTimerValue short dpaHandle unsigned long dwTimerValue else 126 DPA FAMILY USER S MANUAL 2004 APPENDIX B FILTERS MASKS AND CAN BIT TIMING REGISTERS B 1 Filters Masks for CAN The DPA uses filters or masks to eliminate messages at the hardware level to help restrict the load on your application This is accomplished using parameters in the LoadMailBox Type structure dwMailBoxlIdent The identifier for the mailbox dwMailBoxIdentMask The mask for the mailbox bFilterType The filter type for the mail
111. s Restores the communication port between the PC and the DPA to its previous pre nitPCCard state ReturnStatusType RestorePCCard short dpaHandle dpam16 h or dpam32 h RestorePCCard is used to restore any and all interrupt vectors that were set up during nitPCCard Once RestorePCCard is called no other library functions for the restored device can be called until communication to it is initialized again Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA Return Value RestorePCCard returns eNoError on success Example incl incl incl void In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eSyncCommandNotAllowed ude lt windows h gt ude lt stdio h gt ude dpam32 h main void PCCardType PCCardData ReturnStatusType InitCommStatus RestoreCommStatus short dpaHandle PCCardData bBaseAddress 0x200 PCCardData bIrq 7 InitCommStatus InitPCCard amp dpaHandle amp PCCardData ReturnStatusType RestorePCCard dpaHandle 78 DPA FAMILY USER S MANUAL 2004 4 4 22 RequestTimerValue Function Returns the current DPA timer value Syntax ReturnStatusType RequestTimerValue short dpaHandle long unsigned int dwTimerValue Prototype dpaml6 h or dpam32 h Remarks RequestTimerValue returns
112. single DPA interface and a multiple DPA interface The single DPA interface DPA16 DLL DPA32 DLL allows communication to one DPA at a time in a given application This interface is recommended for applications that have code that has been written for previous version of the DPA API The single DPA interface is the only interface that is provided for DOS drivers The multiple DPA interface DPAM16 DLL DPAM32 DLL allows an application to communicate to more than one DPA The Multiple DPA interface is very similar to the single DPA interface From a programmers perspective the only difference is that the multi interface function calls take a dpaHandle parameter as the first parameter passed in When an application opens a DPA for communication a DPA Handle is returned This handle is passed to all future DPA calls to identify the DPA that the call is for The Multiple DPA interface allows an application to communicate with multiple DPA s simultaneously This interface is recommended for all new software development Example Single DPA Driver Status CheckDataLink VersionString Example Multiple DPA Driver Status CheckDataLink dpaHandle VersionString For additional help choosing the correct driver refer to Appendix C Choosing the Correct Driver for a Given Application 4 3 The DPA API functions list The Protocol Adapter Library API includes five function types system functions data link configuration functions message
113. st count or data in a previously opened transmit mailbox For use inside a Callback routine ReturnStatusTypeUpdateTransmitMailBoxAsync short dpaHandle MailBoxType pMailBoxHandle unsigned char bUpdateFlag dpam16 h or dpam32 h UpdateTransmitMailBoxAsync allows the application to change any of the parameters included inside a transmit mailbox for use inside a callback routine If you update the data in the pMailBoxHandle but do not set the bUpdateFlag for that data to be updated then the data will no be updated Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA MailBoxType Structure defined in Appendix A 3 pMailBoxHandle A pointer to the mailbox s unique name or handle bUpdateFlag Identifies which fields of the mailbox should be updated Valid values for bUpdateFlag are defined in section A 1 Return Value UpdateTransMailBoxDataAsync returns eNoError on success Example In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eMailBoxNotActive eCommLinkNotInitialized This example updates the Broadcast count to zero in essence terminating the broadcast void CALLBACK ShutOffTransmit unsigned char ucUpdateData 9 unsigned char bUpdateFlag TransmitCANHandle gt iBroadcastCount 0 bUpdateFlag UPDATE BROADCAS
114. t datalink parameters from the DPA If power up parameters are availabe and InitDataLink has not been called the power up parameters are put into the ReadDataLinkData variable This command is only available on the DPA 4 Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA bProtocol Identified the protocol that you would like information about ReadDataLinkType Structure that contains datalink information DataSize Variable Name Description BYTE bProtocol Specific protocol that you would like to read info from BYTE bParamCount Number of parameters used for a given protocol BYTE bParam0 Parameter zero BYTE bParaml Parameter one BYTE bParam2 Parameter two BYTE bParam3 Parameter three BYTE bParam4 Parameter four Return Value ReadDataLink returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eProtocolNotSupported eCommLinkNotInitialized Example This example reads the current datalink settings for CAN finclude lt windows h gt include lt stdio h gt include dpam32 h 67 DPA FAMILY USER S MANUAL 2004 void DisplayInitDataLink short dpaHandle void ReadCurrentCANSettings void ReturnStatusType InitStatus ReadStatus RestoreStatus short dpaHandle
115. tStatus UnloadMailBoxStatus unsigned char bTransmitData 8 index MailBoxType TransmitHandle NULL load structure with data memset amp LoadMailBoxData 0 sizeof LoadMailBoxType oadMailBoxData bProtocol eJ1939 oadMailBoxData bRemote Data eDataMailBox oadMailBoxData bResidentOrReleas eResident oadMailBoxData bBitlidentSize 29 oadMailBoxData bTransportType eTransportNone oadMailBoxData dwMailBoxIdent 0x00001234L oadMailBoxData wDataCount 8 oadMailBoxData bTimeAbsolute FALSE oadMailBoxData dwTimeStamp 0x00L oadMailBoxData dwBroadcastTime 0x00L oadMailBoxData iBroadcastCount 0 oadMailBoxData pfApplicationRoutine NULL oadMailBoxData vpData bTransmitData oadMailBoxStatus LoadMailBox dpaHandle amp LoadMailBoxData if LoadMailBoxStatus eNoError TransmitHandle LoadMailBoxData pMailBoxHandle if TransmitHandle NULL if mailbox was succesfully created then transmit data 4 times for index 0 index lt 4 index TransmitStatus TransmitMailBox dpaHandle TransmitHandle unload mailbox now that we are done UnloadMailBoxStatus UnloadMailBox dpaHandle TransmitHandle TransmitHandle NULL 58 DPA FAMILY USER S MANUAL 2004 Example 5 This example illustrates the creation of a mailbox used to transmit once when created and then
116. ta in a received data message bDatalnhibit Flag for removing data in receive data message bLinkType J1708 link type for multiple PIDs bLink J1708 link for multiple PIDs 120 bPriority J1708 priority bMID J1708 MID bPID J1708 PID bMIDMask J1708 MID mask bPIDMask J1708 PID mask DPA FAMILY USER S MANUAL 2004 bDataRequested Flag indicating that data has been requested from the DPA bReceiveFlags Flag used internally indicating that requested data has arrived Can not be changed or cleared by the user bDataUpdated Flag indicating that data has been updated vpData Address of user s copy of message data vpUserPointer A user defined pointer typical use for a this pointer Structure for initializing the DPA Data link typedef struct unsigned unsigned unsigned unsigned unsigned unsigned char char char char char char bProtocol bParam0 bParaml bParam2 bParam3 bParam4 void CALLBACK pfDataLinkError MailBoxType DataLinkErrorType void CALLBACK pfTransmitVector MailBoxType void CALLBACK pfReceiveVector void InitDataLinkType 121 Key Elements for LoadMailBox Structure DPA FAMILY USER S MANUAL J1708 RCV J1708 XMIT typedef struct unsigned char bProtocol X MailBoxType pMailBoxHandle X unsigned char bRemot
117. times out without a response Note A solution may be implemented in which the network adapter does not need to send out a separate TesterPresent message if the network adapter is already sending out TesterPresent Request Messages 4 5 10 SEND MESSAGE API Example RET SEND MESSAGE BYTE MSG LEN BYTE DATA BYTE MSG LENRX BYTE DATARX RET 0 OK RET 1 TIME OUT COMMAND This API can be used for transmitting and receiving data from the ECU s It requires the MSG LEN byte and the DATA array bytes it contains the application data bytes The header bytes and the checksum byte are handled by the protocol layer application running in the network adapter This command shall return a 0 after the ECU response is received and the data and message length have been stored in the memory space indicated by DATARX and 105 DPA FAMILY USER S MANUAL 2004 MSG_LENRX The MSG_LEN and DATA are pointer variables so the receiving data can be stored in the same memory space The network adapter shall allocate enough memory space to receive the maximum sized KWP message 255 data bytes 260 bytes total with header and checksum SEND_MESSAGE KW2000 MESSAGE Format Byte OPTIONAL Target Byte IDES MeaderBytes Source Byte OPTIONAL Length Byte MsgLen n lt DATA1 gt lt Serviceld gt lt Service Name gt Request Service Identifier lt DATAn gt lt Par
118. tion XXX DPAParams ParameterInformation Examples DPAInformation101 DPAParams DPAII COM1 DPAInformation103 DPAParams DPAII COM1 POLLED DPAInformation201 DPAParams DPAIV H COMI DPAInformation301 DPAParams DPAIILISA 0x512 5 DPAInformation501 DPAParams TCP IP IP 192 168 0 4 PORT 19485 Unlike the RP1210a you can use any DevicelD RP1210a says to use 100 999 7 x Key Words e COM it s a serial device load DPAS32 dll or DPAH32 dll depending on entry o HorIV use the DPAH32 driver DPA IV RF handshaking o if H or IV is NOT in the string use the DPAS driver DPA II II III handshaking o COM x communications port to connect to COMI COM9 48 DPA FAMILY USER S MANUAL 2004 o B xxxx serial baud rate to connect at if not specified the default is B115200 o POLL polled read thread not used very often default is non polled e ISA or PC CARD it s an ISA or PC CARD load DPAI32 dll o Ox xx x Base Address IRQ to connect at e TCP IP it s a TCP IP connection load DPAT32 dll o IP xxx xxx xxx xxx PORT x IP Address Port 8 x Key Words e Same as above with one added entry e USB USB connection load DPAU xx dll xx depends on operating system 49 4 4 8 Function Syntax Prototype Remarks DPA FAMILY USER S MANUAL 2004 InitPCCard Specifies and initializes communication between the PC and the DPA ReturnStatusType InitPCCard short dpa
119. tocol type same as previous values bErrorCode Error code CALLBACK pfTransmitVector MailBoxType Calls a routine pointed at by pfTransmitVector when a messages is transmitted NULL disables this callback 42 DPA FAMILY USER S MANUAL 2004 MailBoxType definition is located in Appendix A 3 Transmit callbacks may also be enabled on each mailbox CALLBACK pfReceiveVector Calls a routine pointed at by pfReceiveVector when a message is received NULL disables this callback Receive callbacks may also be enabled on each mailbox Return Value nitDataLink returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eProtocolNotSupported eCommLinkNotInitialized Example 1 This example initializes the CAN Data link to 250K bps 29 bit identifier preferred include include include eSyncCommandNotAllowed lt windows h gt lt stdio h gt dpam32 h void DisplayInitDataLink short dpaHandle void main void CommLinkType CommLinkData ReturnStatusType InitCommStatus short dpaHandle CommLinkData bCommPort eComm2 CommLinkData bBaudRate eB115200 InitCommStatus InitCommLink amp dpaHandle amp CommLinkData DisplayInitDataLink dpaHandle RestoreCommStatus RestoreCommStatus RestoreCommLink dpaHandle void DisplayInitDataLink short dpaHandle
120. tus eNoError RestoreDLStatus RestoreDataLink dpaHandle eJ1708 RestoreStatus RestoreDPA dpaHandle 76 DPA FAMILY USER S MANUAL 4 4 20 RestoreDPA Windows Only Function Syntax Prototype Remarks 2004 Restores the communication port between the PC and the DPA to its previous pre InitDPA state ReturnStatusType RestoreDPA short dpaHandle dpam16 h or dpam32 h RestoreDPA is used to restore any and all interrupt vectors that were set up during nitDPA Once RestoreDPA is called no other library functions for the restored device can be called until communication to it is initialized again Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommL nk InitPCCard InitUSBLink or InitDPA Return Value RestoreDPA returns eNoError on success Example incl incl incl void In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eSyncCommandNotAllowed ude ude ude windows h stdio h dpam32 h main void ReturnStatusType InitCommStatus ReturnStatusType RestoreCommStatus short dpaHandle InitCommStatus InitDPA amp dpaHandle 101 RestoreCommStatus RestoreDPA dpaHandl e 77 DPA FAMILY USER S MANUAL 2004 4 4 21 RestorePCCard Function Syntax Prototype Remark
121. uffer dpaHandle ucAppID iLength 21 52 DPA FAMILY USER S MANUAL 2004 4 4 10 LoadMailBox Function Syntax Prototype Remarks Opens or creates mailboxes for receiving and transmitting messages ReturnStatusType LoadMailBox short dpaHandle LoadMailBoxType pLoadMailBoxData dpam16 h or dpam32 h LoadMailBox opens creates mailboxes for the receiving and transmitting of messages according to the structures presented in section A 3 There are three types of mailboxes e Transmit Broadcast and Release used to send messages out a given number of times e Transmit Resident used to send a message on command e Receive When a Transmit mailbox is opened the host application determines e When the message is to be sent e How many times it is to be sent Broadcast Count e The time intervals between consecutive transmits Broadcast Time e Whether to automatically delete the mailbox after all messages are sent Resident or Release e Whether the host is to be notified when the message is sent TX Callback e Which ID CAN or MID PID J1708 is to be sent e What data should be sent When a Receive mailbox is opened the host application determines the following e Which bits should be masked and which ones should be matched in hardware level filtering See Appendix B Filter Masks e What information is needed when the message is received e Whether the host is to be notified
122. umes no responsibility for any intellectual property claims that may result from use of this material e No license is granted by implication or otherwise for any patents or any other rights of Dearborn Group Inc or of any third party DPA is a trademark of Dearborn Group Inc CAN is a trademark of Bosch Inc Other products are trademarks of their respective manufacturers Recent manual revision history Aug 18 2004 added redundant filtering information Jul 7 2004 revise RF hardware section for clarity and accuracy Apr 20 2004 revise StoreDataLink information for stand alone program release Feb 2 2004 corrections to driver installation instructions Nov 20 2003 miscellaneous edit corrections Sep 15 2003 add DPA RF installation instructions Aug 12 2003 add USB installation instructions new DPA 4 functions Index Dearborn Group ii Technology DPA FAMILY USER S MANUAL 2004 Table of Contents 1 0 INTRODUCTION WE 1 1 1 Documentation organization 2 1 2 Technical SUPPE EE 2 1 3 EE RE En dE E 2 0 HARDWARE GETTING STARTED au 5 2 1 Checking package contents schist Ion ocn Hoc Redde 5 2 2 SSOP AMAL Che dee 5 2 3 Power network connections 6 2A R5 232 Hardware EE 7 2 4 1 Hardware installation and setun sss ense n na nna nna nna nna nna ha annu aaa n nana uana nasus 7 2 4 2 Connection to tert 8 24 Checking Communication 9 2 5 ISA HARDWARE cuo esponenti nuper ior eina daa a
123. unload mailbox now that we are done UnloadMailBoxStatus UnloadMailBox dpaHandle TransmitHandle TransmitHandle NULL Example 6 59 DPA FAMILY USER S MANUAL 2004 This example illustrates the creation of a mailbox used to broadcast a message 100 times every 100 ms This example also illustrates the use of UpdateTransMailBoxData for the updating of data being broadcast include lt windows h gt include dpam32 h void TestLoadMailBox short dpaHandle LoadMailBoxType oadMailBoxData ReturnStatusType oadMailBoxStatus UpdateStatus UnloadMailBoxStatus unsigned char bTransmitData 8 bNewData 8 index MailBoxType TransmitHandle NULL load structure with data memset amp LoadMailBoxData 0 sizeof LoadMailBoxType oadMailBoxData bProtocol eJ1939 oadMailBoxData bRemote Data eDataMailBox oadMailBoxData bResidentOrReleas eRelease oadMailBoxData bBitlidentSize 29 oadMailBoxData bTransportType eTransportNone oadMailBoxData dwMailBoxIdent 0x00001234L oadMailBoxData wDataCount 8 oadMailBoxData bTimeAbsolute FALSE oadMailBoxData dwTimeStamp 0x00L oadMailBoxData dwBroadcastTime 1001 oadMailBoxData iBroadcastCount 10001 oadMailBoxData pfApplicationRoutine NULL oadMailBoxData vpData bTransmitData oadMailBoxStatus LoadMailBox dpaHandle amp LoadMailBoxD
124. us RestoreCommStatus short dpaHandle CommLinkData bCommPort eComm2 CommLinkData bBaudRate eB115200 InitCommStatus InitCommLink amp dpaHandle amp CommLinkData RestoreCommStatus RestoreCommLink dpaHandle 75 DPA FAMILY USER S MANUAL 2004 4 4 19 RestoreDataLink DPA 4 Only Function Restores a datalink to is power up parameters Syntax ReturnStatusType RestoreDataLink short dpaHandle BYTE bProtocol Prototype dpam32 h or dpa32 h Remarks RestoreDataLink restores a given datalink to its power up state If a datalink has no power up parameters then it is disabled This command is only available on the DPA 4 Function Parameters dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommLink InitPCCard InitUSBLink or InitDPA bProtocol Identified the protocol that you would like to restore to it power up state Return Value RestoreDataLink returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eProtocolNotSupported eCommLinkNotInitialized Example This example restores the J1708 datalink to its power up state include lt windows h gt include lt stdio h gt include dpam32 h void RestoreJ1708Settings void ReturnStatusType InitStatus RestoreDLStatus RestoreStatus short dpaHandle InitStatus InitDPA amp dpaHandle 601 if InitSta
125. when the message is sent TX Callback Yours truly should initialize all structure variables to zero before using the structure as shown in the following example Example LoadMailBox MyMBox memset amp MyMBox 0 sizeof LoadMailBox Function Parameters 53 DPA FAMILY USER S MANUAL 2004 dpaHandle Identifies the DPA to send this command to The handle is returned from InitCommLink InitPCCard InitUSBLink or InitDPA MailBoxType Structure found in section A 3 pMailBoxHandle Pointer to the mailbox s unique name handle Return Value LoadMailBox returns eNoError on success In the event of an error one of the following error codes may be returned see Appendix A 2 for error descriptions eDeviceTimeout eProtocolNotSupported eInvalidBitIdentSize eInvalidDataCount eMailBoxNotAvailable eCommLinkNotlInitialized eSyncCommandNotAllowed 54 DPA FAMILY USER S MANUAL 2004 Example 1 This example illustrates the creation of a Receive mailbox using transparent updating include lt windows h gt include dpam32 h unsigned char TransUpdateDataBuffer 8 void TestLoadMailBox short dpaHandle LoadMailBoxType LoadMailBoxData ReturnStatusType LoadMailBoxStatus UnloadMailBoxStatus MailBoxType TransUpdateHandle NULL load data for mailbox memset amp LoadMailBoxData 0 sizeof LoadMailBoxType
126. xx xxxx Note 2 Format byte is xx00 0000 The network adapter shall also store the Key Bytes in the memory address indicated by the KeyBytes parameter API command shall return 0 OK only after successful StartCommunication Positive Response has been received by the network adapter and the Key Bytes have been processed 4 5 8 STOP COMMUNICATION API Example RET STOP_COMMUNICATION RET 0 gt OK RET 1 gt TIME OUT COMMAND This command shall stop the communication with the ECU This command shall result in a StopCummunication Request message from the network adapter to the ECU The command shall return a 0 if the StopCommunication Positive Response is received from the ECU The command shall return 1 if the StopCommunication Negative Response is return or if the command times out 104 DPA FAMILY USER S MANUAL 2004 4 5 9 GEI STATUS API Example INT STATUS GET_STATUS STATUS 2 0 2 OK STATUS 1 TIME OUT COMMAND This command shall return the status of the KWP communication between the network adapter and the ECU The network adapter shall determine the status of communication between itself and the ECU by the presence of a TesterPresence Positive Response This command shall result in a TesterPresent Request Message The network adapter shall return a O if it successfully receives a TesterPresent Positive Response It shall return a 1 if it receives a TesterPresent Negative Response or if it

Download Pdf Manuals

image

Related Search

Related Contents

INTERSURGICAL FICHE TECHNIQUE  P-11SWL の取扱説明書を見る  Sandisk 8GB Cruzer Pop  cahier des charges informatique protide  Connecting the Iomega StorCenter px4-300r  USER MANUAL GEBRAUCHSANLEITUNG U S E R  DESAFIO TOTAL  Descargar catálogo completo de luces de  Rollei Pictureline 3007  Système de messagerie vocale Ascotel® IntelliGate  

Copyright © All rights reserved.
Failed to retrieve file