Shop OBEX P1 Docs P2 Docs Learn Events
obd k-line interface — Parallax Forums

obd k-line interface

PFloyd36069PFloyd36069 Posts: 135
edited 2014-04-25 01:06 in Propeller 1
Hello,
Just curious if this (http://blog.perquin.com/prj/obdii/obdii_avr.gif) is compatible with the prop. I've tried to get it to work but haven't had any luck. I'm using the full duplex serial object with it set to 125K baud rate, maybe that's too fast for the transistors? If it is compatible, is there anything special I need to do in the program to get it to work?

Thanks,
Bryan

Comments

  • kwinnkwinn Posts: 8,697
    edited 2014-04-22 18:16
    The transistors are more than fast enough. The problem may be with the 10K resistor going back to PIN2_RXD. That may have damaged the pin diodes since they are only rated for 0.5mA, and 12V on a 10K resistor is 0.9mA. Use a 20-27K resistor.
  • PFloyd36069PFloyd36069 Posts: 135
    edited 2014-04-23 11:13
    I'll have to try different resistors. If that pin still functions otherwise, is the diode OK?

    Thanks,
    Bryan
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2014-04-23 11:51
    Hi Bryan;
    I'll have to try different resistors. If that pin still functions otherwise, is the diode OK?

    Thanks,
    Bryan
    I suspect the pins diode to VDD is probably OK.
    Yes, as kwinn says, there is more than the maximum of 0.5mA.
    More like:
    (13.8V - (3.3V + 0.6V)) / 10K = 0.99mA
    But this, not something we want to do, although probably isn't sufficient to cause damage.

    Automotive electrical systems are a pretty severe environment.
    Its pretty easy to see over voltages caused by alternator charging systems 18V.
    Jump starting can cause greater than 28V.
    And other short spikes with much higher voltages.

    27K should be good at protecting the Prop.
    This should protect up to:
    (0.5mA * 27K) + (3.3V + 0.6V)) = 17.4V

    I would like to protect up to 28V minimum:
    (28V - (3.3V + 0.6V)) / 0.5mA = 47K

    47K should still work well at 115200 baud.

    BTW, the baud rate mentioned was 125K baud. That should have been 115200 baud.

    Lastly, the circuit you show is a non inverting circuit.
    Most of the examples with the Prop assume the serial data is inverted.
    This may be why it isn't working.

    Duane J
  • PFloyd36069PFloyd36069 Posts: 135
    edited 2014-04-23 12:21
    So Itd be best to have 47k resistors instead of 10k. Do I need to replace all of them with 47k or just the ones between the circuit and prop pins? And do i invert both Rx and tx or just one of them? And yeah Idk why they're using an uncommon baud rate in the ECM but it actually is 125k :)
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2014-04-23 13:52
    Hi Bryan;
    So It'd be best to have 47k resistors instead of 10k. Do I need to replace all of them with 47k or just the ones between the circuit and prop pins?
    No, the TX side should be just fine as published in the schematic.
    And do i invert both Rx and Tx or just one of them?
    That I don't know as I haven't worked with the ODB myself. Someone more familiar with the serial software can advise better than me, I'm not really a software guy. I think the serial routines can do the inversion in software without any hardware changes.
    And yeah Idk why they're using an uncommon baud rate in the ECM but it actually is 125k :)
    You probably should look at the signals with an oscilloscope to determine what is going on. I think the serial software can be setup for non standard baud rates, but again I'm not that guy.

    The o'scope should be able to show what is going on.

    BTW, to test your Rx pin you could directly connect the Tx and Rx pins together and see if sent characters show up on the Rx input. If so the pin should be OK.
    If not, just use another pin pair.
    What pins are you using? I assume not P30/P31 as they would be for programming.

    Duane J
  • PFloyd36069PFloyd36069 Posts: 135
    edited 2014-04-23 14:49
    OK I'll have to break out the o'scope and take a look at things. I'm using p0/1 at the moment.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2014-04-23 14:57
    I looked up some basic info on ODBII.
    On-board_diagnostics
    I could find nothing running at 125Kbaud.
    Most were much lower speed and with a Pulse-width modulation (PWM) signaling.
    Which would not be compatible with standard RS-232 type signals.

    Duane J
  • PFloyd36069PFloyd36069 Posts: 135
    edited 2014-04-23 15:58
    Well the computer in the car has different software in it that is set for 125k baud. :)
  • kwinnkwinn Posts: 8,697
    edited 2014-04-23 22:13
    The two transistors in the circuit you posted invert the signal twice so the output polarity is the same as the input polarity. In that case I am fairly certain you do not need to invert the RX. At least I have never seen equipment that sends and receives data with opposite polarities. In any case some of the propeller serial drivers can convert the polarity in software.
  • msrobotsmsrobots Posts: 3,709
    edited 2014-04-24 10:41
    Well the computer in the car has different software in it that is set for 125k baud. :)

    Mercedes?

    Enjoy!

    Mike
  • PFloyd36069PFloyd36069 Posts: 135
    edited 2014-04-24 15:29
    Volvo actually lol :) a couple guys added some code to the ecm software for data logging purposes.
  • HughHugh Posts: 362
    edited 2014-04-25 01:06
    You used to be able to buy OBD to RS232 converter boxes that made it easy (Here (although the photos seem to have gone)) but they all seem to have gone to USB.

    100_0096.JPG
    996 x 747 - 167K
    596 x 447 - 86K
Sign In or Register to comment.