J1850 VPW Interface

AVR J1850 VPW interface to connect a Chrysler or GM car bus to a PC for On Board Diagnostic (OBD) monitoring. My interface is build around Atmel AVR mega8 controller, my favourite “workhorse”. The controller is available also in DIP package for all who not want to built with SMD components. With 8k flash memory we have plenty of space for all kind of features. The basic source code which  supports all functions uses 3k code space.

See the documentation for all features and how to use it.

It seems someone has made a commercial product from my project: EMU322 Interface

Some features:

  • SAE J1850 VPW to RS232 interface
  • simple AT command control
  • different Baud rates, from 9600 to 115200 Baud
  • 4 different bus monitor functions
  • support for 1 and 3 byte header messages

This interface was tested with firmware v1.06 and the following OBD software

  • Scantool.net
  • wOBD
  • Scanmaster
  • Digimoto
  • Proscan
  • OBDspy
  • Scantool
    Mode 22

Use the firmware with 9600Baud and ELM322 tag for all mentioned tools.

Example circuit:

PCB with LCD

Example circuit
Version: F
355.8 KB
Version: 1.07
32.8 KB

42 thoughts on “J1850 VPW Interface

  1. Great contribution! I just emailed you with some minor changes to your code base that may help others that are trying to port to other microcontrollers.

  2. Hello! I would like to make a J1850VPW lcd to use inside the car, but I’m using BascomAvr.

    Any suggestion, or help..?

    I have made many projects using Bascom.

    • I have such LCD in my car as well, showing all kind of bus data. Not OBD but was is already available on the bus, and that’s a lot.

      Can not offer much help since I have no idea about Bascom. But since you did many projects it should be easy for you to port the C code to Bascom.
      All you need is to convert the J1850 .c and .h files to Bascom and you can access the bus. Then add your LCD functions and intepreter for incoming datan and you are done.

      • Thanks Michael,

        I will start to translate to Bascom.

        I will keep inform about progress : )

  3. Is it possible to add to your project support for the protocol ISO 9141-2?

    ???????? ?? ???????? ? ??? ?????? ????????? ????????? ISO 9141-2?

  4. Hi, And many thanks for your work on this!! I have taken your work, and used it as a learning experience to re-work it just a little to work on the Arduino platform.. Again, many thanks!!!!!

  5. hello, I want to diagnose FORD POWER STROKE IS A J1850 VPM, but the software using a USB interface, do you think if I add the USB micro, get good results, do you think if I use a free commercial software, you can get fault codes FORD mark.

    • As far as I know For uses J1850 PWM not VPW. You can use any USB-RS232 Adapter with the interface.

  6. pardon me for being ignorant but where do I download source code 1.06 to flash the project with?

  7. Possible to buy from you an already build PCB board ?
    I am so board with soldering irons 🙂

  8. Hello Michael, Is I promised some months ago I started to learn better the VPW protocol. instead of try to translate your C code, I finally understanded nicely the VPW trnsitions pattern. I got an Digital Storage Oscilloscope and with just the Key on “ACC” position, get lot of bit patterns from my OBDII connector. As you indicated, there is a lot of data!

    I captured a complete packet with SOF. After printing the pattern I was able to decode by hand the bytes:

    $E8 $FF $40 $03 $ED

    Now I’m in the way to start likely from scratch using Bascom Avr, and using your code as guide, but will try to implement my own timing decode routines, based on Bascom language and M2560 chip.

    Do you know where could I get reference for the above packet ? I think this is data exchanged between the modules of my car.

    • You will hardly find documentation of car specific bus data.
      It’s all proprietary information kept secret by the manufactures.

      There are only a few SAE specification describing some basic data frames.
      VPW frame structure is described in SAE J1850.

      • Hello Michael,

        I finally have my interface working. I used Do..Loop cicles for timing decode.

        I tested it with a Stand-Alone workbench PCM. No other modules are on bus. So I guess PCM is interrogating othe rmodules.

        this is the output:

        J1850VPW 1.34

        48 EA 10 0A 00 72
        E8 FF 10 03 B3
        48 EA 10 0A 00 72
        49 92 10 01 BE
        49 92 10 01 BE
        48 EA 10 0A 00 72
        49 92 10 01 BE
        48 EA 10 0A 00 72
        E8 FF 10 03 B3
        49 92 10 01 BE
        48 EA 10 0A 00 72
        49 92 10 01 BE
        48 EA 10 0A 00 72
        49 92 10 01 BE
        E8 FF 10 03 B3
        48 EA 10 0A 00 72
        49 92 10 01 BE
        48 EA 10 0A 00 72
        49 92 10 01 BE
        48 EA 10 0A 00 72
        E8 FF 10 03 B3
        48 EA 10 0A 00 72
        E8 FF 10 03 B3
        here it keeps repeating this message every second…
        E8 FF 10 03 B3
        E8 FF 10 03 B3
        E8 FF 10 03 B3

  9. Micheal,
    I would like to port this scanner to a Parallax Propeller processor. When I try to download the source files (AVR_J1850_VPW_Interface_v1.07.zip Version: 1.07), the “zip” file is empty. I am using a windows XP system. Any help would be appriciated. Thank You

  10. Hi!
    I found in the internet some firmware of yours that works with OBD2 ISO 9141-2 protocol (AVR ISO 9141/14230-2 Interface by Michael Wolf ), but in the file there was only the firmware.

    Could you send me the schematics for this project? I did not find it in your homepage.

    Thank you.

  11. I found this project here: http://www.elektroda.pl/rtvforum/topic708678.html

    1) Oscilator shown on schematic is 4MHz, however in make file it is 7,372800MHz.

    2) There is no HEX file provided. Installed an Atmel Studio plug in: Create Project form Makefile Extension (Beta) extension. Compilation failed

    3) Tried without make file using only .c и .h files.
    Compiler said SIGNAL(SIG_OVERFLOW0) and SIGNAL(SIG_INTERRUPT0) are deprecated.
    Changed by TIMER0_OVF_vect и INT0_vect. Compilation OK.

    4) Initialization functions never called iso_5_baud_init and iso_fast_init.

    Can anyone help me, please ?

    • The latest version is v1.07 and you can download a ZIP with sourcecode and two hex files above.

      • Hi,
        I tried to contact you by email. However I had a rejection by your mail server:
        Please, contact me by email.
        I wat to give you a debugged (and working) version of AVR ISO 9141/14230-2 Interface.

  12. Hello Michael,

    Thanks for your work.
    Do you have any solution for J1850 PWM protocol ?

  13. I ported this for atmega328 at 16MHz the uart is working but when I select AT MA all I get is new lines every time a frame is recieved. I checked with a DSO and I am geting 6 byte frames. It looks to me from analyzing the code that for this to happen it has to see a valid SOF then no other data is this correct. could this be a timing issue. could it be seing every dominant state as SOF. it looked to me that the only thing that needed to be changed to make the recive code work on this chip was to declare the crystal frequency. I checked the calculations in the code for ticks to us and it looks more accurate at 16MHz. These are not OBD messages they are manufacture specific mesages being brodcast from an instrument cluster. I am trying to read everything including header and crc. any help would be appreciated

    Thank You

    • Are you sure that timing is still correct?
      16MHz is 4 times what original is used. For me it sounds a timer is overflowing. The timer is running with prescaler 8, I think you need a higher prescaler to prevent overflowing at 16MHz.

      • Hi!

        I’ve been trying to port your code so I could use it with my Arduino Nano (Atmega328 onboard). I’m missing some components so I can’t test the code for now but I didn’t change the prescaler. What chould I change it to?

        Thanks 😉

        • With a 16MHz crystal instead of 4MHz the timer needs a prescaler of 32 not 8. Unfortunately the next higher prescaler is 64. There are three options:
          1) Use prescaler 8 and change all the timing values. You may run into overflow issues, though.
          2) Use prescaler 64 and change all the timing values. No overflow issues I think.
          3) Exchange the Arduino Nano 16MHz crystal with a 4MHz one. Easiest way without touching the code. (Maybe for pinout changes)

          I would go with 3.

  14. Gday Michael,

    Iv been attempted to port your AVR code to my arduino mega, only get so far till I get lost in what the coding is actually doing. The AVR to Arduino style coding is different thus its easy to get lost with whats happening!

    Seems alot of people are attempting this with a arduino mega also. Michael, anychance if we post up parts of the code, you can help us understand what section is actually doing so we can convert it appropriately.

      • Cheers Michael, Your help is very much appreciated!

        Well Iv gone through most of the code, commented on each line to ensure I know whats happening (and yeah.. its really not too hard to follow). But Im a little confused on what exactly is being calculated here:

        #define us2cnt(us) ((unsigned int)((unsigned long)(us) / (1000000L / (float)((unsigned long)MCU_XTAL / 1L))))

        Can you explain what exactly this is doing?
        From what I find, MCU_XTAL references to the crystal.. so 4Mhz (4,000,000). But Im not sure what those “L”s mean or what they are doing?

          • Gday Michael, So far everything has been ported across and there are no errors (woop woop!).

            I was reading through a few comments above,about the prescaler and 16Mhz, where is the watchog prescaler defined in the code?

            And from whats posted above, Using the 16Mhz crystal, I will need to set the prescaler to 64, and adjust the timing values. Anychance you can give a quick example of how you came up with your times using a 4Mhz crystal as a prescaler of 8?

            Should easily be able to source out a 4Mhz crystal off ebay, although wouldnt mind exploring the non-hardware altering route first.

          • The watchdog is not used in this project. In case you mean the timer prescaler it’s defined in j1850.h, line
            #define c_start_pulse_timer 0x02

            In the same file in this line:
            #define us2cnt(us) ((unsigned char)((unsigned long)(us) / (1000000L / (float)((unsigned long)MCU_XTAL / 8L))))
            the 8L needs to be changed to the new timer prescaler.

  15. Greetings!
    I have a questiong about the AVR ISO 9141/14230-2 Interface.

    I commented these lines:
    //#define ISO_K_LINE_OUT_NEG // define K line output level inverted by hardware
    //#define ISO_L_LINE_OUT_NEG // define L line output level inverted by hardware
    //#define ISO_K_LINE_IN_NEG // define K line input level inverted by hardware
    because my k line is not inverted by hardware, however now the code freezes when I try to call iso_fast_init().
    I found out that it freezes on this line iso_wait_idle(). When the lines above are not commented, the program doesn’t freeze there but I can’t connect to the ECU. I think it is something related to the timings. I’m using a 16MHz crystal. Do you have any idea how should I configure the T1_PRESCALER so I can have 8us at 16MHz?

  16. I want to base your project to scan tool not to use a computer and the required data output to the LSD.You do not tell me how best to implement such an idea? Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments will be moderated! Spam deleted immediately!
Before you submit form:
Human test by Not Captcha