1993-2011 General Motors Company, GM Customer Care & Aftersales. All Rights Reserved.
Page
40
C3 Op-Code: Download Routine to RAM and Execute using Mode 6 (Electric Vehicle)
Supported By:
UART Interpreter 0
Description:
The C3 Op-Code builds and sends an ALDL mode 6 download routine message. It
is used to send routines
with a prolog to the RAM of the device being reprogrammed. This Op-Code was developed specifically for the
EV1 electric vehicle BTCM controller because the controller does not respond to each download and uses a
one byte prolog.
As with the C0 Op-Code, if the entire routine can be sent in one message, it will be sent without a prolog. If it
cannot
be sent in one message, then the routine is split evenly and a prolog is sent with each message except
for the last one. A C3 Op-Code should always be preceded by a Mode 5 (Op-Code 05) message unless the
module is already prepared to accept a mode 6.
Note: See Pseudo code for more information on maximum packet sizes.
Action Fields:
AC0:
Section Number of Routine
AC1:
Prolog Value
AC2:
Device ID
AC3:
Not Used
Pseudo Code:
XX C0 AC0 AC1 AC2 AC3 G0-G1 G2-G3 G4-G5 G6-G7 G8-G9
Use UART Return Type Processing of One.
Build Download message 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
3 + N
Message length
3
06
Message mode
4
XX
High byte of message
address
5
XX
Low byte of message address
6
XX
Data byte 1
The pseudo code below explains how the data portion of this
request is filled
6 + N
XX
Data byte N (N <= maximum as defined in pseudo code)
7 + N
CS
1 byte request checksum
Retrieve section AC0
and assign to routine
Retrieve the address from the routine header
Assign value in AC1 as prolog
Set maximum packet size to 60 bytes
Send the Mode 6 message and do not expect a response.
If
Routine Length is Greater than Maximum Packet
# Of packets = routine length / (maximum packet - prolog length)
Last message length = remainder of routine length / (maximum packet - prolog length)
Addresses are calculated from highest load address to lowest load address
Use value in AC1 as the prolog; copy AC1 into data byte 1 of message buffer
Do while
More Packets
CameraLoops.com
1993-2011 General Motors Company, GM Customer Care & Aftersales. All Rights Reserved.
Page
41
(continued)
If
This is the Last Packet
Change message length to last message length+3
Set the two byte packet address to the low two bytes of the four byte address in the routine
Copy the last message from the routine overlaying the prolog (no prolog on last packet)
Else
Calculate appropriate two byte packet address
Copy calculated packet address into message buffer
Copy a piece of the routine into message buffer
DO NOT include a prolog
Endif
this is the last packet
Send the message and do not expect a response
Loop and continue sending packets
End do while
more packets
Else
Use low two bytes of the four byte address in the routine for
message address
Copy routine into message buffer, NO prolog on packet
Send the message do not expect a response
Endif
routine length is greater than maximum packet
Do'stlaringiz bilan baham: