UM-0086-A2
CANgate User’s Manual
Page 18
ECUaddr
is the address of the ECU to which to send the request (integer,
0-7
, or
256
). If
256
is specified (which is
the default), a non-specific request is made. For ECUs which do not use the standard OBD-II CAN IDs, you can
alternatively specify an explicit CAN ID here, in hexadecimal (e.g.
0x220
); this is discussed further below.
sampleRate
is the rate at which to send messages (integer, in ms, must be multiple of 100ms). If this parameter is
0
or
not specified, the memory slot will only send a message when it is polled by the host system (using the
RP
command).
formatOpt
specify how the data value is to be formatted when it is returned to the host system; see
(P21)
for more details. if not specified, data will be returned in raw hexadecimal format.
A
RQST
memory slot transmits a request message to an ISO-14230/OBD-II compatible ECU, and waits for a reply. Then:
if a reply is forthcoming, the required bytes are extracted from the reply message, formatted if required, and returned
to the host.
if an ISO-14230 negative reply code is received, this is reported to the user (if the Verbose flag is on), and no data is
returned.
if nothing is received then CANgate will time out after approximately 400ms and abort the request.
The request will be sent using CAN ID (0x7E0 +
ECUaddr
). If
ECUaddr
= 256, this indicates a "functionally addressed
request", which will instead be broadcast using CAN ID 0x7DF.
The message data consists of a single
mode byte
(or
service identifier
), followed by a variable number of parameters.
Modes 0x01-0x0F are standardised ("legislated") OBD-II modes (defined in SAE-J1979 or ISO-15031), while modes
0x10-0x3F are manufacturer extended modes (specified in ISO-14230, although details of data and parameters are
manufacturer specific).
CANgate will then listen for a response with CAN ID 0x7E8-0x7EF (ECU #0 will reply using ID 0x7E8, ECU #1 with ID 0x7E9,
and so on). The response message's mode byte will be either:
a copy of the request mode byte with bit 6 set – this is a
positive response
and the mode byte will generally be
followed by one or more data values, or
the value 0x7F – this is a
negative response
and indicates that an invalid request was made.
All messages are transmitted using the
ISO-15765
network layer protocol. This protocol fragments long messages into
multiple CAN frames and then reassembles them.
CANgate recognises a few of the common ISO-14230 mode byte values and sets the default
startByte
value appropriately,
so that header information in the response is skipped. In particular:
Mode
default
startByte
Comment
0x01, 0x02, 0x33
3
skip first 2 bytes (mode, PID) in response
0x22
4
skip first 3 bytes (mode, ID-hi, ID-lo) in response
other
2
skip first byte (mode) in response
All received data, from
startByte
through to the end of the message (or
endByte
if specified), will be returned to the host.
Note
: The response time for ISO-14230/OBD-II commands depends upon the particular ECU and can vary greatly. CANgate
will only send out one request at a time; if it is asked to make many requests simultaneously then the requests will be placed
in a queue and executed sequentially. If no reply is received within 400ms then CANgate will assume the ECU is dead and
make the next request.
Note:
Some ECUs do not use the standard CAN identifier range (0x7E0 – 0x7E7). In this case an arbitrary CAN ID (0x000 –
0x7F7) can be specified explicitly as the
ECUaddr
. This should be specified in hexadecimal. CANgate will then send the
request using the specified CAN ID, and expect a response with CAN ID
ECUaddr
+ 8. The following two commands are
therefore equivalent:
RQST 1 010C 3 0 1
RQST 1 010C 3 0 0x7E1
In both cases the request will be sent with CAN ID 0x7E1 and the response will be expected to have CAN ID 0x7E9.
Examples
RQST 1 010D FORMAT "%d\n"
When polled, send a message on CAN port 1 requesting the current value (mode = 0x01) of Parameter ID (PID) 0x0D, which
is vehicle speed (see
(P40)
). The speed will be returned as a single decimal integer (0-255 km/h)
followed by CRLF.
RQST 1 1800FF00 2 2 0; RP
This will immediately send a message on CAN port 1 to ECU #0 to ReadDTCByStatus (mode = 0x18), returning all currently
active fault codes (parameter byte 1 = 0x00) for all fault code groups (parameter byte 2-3 = 0xFF00). The ECU will return a
mode byte, fault code count, and a variable length string of 3-byte SAE-J2012 format fault codes. The slot selects just fault
code count (byte 2) and returns it in the default format (hexadecimal).