J1850 sniffer base code.

Post Reply
User avatar
AngelMarc
Posts: 198
Joined: Sat Apr 08, 2023 9:23 pm
cars: A CB450 running to 8,000RPM with a P59.

J1850 sniffer base code.

Post by AngelMarc »

Recently used ChatGPT to make a 24x decoder in Arduino IDE. Tested with my signal generator at varying RPM. Such a decoder might work for sniffing GM VPW and Ford PWM, and a gamecube controller.
Just turns it into a stream of 1s and 0s and sends over USB serial. No frame analyzer GUI or anything. No OBD specific tools required. Just a potential starting point for others to make use of.
Could be modified to send over hardware serial pins if desired.

If I remember right, there are certain start and end bits that are a no pulse (special characters essentially, as far as this code goes), so you have to account for that or modify to read the special characters after a certain time of no pulse or whatever.
Attachments
GPTPatternread.ino
(1.33 KiB) Downloaded 40 times
Last edited by AngelMarc on Tue May 06, 2025 6:55 pm, edited 1 time in total.
Don't stress specific units.
User avatar
AngelMarc
Posts: 198
Joined: Sat Apr 08, 2023 9:23 pm
cars: A CB450 running to 8,000RPM with a P59.

Re: VPW sniffer base code.

Post by AngelMarc »

This one approaches limits of my signal generator.
Should do 10.4 Kbit no problem.
EDIT: I think the serial fails to keep up and looses some bits.
Attachments
GPTCrankPacketsDualCore.ino
(2.4 KiB) Downloaded 39 times
Last edited by AngelMarc on Tue May 06, 2025 6:57 pm, edited 1 time in total.
Don't stress specific units.
User avatar
antus
Site Admin
Posts: 8988
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: VPW sniffer base code.

Post by antus »

For J1850 VPW there is a plugin that ended up in sigrok official that adds the protocol over the base timings too. The protocol decoder is in python. It supports 1x and 4x on generic cheap hardware. No support for J1850 PWM, though. viewtopic.php?t=4761

The harder parts of vpw is that there are two speeds and the logic level is not high and low but in the transition. Thus scanning high and low will not detect the right data. You can read the spec here viewtopic.php?p=65947#p65947

edit: fixed link
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
AngelMarc
Posts: 198
Joined: Sat Apr 08, 2023 9:23 pm
cars: A CB450 running to 8,000RPM with a P59.

Re: VPW sniffer base code.

Post by AngelMarc »

Looking at the 1st picture. VPW do some weird decoding like non-audio CD? Where current state being 1 or 0 depends on previous state? If so, that'd be a good bit of translation needed on top of what I attached here. Been a while since I looked into it.
I might read that at some point.
Last edited by AngelMarc on Tue May 06, 2025 6:35 pm, edited 1 time in total.
Don't stress specific units.
User avatar
antus
Site Admin
Posts: 8988
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: VPW sniffer base code.

Post by antus »

From memory I think its the direction on the shift. Long is 1 if its at 5v and 0 at 0v. But you'd need to check the spec or the decoder code. You can also measure the length of the start of frame (SOF) to determine if its a 1x or 4x packet, or decode both timings at the same time regardless. Its been a long time since I was monitoring the bus directly. The protocol layer could be added to your sketch.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
AngelMarc
Posts: 198
Joined: Sat Apr 08, 2023 9:23 pm
cars: A CB450 running to 8,000RPM with a P59.

Re: VPW sniffer base code.

Post by AngelMarc »

Need concise stuff right now, but I think I'm remembering some detail. It involves a maximum transition time.
Maybe it would do Ford just fine though.
Maybe just switch which is measured 1st, high or low, so the compare happens at the right time. I don't have anything Ford to test. And don't currently have much of a goal for any of this.
Attachments
Capture.PNG
Capture.PNG (26.1 KiB) Viewed 1500 times
Don't stress specific units.
User avatar
AngelMarc
Posts: 198
Joined: Sat Apr 08, 2023 9:23 pm
cars: A CB450 running to 8,000RPM with a P59.

Re: VPW sniffer base code.

Post by AngelMarc »

antus wrote: Tue May 06, 2025 6:33 pm From memory I think its the direction on the shift. Long is 1 if its at 5v and 0 at 0v.
If graph is comprehensive, yeah. Short low = 0, long high = 0, long low = 1, short high = 1. And then whatever there is for multiple speeds.
Don't stress specific units.
User avatar
antus
Site Admin
Posts: 8988
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: J1850 sniffer base code.

Post by antus »

yep. pwm and vpw are different but theyre both in the spec above.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
Post Reply