AIDA COM Component

The COM component is a hardware driver component for communication through asynchronous serial devices.

Remarks

Data flags

As of version 1.2.0 it is possible to suppress the generation of handshake line events introduced in version 1.1.13SR7. To achieve compatibility with previous versions of the COM component the new parameter LogHandshakeLines defaults to 0 (no generation of handshake line events) and will not be saved in a stack configuration when set to its default value.

As of version 1.1.13SR7 the COM component uses the AIDA_bDataFlags member of an AIDA data event to influence outgoing handshake lines not set to hardware handshake and to signal changes on incoming lines. As this feature currently is highly experimental and subject to change without notice it is not described in further detail here. The valid data flags are documented in the corresponding header file bsk_aida_com.h.

Windows™ Version

The Windows™ version of the COM component can use any serial port ("COMx:") known to the operating system. For proper operation at low bitrates or with echo suppression activated it is necessary to deactivate the fifo buffers of the uart chip. Otherwise the presence of the fifo buffers may cause inacceptable shifts in event generation when sending or receiving data. This will lead to malfunction not only with echo suppression activated, but also in combination with various upper level protocols relying on precise timings like KWP2000 (25ms fast WUP, 5Bd. WUP). As the Windows™ Operating system even in its latest versions still does not offer any means to legally modify the fifo settings from an application the correct settings must be selected manually. Please look at the Windows help for further details about activating/deactivating the fifo buffers.

The Windows™ operating system even in its latest versions lacks the possibility to read back the current state of outgoing handshake lines. So when going online the COM component sets the relevant lines to a defined state.

Due to deficiencies of the uart chips the operating system cannot notify the application when the last byte of send data has been shifted out of the output shift register. Furthermore there is no means to notify an application about the exact time when the start bit of a new byte is being received. The COM component tries to calculate the exact times. Nevertheless these deficiencies have some consequences: When waiting for data to be received the operating system has to wait for the given timeout plus an additional byte time to be shure that the received data is complete. This causes additional delays when receiving data that are noticeable especially at low bitrates. When sending data the TransmitDataDone event may be generated a few milliseconds too early or too late relative to the stop bit of the last byte sent. This becomes important when parameters shall be changed after sending data or when calculating the correct idle time for the next packet to be sent.

Using USB to serial communications adapters is not recommended. The USB bus is not capable of generating interrupts, data is therefor being polled. This prevents the echo suppression of the AIDA COM component from working. Furthermore drivers for certain hardware is known to be buggy, e. g. Prolific PL2302 based adapters do not signal a break. Worse, the adapter may not recover correctly from a long break. The PL2303 also has the severe hardware restriction of not supporting 10400bit/s. By now FTDI based adapters seem to work.

The COM component cannot be loaded under Windows 95™. The reason for this behaviour is not yet known. Please note that MS-DOS™ based Windows™ systems are in general unsupported by AIDA stack components.

One important API for serial communications is broken at least under Windows XP™. The effect on fast machines (P4@2600MHz+) is that the WaitCommEvent() function sometimes will not deliver the EV_TXEMPTY event on which the COM component relies when detecting the end of a transmission. As of version 1.3.13.3 (prerelease) and later the component uses another scheme for detecting the end of transmission which relies on undocumented behaviour of the operating system. Some testing has been done on Windows 98™, Windows NT 4.0™ and Windows 2000™ to assure that this method is compatible with older operating system versions. Nevertheless, BSK Datentechnik GmbH takes no responsibility for this component to work as expected on every operating system configuration. As soon as Microsoft has fixed the broken API the conventional component used documented behaviour shall be used again.

Parameters

Port
The serial port to be used. The Port parameter may have values from 0 to 255. A value of 0 means that no serial port is openend. Please note that the port is openend in exclusive mode.
Bitrate, DataBits, Parity, StopBits, FlowControl
These are the typical parameters for serial communications devices and are not described in further detail here. Please note that not every selectable bitrate need to be supported by the uart chip. For some bitrates the operating system already may refuse the selection but the behaviour depends on the drivers for the installed uart. The standard uart chips on current pc mainboards (16550 compatible) do not support more than 115200bits/s. Units used are bits/s for the Bitrate and 1/2 bits for the Number of StopBits used.
TXIBGap
The interbyte time between two successive bytes of a TransmitData event. The interbyte time is the period between the end of the stop bit and the begin of the start bit of the next byte. Units used are ms. Note: Between two TransmitData events TXIBGap is not used, only TXIdleTime.
TXIdleTime
The minimum time to elapse between the end of the last byte of the last TransmitData event and the start of the first data byte of the next TransmitData event. Units used are ms. The idle time is calculated after the parameter attachment of a new transmit data event has become valid.
RXGap
When RXGap is negative -RXGap [ms] specifies the maximum time allowed to elapse between the end of a stop bit and the start of the start bit of the next byte. When this time elapses without a new data byte being received a ReceiveData event is generated. Positive values specify the timeout allowed to elapse from the beginning of a receive operation to the generation of an event. Units used are ms.
EchoSuppression
A value of 0 sets the COM component to standard (two wire) operating mode. When this parameter is set to 1 the COM component activates its echo suppression and tries to filter the echo received when transmitting data on a single wire bus. In this operating mode it is absolutely necessary that fifos are deactivated. Setting this parameter to 1 automatically sets RXMaxDataSize to one in the Windows™ version of this component.
RXMaxDataSize
This parameter delimits the maximum data size of ReceiveData events. Since the event structure has to be created before the receive operations starts this parameter determines the memory useage.
SetBreak
When SetBreak is set to 0 the COM component operates normally. When SetBreak is set to 1 the COM component sets the tx line to break state.
LogHandshakeLines
When LogHandshakeLines is set to 0 the COM component will only generate data events with a valid AIDA_bDataFlags member containing the new state when a data event with a valid bDataFlags member is sent. When this parameter is set to 1 the COM component will generate an AIDA event with the new state on every change of a handshake line.

See Also

AIDA Overview, list of AIDA components