Open source GM OBD2 flash tool using a ELM327 device

They go by many names, P01, P59, VPW, '0411 etc. Also covering E38 and newer here.
Locked
User avatar
Tazzi
Posts: 3425
Joined: Thu May 17, 2012 8:53 pm
cars: VE SS Ute
Location: WA
Contact:

Re: Open source GM OBD2 flash tool using a ELM327 device

Post by Tazzi »

I see what you getting at.

If I stripped my own cable down to just VPW, it would be pretty cheap and fast to assemble. What frustrates me is the whole "future proof". This whole project and concept is starting at VPW only... but what about afterwards? Everything else will be CAN based.. so thinking ahead is important.

To reduce cost, something like an arduino nano could be used, this has an inbuilt USB and is small enough to fit into a standard OBD case, which is handy to make a sturdy USB based unit.
Your Local Aussie Reverse Engineer
Contact for Software/Hardware development and Reverse Engineering
Site:https://www.envyouscustoms.com
Mob:+61406 140 726
Image
User avatar
antus
Site Admin
Posts: 8250
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: Open source GM OBD2 flash tool using a ELM327 device

Post by antus »

Yeah, anything is possible given enough time. The limiting factor for packet size is processor ram, and ram management when its tight. The limiting factor for speed is in a small way hardware, but its no problem to build it capable. The biggest cost though is the time to develop quality reliable firmware. This is why im leaning towards the allpro. It will be possible to build a cable cheaper than the allpro's $35 USD, but it'll have to be for the love of it as you'll put in weeks or months on the firmware. As it stands we still have some issues with the allpro we need to resolve (reading more than one packet after a single transmit). Thats time consuming enough when you start with a 95% correct codebase.

Ive just spent my day off looking at the code NSFW refactored last night and building on it and things are looking up. The AVT is now reading reliably at 4x, just one bug left im hopefully about to nail keeping our device queue in sync with the device when switching back to 1x at the end of the read. The scantool is reading at 1x. The allpro is working for me on firmware 1.16 at 4x to the point where it needs to receive the request ok packet then straight after the payload packet. Out of the box we can only make it do 1 receive per transmit, though it should be capable. I have heard v1.17 may have introduced a new bug too (breaking properties read), so they'll be the next things to tackle.

AVT (Fast!):

Code: Select all

[05:06:25:683]  AVT 852 Reset OK
[05:06:25:688]  AVT Firmware 1.5
[05:06:30:023]  VIN: 6H8VTK69FXL478757
[05:06:30:058]  OS ID: 12593358
[05:06:30:082]  Calibration ID: 92088937
[05:06:30:107]  Hardware ID: 16220610
[05:06:30:187]  Serial Number: 2DG0H0L69169
[05:06:30:217]  Broad Cast Code: CRUM
[05:06:30:241]  MEC: 0
[05:06:31:567]  Querying operating system of current PCM.
[05:06:31:597]  OSID: 12593358
[05:06:31:645]  Unlock succeeded.
[05:06:31:649]  Attempting switch to VPW 4x
[05:06:31:668]  PCM is allowing a switch to VPW 4x. Requesting all VPW modules to do so.
[05:06:33:440]  kernel uploaded to PCM succesfully
[05:06:34:580]  Recieved block starting at 0 / 0x0. 0%
[05:06:35:669]  Recieved block starting at 4096 / 0x1000. 0%
[05:06:36:716]  Recieved block starting at 8192 / 0x2000. 1%
[05:06:37:798]  Recieved block starting at 12288 / 0x3000. 2%
[05:06:38:869]  Recieved block starting at 16384 / 0x4000. 3%
[05:06:40:009]  Recieved block starting at 20480 / 0x5000. 3%
[05:06:40:979]  Recieved block starting at 24576 / 0x6000. 4%
[05:06:42:055]  Recieved block starting at 28672 / 0x7000. 5%
[05:06:43:111]  Recieved block starting at 32768 / 0x8000. 6%
[05:06:44:190]  Recieved block starting at 36864 / 0x9000. 7%
[05:06:45:264]  Recieved block starting at 40960 / 0xA000. 7%
[05:06:46:311]  Recieved block starting at 45056 / 0xB000. 8%
[05:06:47:371]  Recieved block starting at 49152 / 0xC000. 9%
[05:06:48:440]  Recieved block starting at 53248 / 0xD000. 10%
[05:06:49:482]  Recieved block starting at 57344 / 0xE000. 10%
[05:06:50:544]  Recieved block starting at 61440 / 0xF000. 11%
[05:06:51:611]  Recieved block starting at 65536 / 0x10000. 12%
[05:06:52:670]  Recieved block starting at 69632 / 0x11000. 13%
[05:06:53:715]  Recieved block starting at 73728 / 0x12000. 14%
<snip>
[05:08:43:342]  Recieved block starting at 491520 / 0x78000. 93%
[05:08:44:393]  Recieved block starting at 495616 / 0x79000. 94%
[05:08:45:497]  Recieved block starting at 499712 / 0x7A000. 95%
[05:08:46:554]  Recieved block starting at 503808 / 0x7B000. 96%
[05:08:47:635]  Recieved block starting at 507904 / 0x7C000. 96%
[05:08:48:685]  Recieved block starting at 512000 / 0x7D000. 97%
[05:08:49:766]  Recieved block starting at 516096 / 0x7E000. 98%
[05:08:50:815]  Recieved block starting at 520192 / 0x7F000. 99%
[05:08:50:819]  Reverting to VPW 1x
[05:17:55:300]  Will save to test.bin 
[05:17:55:303]  Saving contents to test.bin 
Scantool OBDLink SX:

Code: Select all

[04:12:44:496]  Elm ID: ELM327 v1.3a
[04:12:44:498]  ScanTool ID: STN1130 v4.0.1
[04:12:44:514]  Voltage: 13.6V
[04:12:47:009]  VIN: 6H8VTK69FXL478757
[04:12:47:074]  OS ID: 12593358
[04:12:47:136]  Calibration ID: 92088937
[04:12:47:199]  Hardware ID: 16220610
[04:12:47:395]  Serial Number: 2DG0H0L69169
[04:12:47:456]  Broad Cast Code: CRUM
[04:12:47:520]  MEC: 0
[04:12:48:393]  Querying operating system of current PCM.
[04:12:48:447]  OSID: 12593358
[04:12:48:575]  Unlock succeeded.
[04:12:48:580]  This interface does not support VPW 4x
[04:12:49:423]  Kernel upload 19% complete.
[04:12:49:663]  Kernel upload 35% complete.
[04:12:49:904]  Kernel upload 51% complete.
[04:12:50:144]  Kernel upload 67% complete.
[04:12:50:383]  Kernel upload 83% complete.
[04:12:50:623]  Kernel upload 100% complete.
[04:12:50:627]  kernel uploaded to PCM succesfully
[04:12:51:566]  Recieved block starting at 0 / 0x0. 0%
[04:12:52:882]  Recieved block starting at 512 / 0x200. 0%
[04:12:53:756]  Recieved block starting at 1024 / 0x400. 0%
[04:12:54:507]  Recieved block starting at 1536 / 0x600. 0%
[04:12:55:590]  Recieved block starting at 2048 / 0x800. 0%
[04:12:56:269]  Recieved block starting at 2560 / 0xA00. 0%
[04:12:56:937]  Recieved block starting at 3072 / 0xC00. 0%
[04:12:58:019]  Recieved block starting at 3584 / 0xE00. 0%
[04:12:58:695]  Recieved block starting at 4096 / 0x1000. 0%
[04:12:59:719]  Recieved block starting at 4608 / 0x1200. 0%
[04:13:01:011]  Recieved block starting at 5120 / 0x1400. 0%
[04:13:01:713]  Recieved block starting at 5632 / 0x1600. 1%
[04:13:02:396]  Recieved block starting at 6144 / 0x1800. 1%
[04:13:03:474]  Recieved block starting at 6656 / 0x1A00. 1%
[04:13:04:139]  Recieved block starting at 7168 / 0x1C00. 1%
<snip>
Allpro 1.16 (happens to be on my development unit at the moment):

Code: Select all

[05:41:13:366]  Elm ID: ELM327 v2.1
[05:41:13:367]  All Pro Copyright: Copyright (c) 2009-2018 ObdDiag.Net This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[05:41:13:378]  All Pro Firmware: 1.16
[05:41:13:408]  All Pro Self Rest Result: PWM wiring is OK VPW wiring is OK ISO9141/14230 wiring is OK CAN wiring is OK
[05:41:13:421]  Voltage: 13.4V
[05:41:16:109]  VIN: 6H8VTK69FXL478757
[05:41:16:189]  OS ID: 12593358
[05:41:16:284]  Calibration ID: 92088937
[05:41:16:364]  Hardware ID: 16220610
[05:41:16:634]  Serial Number: 2DG0H0L69169
[05:41:16:729]  Broad Cast Code: CRUM
[05:41:16:809]  MEC: 0
[05:41:18:330]  Querying operating system of current PCM.
[05:41:18:415]  OSID: 12593358
[05:41:18:606]  Unlock succeeded.
[05:41:18:611]  Attempting switch to VPW 4x
[05:41:18:701]  PCM is allowing a switch to VPW 4x. Requesting all VPW modules to do so.
[05:41:19:004]  Unable to send request to upload kernel to RAM.
[05:41:19:009]  Failed to upload kernel uploaded to PCM
[05:41:19:083]  Reverting to VPW 1x
[05:41:19:163]  Read failed, Error
Work in progress..... one way to spend a day off!
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
Tazzi
Posts: 3425
Joined: Thu May 17, 2012 8:53 pm
cars: VE SS Ute
Location: WA
Contact:

Re: Open source GM OBD2 flash tool using a ELM327 device

Post by Tazzi »

J2534 is also running at 1x. Will look at 4x tomorrow.
It locks up the UI completely though... so.. thats pretty painful.

Ants on the ball though with dev time. Reliable hardware/firmware is the limiting factor.

I know cost is always a big thing for everyone, but reliability is always more important. No point having something that costs $10 and is as reliable as a wet cardboard box.
Plus, spending that little bit more.. provides a tool that will last longer.

Thinking about it... most of these scantool options cost less than licensing a single PCM using commercial tuning softwares.
Your Local Aussie Reverse Engineer
Contact for Software/Hardware development and Reverse Engineering
Site:https://www.envyouscustoms.com
Mob:+61406 140 726
Image
User avatar
oldn64
Posts: 256
Joined: Mon May 28, 2018 5:05 pm
cars: Vq Statesman, VE SS wagon, VE Sv6, VY SV8, VL Belina
Location: Country Victoria on a direct road to WINTON

Re: Open source GM OBD2 flash tool using a ELM327 device

Post by oldn64 »

I am gathering all coding is mostly done in Visual studio here?

Have many people used monoDev? Last time I used it (many moon and Noah was running around in a nappy) it was very good with C# and was cross platform compatible) This meant that with a little effort and using the right coding tech you could compile a version of your code that would run on windows, linux, mac and even iphone and android for the most part. Obviously there are window draw requirements for each but this generally is handled by the API's of each OS.

Woudl love to get back into this stuff but I fear I have forgotten more than I can remember.

cheers
oldn64
User avatar
antus
Site Admin
Posts: 8250
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: Open source GM OBD2 flash tool using a ELM327 device

Post by antus »

Yes, this project is C#, my other projects are C# too. I think Tazzi often uses VB. I have used mono ages ago to run windows stuff on linux. I was able to install .net runtimes and get previous attempts running but was not able to hook in to the linux serial api. Perhaps things have improved? You should give it a shot. Patches welcome :)

The other issue will be hooking the J2534 native DLLs, but if you can make it run it might be possible to catch and warn if those DLLs cant be loaded and continue with serial device support anyway.
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
oldn64
Posts: 256
Joined: Mon May 28, 2018 5:05 pm
cars: Vq Statesman, VE SS wagon, VE Sv6, VY SV8, VL Belina
Location: Country Victoria on a direct road to WINTON

Re: Open source GM OBD2 flash tool using a ELM327 device

Post by oldn64 »

Antus,

I need to get me head around this stuff again. it has been 8 years since I touched a delco and the like and all my coding was on my laptop which got stolen (including both the VDO toolset and the AAPL toolset for dash comms) I cannot remember any of the coding streams and will take a little for me to get within the swing of things again.

It is like a mechanic who never services his car.... an IT person whom never does a backup yet tells his clients to do so.... :comp:

coming back to Aus and not being able to do this stuff again is killing me. But it just might be the push I need to look at the newer tech as well as the old again and get things happening for me. Even my bluetooth adapters and cables for ODB2 were with the laptop. :evil:

cheers
oldn64
User avatar
Tazzi
Posts: 3425
Joined: Thu May 17, 2012 8:53 pm
cars: VE SS Ute
Location: WA
Contact:

Re: Open source GM OBD2 flash tool using a ELM327 device

Post by Tazzi »

Yeah, Im flick between VB and C#. People think Im mad for not just sticking to one. I prefer being fluent with both, makes it easier to work on other peoples projects when needed.

Just got J2534 at 4x up and running, nice and quick with the MDI, bit slower with a nano but still works flawless.
AVT is hammering along with a couple little fixes too.

I think next on the hit list is the AllPro.
Your Local Aussie Reverse Engineer
Contact for Software/Hardware development and Reverse Engineering
Site:https://www.envyouscustoms.com
Mob:+61406 140 726
Image
User avatar
antus
Site Admin
Posts: 8250
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: Open source GM OBD2 flash tool using a ELM327 device

Post by antus »

allpro read at 4x completed!

Not as fast as i'd hoped though. In the same ballpark as vx-nano. I think the speed is lost transferring the packets to the PC over serial at 115200 baud and an extra factor of 2 for the ELM protocol (1 byte = 2 ascii characters).

It turned out the allpro timeout settings are not working correctly, and also its adaptive timing is shortening the timeout which then breaks this type of work. I'll need to submit another patch to fix both those issues back to the allpro project.

Then there was an issue where my flash kernel was responding "packet request accepted" then immediately after with the payload. There was no gap at all so the allpro was dropping the response while it was sending the accepted response to the pc. I needed to add a 50ms delay to the pcm 68k flash kernel. With those fixes in place, this magic happened (a successful read). Super happy with that! :comp: :thumbup:

Code: Select all

[12:58:54:400]  Elm ID: ELM327 v2.1
[12:58:54:403]  All Pro ID: Copyright (c) 2009-2018 ObdDiag.Net This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[12:58:54:435]  All Pro self test result: PWM wiring is OK VPW wiring is OK ISO9141/14230 wiring is OK CAN wiring is OK
[12:58:54:448]  All Pro firmware: 1.19+ antus@pcmhacking.net
[12:58:54:479]  Voltage: 13.5V
[12:59:08:475]  VIN: 6H8VTK69FXL478757
[12:59:08:841]  OS ID: 12593358
[12:59:09:188]  Calibration ID: 92088937
[12:59:09:538]  Hardware ID: 16220610
[12:59:10:607]  Serial Number: 2DG0H0L69169
[12:59:10:971]  Broad Cast Code: CRUM
[12:59:11:320]  MEC: 0
[12:59:21:079]  Querying operating system of current PCM.
[12:59:21:434]  OSID: 12593358
[12:59:22:133]  Unlock succeeded.
[12:59:22:138]  Attempting switch to VPW 4x
[12:59:22:500]  PCM is allowing a switch to VPW 4x. Requesting all VPW modules to do so.
[12:59:24:727]  kernel uploaded to PCM succesfully
[12:59:25:857]  Recieved block starting at 0 / 0x0. 0%
[12:59:27:336]  Recieved block starting at 2048 / 0x800. 0%
[12:59:28:372]  Recieved block starting at 4096 / 0x1000. 0%
[12:59:29:861]  Recieved block starting at 6144 / 0x1800. 1%
[12:59:30:892]  Recieved block starting at 8192 / 0x2000. 1%
[12:59:32:368]  Recieved block starting at 10240 / 0x2800. 1%
[12:59:33:425]  Recieved block starting at 12288 / 0x3000. 2%
[12:59:34:892]  Recieved block starting at 14336 / 0x3800. 2%
[12:59:35:950]  Recieved block starting at 16384 / 0x4000. 3%
[12:59:37:418]  Recieved block starting at 18432 / 0x4800. 3%
[12:59:38:473]  Recieved block starting at 20480 / 0x5000. 3%
[12:59:39:957]  Recieved block starting at 22528 / 0x5800. 4%
[12:59:41:008]  Recieved block starting at 24576 / 0x6000. 4%
[12:59:42:480]  Recieved block starting at 26624 / 0x6800. 5%
[12:59:43:543]  Recieved block starting at 28672 / 0x7000. 5%
[12:59:45:011]  Recieved block starting at 30720 / 0x7800. 5%
[12:59:46:084]  Recieved block starting at 32768 / 0x8000. 6%
[12:59:47:546]  Recieved block starting at 34816 / 0x8800. 6%
<snip>
[01:05:18:071]  Recieved block starting at 505856 / 0x7B800. 96%
[01:05:19:734]  Recieved block starting at 507904 / 0x7C000. 96%
[01:05:21:005]  Recieved block starting at 509952 / 0x7C800. 97%
[01:05:22:681]  Recieved block starting at 512000 / 0x7D000. 97%
[01:05:23:982]  Recieved block starting at 514048 / 0x7D800. 98%
[01:05:25:615]  Recieved block starting at 516096 / 0x7E000. 98%
[01:05:26:872]  Recieved block starting at 518144 / 0x7E800. 98%
[01:05:28:576]  Recieved block starting at 520192 / 0x7F000. 99%
[01:05:29:826]  Recieved block starting at 522240 / 0x7F800. 99%
[01:05:30:167]  Reverting to VPW 1x
[01:15:05:736]  Save canceled.
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
NSFW
Posts: 679
Joined: Fri Feb 02, 2018 3:13 pm

Re: Open source GM OBD2 flash tool using a ELM327 device

Post by NSFW »

Sweet!!!
Please don't PM me with technical questions - start a thread instead, and send me a link to it. That way I can answer in public, and help other people who have the same question. Thanks!
MudDuck514
Posts: 397
Joined: Wed Jul 05, 2017 8:30 am
cars: 2001 Pontiac Grand AM SE
LD9 2.4l I4, 4T40E
2005 Chevrolet Venture
LA1 3400 V6, 4T65E
Location: North TX, USA

Re: Open source GM OBD2 flash tool using a ELM327 device

Post by MudDuck514 »

Hi all,

This is Great News! :thumbup:

Even at the speeds that the Allpro is using it is WAY better than spending the money to buy the AVT cable for those of us that can't afford the price of admission.
Combined with the .XDF's that have been added, this is coming together real well. Thanks Pete and whoever else is responsible for creating them!
Once the firmware bugs are sorted and shipping, I will see about buying the Allpro Kit board - I already have the cable from a USELESS ELM box I purchased off eBay - and an FTDI-chipped USB interface so all I need to go with it would be a Bluetooth module (what has been used by others on here?) and an enclosure.

I am guessing that when the time comes to move on to the next PCM the Hardware will be able to support it?
i.e. Blackbox PCM using J1850VPW, and the newer PCM's using CANBUS.

Mike
Locked