
43 of 83
ELM329
ELM329DSC
Elm Electronics – Circuits for the Hobbyist
www.elmelectronics.com
Mixed ID (11 and 29 bit) Sending
Users often ask if the ELM329 can send CAN data
other than that used for OBD. It is certainly able to do
that - all it takes is an understanding of the way that
messages are formed and sent by the chip. The
ELM329 also has two special instructions that make it
even easier to send any CAN message at any time.
When you provide a mode and PID for sending,
the ELM329 puts that request within a message
structure just like that shown in Figure 5. For this
example, we’ve assumed an ISO 15765-4 protocol
with an 11 bit ID, and an 01 05 (coolant temperature)
request. Notice that the two data bytes remain intact -
they are not altered in any way.
Every ISO 15765 message requires that there be
a special data byte (called a PCI byte) in the first
position. The ELM329 automatically adds this byte for
you, if automatic formatting is turned on (it is by
default). If you do not want this byte added, simply turn
the formatting off, with the AT CAF0 command.
This protocol also requires that all messages have
8 data bytes (the CAN protocol allows 0 to 8). If, as
above, the message is less than 8 bytes long, the
ELM329 will add extra ‘filler’ bytes for you in order to
make the length 8 bytes. If you do not want to send 8
bytes, use the AT V1 command to allow the messages
to be variable in length.
When you turn the formatting off, and allow
variable data lengths, it’s not as easy to send standard
ISO 15765 requests (but not impossible). If you had
done as above and sent AT CAF0, followed by AT V1,
then wanted to request the coolant temperature, all
you need to do is provide the 8 data bytes yourself:
>02 01 05 00 00 00 00 00
You do not always have to use the CAF0 and V1
commands in order to send arbitrary data using the
ELM329, however. An alternative is to define your own
protocol, using the Programmable Parameters for the
User protocols. Actually, protocol B provides a quick
way to do this:
>AT PB C0 02
OK
is all that is needed to set up a 250 kbaud protocol
that has an 11 bit ID, variable data length send, and no
formatting.
The above discussion showed how to set options
to modify existing protocols, or to create a new one
that is able to send any data for you. The ELM329 also
provides two special commands that add this flexibility
at any time, to any protocol.
If you were in the original situation (Figure 5), and
wished to send the four data bytes ‘11 22 33 44’ with
no formatting (ie no PCI byte) or filler bytes, then all
you need do with the ELM329 is send:
>.11 22 33 44
Notice the single dot (‘.’) out front, which tells the
ELM329 to use the 11 bit ID. If you had used two dots
(‘:’) as follows:
>:11 22 33 44
then the ELM329 would have sent the message using
the 29 bit ID (you can set the value with the AT SH
command).
Note that messages with 11 or 29 bit IDs can be
sent at any time using these two commands, no matter
what the current protocol uses. The only restriction is
that the current protocol must be active - that is, you
must have been sending requests and receiving
replies (so the ELM329 knows what the baud rate and
other settings should be).
The ‘.’ and ‘:’ commands always use the currently
defined headers for sending. If you wish to send with
something different, then the standard AT SH
command should be used to set either the 11 bit, or
the 29 bit header. (One of these headers will also
affect the current protocol though, as there is no facility
to define more than one 11 bit, or one 29 bit header.)
Note that the ‘.’ and ‘:’ commands also never
modify your data in any way - they do not add any
formatting bytes, and they do not add filler bytes. If you
want a message that has 8 data bytes, then you must
provide all 8 data bytes.
Figure 5. ISO 15765-4 Request
>01 05
7DF
8
02
01
05
00
00
00
00
00
filler bytes
PCI byte
dlc
header
(ID bits)
8 data bytes