User'S Guide: 9141 Converter
User'S Guide: 9141 Converter
USER’S GUIDE
SILICON ENGINES
2101 OXFORD ROAD
DES PLAINES, IL 60018
847-803-6860
FAX 847-803-6870
www.siliconengines-
ltd.com
1. OVERVIEW
1.1. INTRODUCTION
This document is a User’s Guide for the 9141 Converter module, a compact electronic device that
allows a personal computer to connect to an automotive diagnostic data link compatible with ISO-
9141, a world-wide standard issued by the International Standards Organization.
The ISO-9141 Converter is also frequently used to support Keyword Protocol 2000 (ISO-14230), an
expanded version of ISO-9141.
1.2. APPLICATIONS
• Development: Facilitates development of an automotive ECU (electronic control unit) that supports
an ISO-9141 diagnostic line, by allowing a personal computer to act as the diagnostic analyzer during
software development.
• Production: Allows the ISO-9141 data link to serve as a port for testing the ECU, and for
downloading constants and parameters: serial number, calibration data, etc.
• Service: For concept cars, prototypes, and low-volume vehicles, allows a PC to act as a diagnostic
analyzer.
1.3. FUNCTIONS
• Level conversion: Converts signals between ISO-9141 levels and RS-232 (CCITT V.24) levels, for
connection to a personal computer.
• Speed switching: Contains logic for shifting between 5-baud and high speed operation, facilitating
PC interfacing.
• Duplexing: Converts the half-duplex ISO-9141 line to full-duplex RS-232 signals, in association
with available PC software.
• Signal indicators: Provides six two-color LEDs to show the states of all significant signal lines.
2. ENCLOSURE
ENCLOSURE DIMENSIONS
FIGURE 2.2.1.
3. CONNECTORS
A DB9F (female DB9) socket plugs in here. Three signal wires are required: VBATT, the ISO-9141
K-line, and ground.
4 NC NO CONNECTION
These pin-outs, as well as the locations of the pins within the 9-pin connector, are shown on the 9141
Converter top panel legend (Fig. 2.1.1).
Because the connectors vary on each automotive ECU, the user must construct his own cable to
connect to the 9141 Converter. Or contact Silicon Engines for assistance.
At the ISO-9141 Converter side, use a DB9F connector. Connect VBATT to pin 1, the K-line to pin
3, and ground to pin 6. The locations of the pins within the connector are shown on the top panel
decal (see Fig. 2.1.1). (See part 4 below for more information on VBATT and GND.)
The KTEST line provides a TTL-level (5 volts, ground) image of the ISO-9141 K-line, with a high-
impedance (100 KΩ) output, useful for connection to test equipment.
Connector polarities and signal names have been chosen for compatibility with the RS-232 (CCITT
V.24/V.28) serial port of a recent model IBM-compatible PC. PC-AT and later computer models
typically provide a DB9M connector at their COM1 serial port.
Typically the 9141 Converter connects to the PC over a DB9 extender cable about 6 feet (2 M) long.
A DB9M connector plugs into the 9141 Converter at one end of the cable, and a DB9F connector
plugs into the PC at the other end.
This cable should provide straight-through wiring: pin 1 connects to pin 1, pin 2 to pin 2, etc. This
cable is a commercial item, readily available at computer accessory suppliers. These cables are also
available from Silicon Engines.
4. POWER REQUIREMENTS
The 9141 Converter can also be powered by a +12 VDC power supply that connects to building AC
power lines.
However, if higher transient levels are anticipated, measures should be taken to protect the 9141
Converter. One method is to power the device from an AC line-powered +12 volt power supply,
rather than from the vehicle’s battery.
ISO-9141 K-LINE
FIGURE 5.2.1.
Five LED indicators show the voltage levels on key RS-232 signal lines.
RS-232 SIGNALS
FIGURE 5.2.2.
After suitable 5 baud signals are exchanged, the PC turns on DTR, switching the 9141 Converter to
high-speed operation. Typical speeds are 600, 4800, or 10,417 bits per second. The high-speed rate is
under software control.
In low-speed mode, the TXD line (the high speed data line from the PC) is locked out, and has no
influence on the ISO-9141 K-line. The RXD line is clamped to the marking state (idle line, logic 1, −
10 VDC), regardless of the state of the ISO-9141 K-line.
VBATT RXD
1 -10 VDC 2
TXD
510 NC 3
K CTS
3 8
RTS
7
GND
6
SE102-B
VBATT CTS
1 -10 VDC 8
RTS
510 NC 7
K RXD
3 2
TXD
3
GND
6
SE103-B
The above lamp pattern should appear when the system is idle. The 9141 Converter is connected to
both the PC and the ECU, and the power is on. The 9141 software in the PC is not running, so the
RS-232 signal lines from the PC are all at idle levels. The RS-232 lamps are all red, while the ISO-
9141 K lamp is green.
K LAMP STEADY RED: If the K lamp is red when the system is idle, check the ECU and the
cables for a short to ground. The K lamp should be green most of the time in any mode. When the
system is communicating, the K lamp will be green while the ISO-9141 line is idle waiting for a new
command, and during logic 1 data bits, stop bits, and inter-frame idle time. The K lamp should go red
only for start bits and logic 0 data bits. A steady red K lamp indicates a problem on the K line.
During 5 baud ISO-9141 initialization, the K lamp will be green with long red flashes.
When the ECU is transmitting 5 baud data, the CTS lamp (data from ECU to PC) will be red with
long green flashes. The RTS line (data from PC to ECU) will be solid red (idle).
When the PC is transmitting 5 baud data, both the CTS and the RTS lamps will be red with long
green flashes. The 9141 Converter echoes the data it receives from the PC on the RTS line, back to
the PC on the CTS line. (See the signal flow diagram in Fig. 5.4.1.)
During high speed mode, the K lamp will be green with short red flashes.
When the ECU is transmitting high-speed data, the RXD lamp (data from ECU to PC) will be red
with short green flashes. The TXD line (data from PC to ECU) will be solid red (idle).
When the PC is transmitting high speed data, both the RXD and the TXD lamps will be red with
short green flashes. The 9141 Converter echoes the data it receives from the PC on the TXD line,
back to the PC on the RXD line. (See the signal flow diagram in Fig. 5.5.1.)
6. COMPUTER SOFTWARE
Different software versions are required to support ISO-9141-CARB (emission control) and other
versions of the ISO-9141 protocol used by various vehicle manufacturers (ECU diagnostics).
The 9141 Converter is also frequently used to support Keyword Protocol 2000 (ISO-14230), an
expanded version of ISO-9141 used primarily by European automotive manufacturers. For further
information, contact Silicon Engines.
Please contact Silicon Engines if you need engineering assistance with your 9141 application.
Three software packages are needed in order to write the application: a C compiler, a serial
communications handler, and a timer library (if your application requires fast initialization).
A.2. C COMPILER
The leading brands of C compilers for the IBM-PC are Microsoft and Borland. Other varieties of C
compilers exist for the IBM-PC, but you have to be careful that the libraries that you buy (see below)
are compatible with those compilers. At Silicon Engines, we use Borland C/C++ 4.02, but any
version of C/C++ including Builder will work. Note that Borland C/C++ 4.5 and lower only work up
to the year 2038 as far as time/date operations go. Contact Borland at: http://www.borland.com.
• BIOS only: First there is the option of not using a COMM library and just programming using BIOS
commands. This is not recommended. However if you do not plan to use a third-party COMM
library, you can use the BIOS directly. It is recommended that you buy a book about RS-232
programming using the IBM-PC BIOS, such as Joe Campbell's C Programmer's Guide to Serial
Communications (Howard W. Sams & Company, 1989) or Timothy S. Monk's Windows
Programmer's Guide to Serial Communications (Sams Publishing, 1992). If your PC has an 8250,
16540, or 16550 UART or serial communications ICwhich it probably doesthen you can use the
following code segments to access the DTR and RTS lines, for example:
#define COMPORT (1) /* change this to 2 for COM2 or 3 for COM3,
etc. */
#define BASEADDR (0x3F8) /* change this to 2F8 for COM2, 3E8
for COM3, etc. */
For setting 5 baud and 10400 baud using normal BIOS routines (i.e. using TXD and RXD, not the
special RTS/CTS DTR off mode available on the Silicon Engines 9141 Converter), use the following
formula:
#ifdef DO_5_BAUD
#define SET_BAUD_RATE { LCR=0x80; MSB=BAUD_5_HIGH;
LSB=BAUD_5_LOW; LCR=7; }
#else
#define SET_BAUD_RATE { LCR=0x80; MSB=BAUD_10400_HIGH; \
LSB=BAUD_10400_LOW; LCR=3; }
#endif
• WCSC COMMDRV library: The main disadvantage to using this library is that it cannot run at
very high serial speeds (115200 baud) very well (as of the 1992 version—later versions may have
fixed this limitation). The advantages are that it allows for special-purpose handlers based on specific
receive or transmit events, and also allows for transmitting bytes immediately for precision timing,
which can be used for fast initialization. This software is available at http://www.wcscnet.com.
x=inbuflen+outbuflen+2;
pcb->ser_rs232_base= addr;
pcb->irq = irq;
pcb->parity = PARITY_NONE;
pcb->brk = BREAK_OFF;
pcb->lngth = LENGTH_8;
pcb->stopbit = STOPBIT_2;
pcb->block[0] = 2;
pcb->hblock[0] = 0;
pcb->block[1] = 2;
pcb->hblock[1] = 0;
pcb->protocol = PROT_NONNON;
pcb->buffer_seg = (unsigned short)(((long)((void far
*)buf))>>16);
pcb->buffer_off = (unsigned short)((long)(void far *)buf);
pcb->inbuf_len = inbuflen;
pcb->outbuf_len = outbuflen;
pcb->cardtype = cardtype;
pcb->aux_addr1 = subport;
pcb->flag2 = 0 /* CHAIN_INT */ ;
pcb->sflag = flag;
pcb->cardseg = cardseg;
if ((x=ser_rs232_setup(port,pcb))) CommDrvError(x);
ser_rs232_rts_off(port);
ser_rs232_dtr_on(port);
if ((x=ser_rs232_getport(comport,pcb))) CommDrvError(x);
pcb->lngth=LENGTH_8; pcb->parity=PARITY_NONE; pcb-
>stopbit=STOPBIT_1;
pcb->block[0]=0; pcb->hblock[0]=0;
pcb->block[1]=0; pcb->hblock[1]=0; /* 18.2*2 ms > 30 ms
*/
pcb->baud=BAUDUSER02;
if ((x=ser_rs232_setbauddiv(card,(pcb->baud=BAUDUSER02),
BAUD_DIV(360)))) CommDrvError(x);
if ((x=ser_rs232_setup(comport,pcb))) CommDrvError(x);
nsp.count=1; nsp.data[0]=0x00;
CheckSendnowDoneFlag=0; SendnowDoneFlag=0;
ser_rs232_set_intfunc(comport,&func,INTFUNC_OTHER);
ser_rs232_misc_func(comport,SENDNOW,(long)(&nsp));
while (!SendnowDoneFlag) {
if (CheckSendnowDoneFlag) {
if (!CheckNowDoneFlag) Commfailure();
}
}
/***Wakeup signal sent, now go to fast baud rate and send
* Start Communications message.***/
• Greenleaf library: The Greenleaf library has many different drivers for all sorts of different setups,
plus a fast driver for 115200 applications. It does not have the SENDNOW function for immediately
sending a byte, which makes fast init difficult.
• At Silicon Engines, we use the WCSC Library for ISO-9141 applications, and the Greenleaf library
for most other serial communications applications.
However, fast init is possible using Greenleaf (and a timer library) by setting DTR LOW and setting
RTS low for 25 msec and then high for 25 msec—as discussed further below.
• Precision Zen: The main advantage to this library is that it is a public domain program. It should be
available from shareware software providers. The only problem with the version we have is that it
doesn't work properly on some systems. It is recommended for professional use to use a different
library.
· PC Timer Tools: This library works great on all the systems we have tried it on. It allows
millisecond and microsecond timers for all your precision timing needs. PC Timer Tools 5.0 (or
PCHRT) is available from Ryle Design at http://www.ryledesign.com.
• Slow initialization (5 baud): One method is to use TXD and RXD within the PC’s serial
communications channel, and set the PC to 5 baud. This is done using a user-defined baud rate.
Depending on your COMM library, this is done in different manners (see above). You send the
address of the module at 5 baud with DTR HIGH.
Alternately, you can set DTR LOW and use the RTS signal as a data line. The following steps show
you how to do this:
1. Set DTR LOW.
2. Set RTS HIGH (for START bit).
3. Wait 200 msec (one bit time at 5 baud).
4. For each of the eight data bits that you want to send, least significant bit first, set RTS HIGH
to send a 0 data bit, or set RTS LOW to send a 1 data bit, and then wait 200 msec.
5. Set RTS LOW (for STOP bit).
6. Wait 400 msec (two STOP bit times).
7. Set DTR HIGH (back to normal communications mode).
• Fast initialization: In fast init, you need to bring the K-line down for 25 msec, and then bring it high
for 25 msec. This can be done using either the DTR high method—for example, with the WCSC'
COMMDRV library (see above) —or the DTR low method, as follows: