1993-2011 General Motors Company, GM Customer Care & Aftersales. All Rights Reserved.
Page
48
D2 Op-Code: Download VIN using Mode 6 & 16
Supported By:
UART Interpreter 0
Description:
The D2 Op-Code is used to download the VIN. The device must be prepared to accept a mode 6 or 16
message before this Op-Code can be used. The Op-Code uses mode 6 for two byte addressing and mode 16
for three byte addressing. See Action Fields for more information on type of addressing.
Action Fields:
AC0:
Module
ID for VIN
AC1:
Prolog routine number for Two byte addressing
Prolog ID for Three byte addressing
00 - Use 4E75 as the prolog
AC2:
Device ID
AC3:
00 Two byte addressing - 01 Three byte addressing
Pseudo Code:
XX D2 AC0 AC1 AC2 AC3 G0-G1 G2-G3 G4-G5 G6-G7 G8-G9
Build Mode 6 or 16 Download Request as indicated
in the table below, contents of the XX locations is detailed
in pseudo code following the table
Request
Byte
Value
Byte Description
1
AC2
Device ID
2
4 + M
Message length (M is data bytes in message)
3
06 or 10
Message mode
4
XX
High byte of load address
5
XX
Middle
of low byte of load address
6
XX
Low byte of load address or data byte 1
The pseudo code below explains how the data portion of this
request is filled
6 + N + M
XX
Data byte N (N <= maximum as defined in pseudo code)
7 + N + M
CS
1 byte request checksum
If
the Exception is Zero (AC3=00)
Use two byte addressing
Expect a 06 return code for success (set return type processing to 2)
For failures or last packets expect a 15 in response byte 4 and a return code in response byte 5
Check response byte 3 for message mode (set return code position to 2)
Set message mode to 06
Copy high byte of data load address from the
Utility header into message
Copy low byte of data load address from the Utility header into message
Reserve this byte for high byte of module checksum
Reserve this byte for
low byte of module checksum
Copy AC0 into data area of message as the module ID
Copy AC1 into data area
of message as the prolog
Endif
the exception is zero
If
the Exception is One (AC3=01)
Use three byte addressing
Set the return type processing to 2
Set the return code position to 3
CameraLoops.com
1993-2011 General Motors Company, GM Customer Care & Aftersales. All Rights Reserved.
Page
49
(continued)
Set message mode to 10
Copy high byte of data load address from the Utility header into message
Copy middle byte of data load address from the Utility header into message
Copy low byte of data load address from the Utility header into message
Reserve this byte for high byte of module checksum
Reserve this byte for low byte of module checksum
Copy AC0 into data area of message as the module ID
If
the Prolog Identifier is Zero (AC1=00)
Copy 4E into data area of message as the high byte of the prolog
Copy 75 into data area of message as the low byte of the prolog
Endif
the prolog identifier is zero
Endif
the exception is one
Copy VIN data into data area of message following the prolog
Calculate module checksum by adding all bytes from module
ID through VIN
Copy module checksum into module checksum area of message
Copy message checksum at end of data area of message
Send message and receive the response
Goto UART Return Type Processing
Update and
display percent downloaded
If
Response Byte in Position 4 is 15
Look for response byte 5 in goto fields
If
Response byte 5 is Found
Goto appropriate step
Else
Goto step indicated by FF goto field
Endif
response byte 5 is found
Else
Error invalid
response from module
Endif
response byte in position 4 is 15
Do'stlaringiz bilan baham: