Re: OBD2 J1850/VPW Mode

Hacking multi-tool. Get one for $30, including worldwide shipping.

OBD2 J1850/VPW Mode

Postby Shadyman » Tue Dec 15, 2009 6:39 pm

Hi all,

Since my BusPirate is on the way, I thought I should start digging around in the code. I'm planning an SAE-J1850 VPW mode for the BusPirate. J1850 VPW is the OBD2 signalling protocol used by GM and many Chrysler cars. (Though, the J1850 PWM used by Ford would be much easier to implement, I don't drive Fords. Sorry! If anyone does, (drive Fords, that is), it doesn't look all that hard to implent a sniffer for it. 5V High PWM, 2-Wire, but I digress...)

J1850 VPW uses 1 wire, with High at 7V and the decision point at 3.5V. (Edit: "Implementing the J1850 Protocol" states that 5V is an acceptable output, so I guess the only problem would be taming the input so as not to blow something up on the BP) There's a really good explaination on implementing it below (See the "Implementing the J1850 Protocol" PDF). It's lacking a couple specifics, but has most of what I need to implement it, assuming I can figure it all out :)

Since 1's and 0's aren't represented by highs and lows, they're represented by shifts of different durations, this protocol is all about timing. Is there a way currently to figure out how long a signal is in a certain state?

See also:

(Offtopic: I found anything you'd ever want to know about ISO 14230 protocol here.)
Last edited by Shadyman on Wed Dec 16, 2009 10:47 pm, edited 1 time in total.
Vote "Logic Ninja" or "Bit Ninja" for the DangerousPrototypes SUMP Logic Analyzer!
Shadyman
Newbie
Newbie
 
Posts: 36
Joined: Sun Dec 13, 2009 6:23 pm
Location: Ottawa, ON, Canada

Re: OBD2 J1850/VPW Mode

Postby ian » Wed Dec 16, 2009 1:43 am

The PIC has a bunch of timers, and several of them at 32bits long, so counting shouldn't be a problem.

At 7volts, it will need a small adapter board. Probably a resistor divider?

It sounds like this might be a good use of a comparator to detect the swing. The PIC has several comparators, and I believe they can be assigned to any pins we need.

I'm excited about adding this protocol. It's long been requested, but I'm an urbanite without a car.
Got a question? Please ask in the forum for the fastest answers.
User avatar
ian
Crew
Crew
 
Posts: 10803
Joined: Mon Jul 06, 2009 6:14 am

Re: OBD2 J1850/VPW Mode

Postby Shadyman » Wed Dec 16, 2009 11:32 am

So as far as an adapter, I'm thinking it'd probably be something like this:

Output Pin -> Diode -> (Maybe even a booster to 7V just to be sure?) -> OBD2 Pin 2 (Bus Positive Line)
Input Pin (Capture/Compare) <- Resitor divider <- OBD2 Pin 2 (Bus Positive Line)

It would probably be wise to add an opto-isolator, since OBD2 is designed to work regardless of ground loops, power spikes, floating grounds, etc.

Edit: Ideally, once I have an interface set up, I can just put the buspirate in logic analyzer mode and collect data.

Here's an interesting hptuners.com forum thread on VPW directly over RS232
And here's a cached copy of an open-source VPW bit-bang software (In C, even)!!! [archive.org]

The .c file is very well commented, it should be pretty easy to integrate. It's under a "This code may be embedded into any other free software packages so long as the original author receives due credit" license.
Last edited by Shadyman on Thu Dec 17, 2009 10:50 pm, edited 1 time in total.
Vote "Logic Ninja" or "Bit Ninja" for the DangerousPrototypes SUMP Logic Analyzer!
Shadyman
Newbie
Newbie
 
Posts: 36
Joined: Sun Dec 13, 2009 6:23 pm
Location: Ottawa, ON, Canada

Re: OBD2 J1850/VPW Mode

Postby Shadyman » Sun Jan 17, 2010 11:26 pm

There is an IC available through Digikey (though it is discontinued) to take care of the waveshaping and all that fun stuff. It doesn't seem to do all that much, so it's probably just easier to do it codewise.

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MC33390&webpageId=M98445
Vote "Logic Ninja" or "Bit Ninja" for the DangerousPrototypes SUMP Logic Analyzer!
Shadyman
Newbie
Newbie
 
Posts: 36
Joined: Sun Dec 13, 2009 6:23 pm
Location: Ottawa, ON, Canada

Re: OBD2 J1850/VPW Mode

Postby WDZaphod » Wed Feb 10, 2010 4:36 am

Hi,
I am currently connecting my Arduino to the OBD2-Bus (2000 Chevy Corvette) with an ELM322 Chip, what offers a very simple way of communicating with J1850VPW. The bigger Version (ELM327) also offers CAN Communication.
The only problem: The ELM Chip alone costs more than the whole Bus Pirate.
Woud be very nice, if you could implement a ELM Compatible Protocol for the BP!
http://elmelectronics.com/prices.html
WDZaphod
Newbie
Newbie
 
Posts: 4
Joined: Wed Feb 10, 2010 4:28 am

Re: OBD2 J1850/VPW Mode

Postby pppd » Wed Feb 10, 2010 9:38 am

Some time ago I bought a cheap ( ~ $40 ) OBD-II interface which was supposed to be based on the ELM327 chip, but when I opened it I found a PIC emulating the ELM327 chip and a FTDI232R USB to Serial converter. So this is certainly doable, but there might be some legal issues, I don't think cloning proprietary chips is legal, and I have no idea if the OBD-II protocol specification is freely available anywhere?
User avatar
pppd
Full Member
Full Member
 
Posts: 145
Joined: Tue Nov 24, 2009 9:49 am
Location: Stockholm, Sweden

Re: OBD2 J1850/VPW Mode

Postby ian » Wed Feb 10, 2010 10:16 am

I've seen a number of documents that describe the various auto protocols. I don't think it would be that difficult to add these features to the Bus Pirate. I don't have any equipment to test with (let alone a big variety of cars), so it's waiting for the right person (with access to lots of car computers) to implement it :)
Got a question? Please ask in the forum for the fastest answers.
User avatar
ian
Crew
Crew
 
Posts: 10803
Joined: Mon Jul 06, 2009 6:14 am

Re: OBD2 J1850/VPW Mode

Postby Shadyman » Wed Feb 10, 2010 11:34 pm

pppd wrote:but when I opened it I found a PIC emulating the ELM327 chip and a FTDI232R USB to Serial converter.


Actually, the ELM-series of chips are just PICs flashed with some OBD2-deciphering code

pppd wrote:but there might be some legal issues, I don't think cloning proprietary chips is legal


No, and the PICs that the ELM code is programmed on is code-locked. You can't do a firmware dump, because a fuse has been set (which can only be removed by a full erase) such that it'll return 00 for the entire codespace.
Last edited by Shadyman on Wed Feb 10, 2010 11:38 pm, edited 1 time in total.
Vote "Logic Ninja" or "Bit Ninja" for the DangerousPrototypes SUMP Logic Analyzer!
Shadyman
Newbie
Newbie
 
Posts: 36
Joined: Sun Dec 13, 2009 6:23 pm
Location: Ottawa, ON, Canada

Re: OBD2 J1850/VPW Mode

Postby ian » Mon Feb 15, 2010 8:28 am

Here's a concise rundown that was just posted in the issue tracker:
http://code.google.com/p/the-bus-pirate ... tail?id=10
Got a question? Please ask in the forum for the fastest answers.
User avatar
ian
Crew
Crew
 
Posts: 10803
Joined: Mon Jul 06, 2009 6:14 am

Re: OBD2 J1850/VPW Mode

Postby Sjaak » Mon Feb 15, 2010 1:00 pm

I do 'own' a recent vw car, so I can test it a bit. Somewhere in march I'll get a seat. However I don't know where the connector is (it should be near the driversposition).

That post in the issue list is a great resource!
For my projects and failures see my blog: http://SMDprutser.nl/
User avatar
Sjaak
Fellow
Fellow
 
Posts: 3297
Joined: Sun Jan 03, 2010 2:45 pm
Location: Hiero

Re: OBD2 J1850/VPW Mode

Postby bash » Tue Jun 01, 2010 11:04 pm

ian wrote:Here's a concise rundown that was just posted in the issue tracker:
http://code.google.com/p/the-bus-pirate ... tail?id=10


Hi Ian, I put in the Bus Pirate issues a file (docs_onboarddiag.rar) that have a lot of infos about OBD2...
I work with car protocols and have some infos to share if necessary to put car protocols in Bus pirate..

Regards

Bash
bash
Newbie
Newbie
 
Posts: 2
Joined: Tue Jun 01, 2010 10:16 pm

Re: OBD2 J1850/VPW Mode

Postby ian » Wed Jun 02, 2010 3:28 am

Hi Bash - any help with car protocols would be great! There is a big demand for ODBII and car-CAN, etc.
Got a question? Please ask in the forum for the fastest answers.
User avatar
ian
Crew
Crew
 
Posts: 10803
Joined: Mon Jul 06, 2009 6:14 am

Re: OBD2 J1850/VPW Mode

Postby sqkybeaver » Fri Apr 08, 2011 7:03 pm

it is not really worth it to develop a obd reader for such an old car, however there are many options for obd2,

Bluetooth, standalone code grabbers, low end scan-tools, and the likes of the high end tools from snapon etc.

most of the older cars it is better just to use a trouble light. there may be more automotive tool reviews/tear-downs coming.
User avatar
sqkybeaver
Hero Member
Hero Member
 
Posts: 1095
Joined: Tue Dec 07, 2010 8:50 am
Location: New Hampshire, USA

Re: OBD2 J1850/VPW Mode

Postby MichaelZ » Sun Apr 10, 2011 5:48 am

I just bought a 2010 BMW G650GS motorcycle and it has an onboard computer that uses the CAN bus. There are a couple of companies that sell OBD interfaces to connect to it's computer but they are expensive. I have considered building an interface but you have to have good documentation on the codes and results which I am not sure is available.

In the past I have used the ELM-320 chip in a project for my Ford truck. ELM is a small developer trying to make a living and I do not support hacking his products.

Elm has a lot of examples for use of his chips. A lot of the hassle is in the actual interface to the vehicle computer.

I ran across OBD-DIAG which has some interesting hardware available. They have simulators so that you dont need to have a bunch of cars or computers.
"Too many projects, so little time"
User avatar
MichaelZ
Developer
Developer
 
Posts: 354
Joined: Wed May 19, 2010 10:46 pm
Location: Taipei Taiwan

Re: OBD2 J1850/VPW Mode

Postby MichaelZ » Sun Apr 10, 2011 6:49 am

I was digging in my Eagle Projects files and found that I had a schematic and board for the ObdDiag.Net OBD-II ELM327 compatible AllPro adapter with USB. The version I have sch and bd files for is the previous version with the Freescale chips.
User avatar
MichaelZ
Developer
Developer
 
Posts: 354
Joined: Wed May 19, 2010 10:46 pm
Location: Taipei Taiwan

Next

Return to Bus Pirate Support