Shop OBEX P1 Docs P2 Docs Learn Events
OBD2 project — Parallax Forums

OBD2 project

ArchiverArchiver Posts: 46,084
edited 2002-11-26 22:51 in General Discussion
Peter-

Async serial is always LSB first. Not sure if that's what you mean
to be doing (i.e., sending inverted). I think I'd also use PAUSE
vice NAP for greater precision. If you're using a line driver, try:

ser_pin CON 1 ' or whatever

LOW ser_pin: GOSUB delay ' start bit (RS232 high)
HIGH ser_pin: GOSUB delay ' low order bit 0
GOSUB delay ' repeat for bit 1
LOW ser_pin: GOSUB delay ' bit 2
GOSUB delay ' bit 3
HIGH ser_pin: GOSUB delay ' bit 4
GOSUB delay ' repeat for bit 5
LOW ser_pin: GOSUB delay ' bit 6
GOSUB delay ' high order bit 7
HIGH ser_pin: GOSUB delay ' stop bit
(initial transmission complete at this point)

delay:
PAUSE 200: RETURN


Is this OBD-II transmission protocol described on a web site
somewhere?

Steve

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-01-16 18:49
    Hi

    I'm building an OBD-II interface board so I can talk to my in car ECU from a
    handheld. The interface card was originally just to shift the line levels
    from TTL to RS232 and add opto-isolation, however I thought I would add a
    stamp to handle the message formatting, heartbeat, changes in baud rate etc.

    Communication is initiated by sending 0x33 at 5 baud and then switching to
    10400 baud. The 10400 shouldn't be an issue, however I can use SEROUT for 5
    baud. I'm using a BS2 and the formula INT(1,000,000,baudrate)-20 overflows
    the 12(?) bit wide setting.

    Seeing as I only have to send the 0x33 once, (all further communication is
    done at 10,400) I figured that I could just manually strobe it out the I/O
    line.

    I'm sending a start bit, low ,low, high, high, low, low, high, high, and
    stop bit, using NAP to pause between switching the bits. I know NAP isn't
    guaranteed to be all that accurate or consistant, but I'm not getting any
    joy at all. Has anyone done anything similar?

    I'm pretty new to stamp/microcontroller applications and would appreciate
    any suggestions.

    Cheers
    Peter Kerr
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-16 19:17
    NAP leaves the outputs floating, try using PAUSE
    Original Message
    From: "Peter Kerr" <peter.kerr@

    > Hi
    >
    > I'm building an OBD-II interface board so I can talk to my in car ECU from
    a
    > handheld. The interface card was originally just to shift the line levels
    > from TTL to RS232 and add opto-isolation, however I thought I would add a
    > stamp to handle the message formatting, heartbeat, changes in baud rate
    etc.
    >
    > Communication is initiated by sending 0x33 at 5 baud and then switching to
    > 10400 baud. The 10400 shouldn't be an issue, however I can use SEROUT for
    5
    > baud. I'm using a BS2 and the formula INT(1,000,000,baudrate)-20 overflows
    > the 12(?) bit wide setting.
    >
    > Seeing as I only have to send the 0x33 once, (all further communication is
    > done at 10,400) I figured that I could just manually strobe it out the I/O
    > line.
    >
    > I'm sending a start bit, low ,low, high, high, low, low, high, high, and
    > stop bit, using NAP to pause between switching the bits. I know NAP isn't
    > guaranteed to be all that accurate or consistant, but I'm not getting any
    > joy at all. Has anyone done anything similar?
    >
    > I'm pretty new to stamp/microcontroller applications and would appreciate
    > any suggestions.
    >
    > Cheers
    > Peter Kerr
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-16 20:48
    Thanks for tip about LSB. I didn't know that.
    The output pin drives a npn transistor which inverts the signal, I'm not
    sure if thats what you mean by a line driver.

    I've just done some more reading and found that RS232 data lines are
    inverted. I'm not sure if the ECU conforms to this so I'll do some testing.

    Re ODB-II transmission protocol:
    Details of this are incredibly hard to get. The seems to be three seperate
    parts:
    Hardware spec - ie what protocol is used. This is manufacturer based. more
    details at www.obdii.com
    OBD-II generic spec SAE J1979 www.sae.org do a search for J1979. I have
    yet to purchase this.
    Manufacturer specific Device Trouble Codes (DTC)

    Some more details are at http://www.andywhittaker.com/ecu/obdii_software.htm

    Hope this helps
    Peter kerr

    Original Message
    From: S Parkis [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=YRt1-PY2FAMLwG4gVhopEUDddKPMnKNQvWtvLcE29wcnzBVce7xOPhypcYRSwe3EEsCOzcTufNpKGhbM6h4GJw]parkiss@e...[/url
    Sent: Tuesday, January 15, 2002 7:32 PM
    To: basicstamps@yahoogroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] OBD2 project


    Peter-

    Async serial is always LSB first. Not sure if that's what you mean
    to be doing (i.e., sending inverted). I think I'd also use PAUSE
    vice NAP for greater precision. If you're using a line driver, try:

    ser_pin CON 1 ' or whatever

    LOW ser_pin: GOSUB delay ' start bit (RS232 high)
    HIGH ser_pin: GOSUB delay ' low order bit 0
    GOSUB delay ' repeat for bit 1
    LOW ser_pin: GOSUB delay ' bit 2
    GOSUB delay ' bit 3
    HIGH ser_pin: GOSUB delay ' bit 4
    GOSUB delay ' repeat for bit 5
    LOW ser_pin: GOSUB delay ' bit 6
    GOSUB delay ' high order bit 7
    HIGH ser_pin: GOSUB delay ' stop bit
    (initial transmission complete at this point)

    delay:
    PAUSE 200: RETURN


    Is this OBD-II transmission protocol described on a web site
    somewhere?

    Steve

    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-17 14:11
    --- In basicstamps@y..., "S Parkis" <parkiss@e...> wrote:
    [noparse][[/noparse]snip]
    > Is this OBD-II transmission protocol described on a web site
    > somewhere?

    B&B Electronics <http://www.bb-elec.com/> at one time had an
    application note available describing OBDII. I see they have now
    created a separate company <http://www.autotap.com/> and I can't seem
    to find that app note now.
    --
    Greg
  • ArchiverArchiver Posts: 46,084
    edited 2002-11-26 22:51
    Can you possibly post your schematic?

    --- In basicstamps@y..., Peter Kerr <peter.kerr@z...> wrote:
    > Hi
    >
    > I'm building an OBD-II interface board so I can talk to my in car
    ECU from a
    > handheld. The interface card was originally just to shift the line
    levels
    > from TTL to RS232 and add opto-isolation, however I thought I
    would add a
    > stamp to handle the message formatting, heartbeat, changes in baud
    rate etc.
    >
    > Communication is initiated by sending 0x33 at 5 baud and then
    switching to
    > 10400 baud. The 10400 shouldn't be an issue, however I can use
    SEROUT for 5
    > baud. I'm using a BS2 and the formula INT(1,000,000,baudrate)-20
    overflows
    > the 12(?) bit wide setting.
    >
    > Seeing as I only have to send the 0x33 once, (all further
    communication is
    > done at 10,400) I figured that I could just manually strobe it out
    the I/O
    > line.
    >
    > I'm sending a start bit, low ,low, high, high, low, low, high,
    high, and
    > stop bit, using NAP to pause between switching the bits. I know
    NAP isn't
    > guaranteed to be all that accurate or consistant, but I'm not
    getting any
    > joy at all. Has anyone done anything similar?
    >
    > I'm pretty new to stamp/microcontroller applications and would
    appreciate
    > any suggestions.
    >
    > Cheers
    > Peter Kerr
Sign In or Register to comment.