AIDA KWP2000 Component

The KWP2000 component implements the ISO/WD 14230 protocol and a variation of this for transport over CAN, the "KWP2000 auf TP2.0 (Vollduplex)" (version 1.0 of 25/05/2000, file KWP2000 auf TP20_1_0.doc).

Remarks

The KWP2000 component needs the BDiag component for basic KWP2000 communication. For certain WUP types further components are required. Typical stack configurations are:

Configuration COM CAN VAN
Components KWP2000
BDiag
Packer
COM
KWP2000
BDiag
TP2_0
CAN
KWP2000
BDiag
USDT
CAN
KWP2000 + Plugin
BDiag
USDT
CAN
KWP2000 + Plugin
BDiag
PSAVANpoll
VAN

The KWP2000 component controls certain parameters of the BDiag, COM and CAN components. As far as access to these parameters by the application would interfere with the operation of the KWP2000 component these parameters are locked and prevented from being saved in stack configuration files.

In regular communication sending empty data events is not allowed (at least a service identifier is required - the KWP2000 component answers with a framing error when the data size is set to 0). Exceptions are starting or stopping communication: Since there is no other way to start or stop the communication without transferring data the KWP2000 component accepts empty data events with either AIDA_nCommuStart or AIDA_nCommuStop set.

The KWP2000 component checks a transmit data event for the service ids of either the "Start Communication" or the "Stop Communication" service as well as for the flags AIDA_nStartCommu and AIDA_nStopCommu. To establish the communication with the ECU even in an event containing a "Start Communication" request the AIDA_nStartCommu flag has to be set as it triggers additional operations if needed. If an ECU does not require the "Start Communication" service the AIDA_nStartCommu flag can be set together with an arbitrary service as long as the ECU does support this service or with an event containing no data at all. If a "Stop Communication" request is detected, the idle communication will stop after this service has been completed. The flag AIDA_nStopCommu can be set in any other type of service or even with no data at all. In this case the KWP2000 component will stop the idle communication in any case after completion of the service.

If no data transfers or only internal transfers like "Tester Present" are in progress when the communication state changes the KWP2000 component will generate status events containing the corresponding flags for the new state (AIDA_nCommuStarted, AIDA_nCommuStopped). To receive all information about errors and communication state changes an application should not set a filter with AIDA_boSetEventTypes.

The KWP2000 component's functionality can be changed by so called plugins. A plugin is a kind of specialized AIDA component that only replaces certain functions of the KWP2000 component (currently "Start Communication", "Stop Communication" and "Tester Present"). On the other hand a plugin has access to certain KWP2000 functions. Plugins may add additional parameters to the KWP2000 component's parameter list to control their behaviour, so when the application loads or unloads a plugin it should check if the parameter list has changed. Some parameters of the KWP2000 component may no longer be evaluated when certain plugins are loaded.

Parameters

SpecialFunctionPlugin
The KWP2000 component can load an optional plugin containing vendor specific KWP2000 functions (currently StartCommunication, TesterPresent and StopCommunication). If no plugin is needed this parameter must be set to an empty string. Otherwise the parameter must contain the name of the plugin (excl. the extension). The plugin may add additional plugin specific parameters to the KWP2000 component's parameter list.
FrameFormat
This parameter switches between no additional frame (none), the ISO/WD 14230 format (KWP2000/COM) and a variation used for CAN configurations (KWP2000/CAN) with the AUDI/VW transport protocol 2.0 as transport layer. In either case certain parameters of the other components that are part of the stack influence the communication and frame format but are not locked and controlled by the KWP2000 component. These parameters have to be set by the application.
AddressingMode
Switches between the ISO/WD 14230 addressing modes of physical (Physical) and functional (Functional) addressing. See ISO/WD 14230 for details. In physical addressing mode the component reassembles fragmented responses as long as consecutive receive data events match (the id validity information and any valid ids of the same type must be identical between two consecutive receive data events).
WUPType
Selects the type of wakeup to be used. Possible values are:
none No WUP pattern is used.
StartCommunication Uses the ISO/WD 14230 StartCommunication service to wake the ECU.
COM/Slow Uses the 5 baud initialization sequence as described in ISO/WD 14230, part 2, chapter 5.1.5.2.2. The 5 baud address byte is taken from the parameter WUPAddress.
COM/Fast Uses the fast initialization sequence as described in ISO/WD 14230, part 2, chapter 5.1.5.3.
CAN/Fast Opens a communication channel to the ECU and then uses the ISO/WD 14230 StartCommunication service to wake the ECU (note: not yet implemented).
Not all values make sense in a certain configuration.
WUPAddress
ECU address to be used as wakeup address when WUPType is set to COM/Slow. Note: Typically the WUP address consists of a 7 bit wide address and 1 bit parity. The KWP2000 component does not calculate the parity information, instead the user has to supply an 8 bit wide value that already contains correct parity information.
WUPFlags
Contains the format byte used during a wakeup when WUPType is set to COM/Fast. This value will temporarily be entered in the parameter KWP2000Flags of the BDiag component.
WUPRetries
Determines how often the WUP may be repeated before an error is reported to the application. When WUPType is set to COM/Fast WUPRetries has a special additional function: Windows operating systems have a quite inaccurate timing. Since the fast wakeup pattern is composed of several single events the timing between the end of the 25ms break and the transmission of the StartCommunication service may vary. Furthermore the start of the transmission may jitter by one bit time. These timing variations may be too large for restrictive ECUs. When WUPRetries is set to a value > 0 the time between the break and the StartCommunication is varied to compensate these timing variations. Please note that this does not guarantee that the timing prescriptions given by ISO/WD 14230 are met. If restrictive ECUs are used the AIDA stack from KWP2000 down to the hardware driver must be executed on a special realtime hardware.
TesterPresentInterval
After a successful communication start TesterPresent messages are sent in intervals given by this parameter in ms when the bus is idle (see ISO/WD 14230, part 3, chapter 6.4 for further details). The optional parameter for the TesterPresent service is not used. When TesterPresentInterval is set to 0 TesterPresent messages are not generated by the KWP2000 component.
As of version 1.1.14.1 This parameter may also be changed when the stack is online. Warning: Please note that this feature is not yet fully implemented and shall in general not be used if a special function plugin is loaded. It may be used only when the plugin either does not hook into the TesterPresent function at all or if it works synchronously. This currently includes the FlexTP plugin as well as the PSAD8 plugin. It shall be absolutely avoided together with any other available KWP2000 plugin as it will not work as expected.
ExtendedTiming
This read only parameter shows which timing parameter set currently is active (0 normal timing, 1 extended timing). With WUPType set to "none" its value depends on the setting of the KWP2000Flags parameter of an underlaying BDiag component, for other WUPType settings it is retrieved from the key bytes the ECU returns during communication start.
NrmP1max, NrmP2min, NrmP2max, NrmP3min, NrmP3max, NrmP4min, ExtP1max, ExtP2min, ExtP2max, ExtP3min, ExtP3max, ExtP4min
Timeout values in units of ms according to ISO/WD 14230, part 2, chapter 4.4, tables 1 and 2. These timings are used to calculate certain parameters of underlaying AIDA components.

See Also

AIDA Overview, list of AIDA components