Understanding The Protocol Converter

With the hardware design being so simple it's obvious that the firmware must have a lot to do, and in this case the 6805 processor is pretty much fully utilized with respect to CPU cycles. All 6805 code was written in assembly language due to timing and memory space considerations. To first get an overall understanding of firmware operation, we will start with a description of the RS-232 interface protocol to the OBDScan application in the host computer. Upon application of power, OBDScan transmits a "P" to indicate power on. In approximately 4 seconds, if the vehicle ECU is on, OBDScan will establish a connection with the ECU and begin transmitting the character "S" every 64ms. The "S" is used to synchronize the users computer with the OBDScan. The "S" represents an opportunity for the user to send a request for diagnostic data. After receipt of the sync character, the user computer has 40ms to send a request. If OBDScan does not receive a request it times out for the remainder of the 64ms and starts the process over again. Every 48 sync characters OBDScan will send a request for diagnostic data to the ECU to keep the link alive, whether or not the user has sent a request. All user diagnostic requests take the form shown below. They always consist of 6 ASCII bytes.

For example, if you wanted to send a command to retrieve Throttle Position, you would send an ASCII string of "011106", see table 1 for the PID's supported, within 40ms of receipt of the sync character. The OBDScan will respond with the full J1979 response data of "V486BAA01TTCC". The "V" indicates ISO9141, "486B" characters are specified by J1979, "AA" is the ECU address, "01" was the mode of the request, "TT" is an 8 bit binary value for the Throttle Position (0-100% open, with 255=100%) and CC is a message checksum.

ISO-9141 Initialization. Upon power up, the OBDScan protocol converter firmware waits 3 seconds for the ECU to get ready and then initiates the ISO-9141 initialization sequence. If the ECU does not respond, then the OBDScan protocol converter waits for another 3 seconds and tries again. This process is reputed until connection is established. Once a reliable, error free connection exists, OBDScan protocol converter sets up an infinite loop in which it waits for user input on the RS-232 port and constantly sends sync characters "S".

Command Processing When an RS232 input is received, it is parsed into MODE, PID and BYTE COUNT. An ISO-9141 transaction is prepared with the proper header and checksum and then transmitted to the ECU. The protocol converter waits for up to one second for a response from the ECU. If the response happens before the timeout, then the protocol converter reads the number of bytes specified in BYTE COUNT and sends it back out the RS-232. If the protocol converter times out on waiting for ECU data, then a reinitialization takes place until the link is reestablished.

ISO-9141 and SAE J1979 Compliance. The protocol converter firmware handles internal and external communication timing between message bytes and between messages in accordance to the applicable standards. It also calculates all required headers, checksums, address and keyword initialization, performs watchdog timeout on bus messaging, and error detection. The timing requirements are listed below.

w0 Bus idle time before init 2000ms min.

t0 ISO initialization 2440ms

p2 ISO inter-message time 50ms

p4 Inter-byte time 5ms

t6 SAE delay before log in 300ms

t7 watch dog time-out 1000ms

 

Table 1 SAE-J1979 Supported Data