Subject: Re: Car speed conversion error
Date: Tue, 26 Nov 2002 01:40:16 +0000
References: <3DDB30C2.D6EC77EB@autometer.de> <email@example.com> <firstname.lastname@example.org> <3DDE3D5E.BA2F499E@xympatico.ca> <3DE053F7.2919CB9C@xympatico.ca>
NNTP-Posting-Date: Tue, 26 Nov 2002 21:13:09 +0000 (UTC)
User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.4.19 (i686))
In sci.electronics.design Amy wrote:
> Suddenly, I really feel great knowing I am not the only one who find
> the standards unclear, confusing, or incomplete...
They are all of the above! It does make sense (sort of) on the third
reading, but you have to leave at least a month between readings! I had to
implement the stupid thing on a MPC555 as a set of support code and simulink
blocks, between TLC (Simulink code generation language (badly documented)),
J1979 (A nice example of how not to do it), and various internal documents
which tended to have 20 pages of change records at the start, I am glad to
be well out of it.
> The SAE standard I have for OBD II is SAE J1979. In sections 5.3 to
> 5.5 they have PID tables for various modes.
> There is no mandatory PID for odometer reading.
That may have been a extension specific to the company we were doing the
> The thing is I am not sure if all three parameters would be present on
> the bus in most cars. I know mostly likely, a car in States would have
> odometer reading in miles. But would it have both the high-resolution
> or low-resolution parameters, I don't know. And in my project,
> accuracy is a concern. I need to use parameter with high resolution,
> whether it's odometer or vehicle speed.
Do not assume miles! I know of one european vehicle which converts between
miles and KM at least 3 times in various can nodes. The rounding errors on
that one got interesting!
> As for CAN protocol, does anyone know which SAE or ISO standards I
> need to find parameter definitions in terms of the parameter's
> transmission rate, data length, PDU format, PDU specific, etc?
Transmission rate is somewhat variable, but try 50K and 500K as these
are the ones I have seen.
This is going from memory (after 6 months, so will be wrong)
A frame is always 8 bytes, unused bytes padded with 0
first byte is split as two nybble, the upper 4 bits are frame type:
0 - single frame.
1 - first frame.
2 - consecutive frame.
If single frame, then the low 4 bits are the length of the data (Max 7
bytes). If First frame then low 4 bits are bits 8 - 11 of message length
and next byte is message length LSB. If consecutive frame then low 4 bits
are sequence number and all the rest of the frame is data.
the next byte (byte 1 for single frame, 2 for first frame) is the command
or its response code (command + 0x40 (could have wrong value here), for OK,
IIRC 7F for invalid in which case there is a error code in here somewhere).
The rest of the frame is determined by the command being processed, and I
do not have the data to help here.
Hope that helps.
** The email address *IS* valid, do NOT remove the spamblock
And on the evening of the first day the lord said...........
.... LX 1, GO!; and there was light.