PCM Hammer P01 and P59 flash tool v015

They go by many names, P01, P59, VPW, '0411 etc. Also covering E38 and newer here.
User avatar
NSFW
Posts: 679
Joined: Fri Feb 02, 2018 3:13 pm

Re: PCM Hammer - new ls1 flash tool

Post by NSFW »

Gampy wrote:Whoops, it's a new case with the last round of commits.
I don't understand what you're trying to say in that message.
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!
User avatar
NSFW
Posts: 679
Joined: Fri Feb 02, 2018 3:13 pm

Re: PCM Hammer - new ls1 flash tool

Post by NSFW »

Regarding the AllPro and 4x, I've found that it only works on my bench when I have an OBD2 Y-cable that has another device plugged into it. It doesn't seem to matter what the other device is - Scantool LX, Xpro prototype, second AllPro, whatever. I've never had an issue in the car tough.
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!
User avatar
Gampy
Posts: 2333
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Hammer - new ls1 flash tool

Post by Gampy »

NSFW wrote:I don't understand what you're trying to say in that message.
block versus Block ...

Little 'b' versus capital 'B'.

A Case mismatch!

Code: Select all

        /// <summary>
        /// Calculate the checksum for a given block of VPW data.
        /// </summary>
-        public static UInt16 CalcBlockChecksum(byte[] block)
+        public static UInt16 CalcBlockChecksum(byte[] Block)
        {
            UInt16 Sum = 0;

            for (int i = 4; i < Block.Length - 2; i++) // start after prio, dest, src, mode, stop at end of payload
            {
-                Sum += block[i];
+                Sum += Block[i];
            }

            return Sum;
        }
Last edited by Gampy on Sat Feb 22, 2020 5:14 pm, edited 1 time in total.
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
User avatar
Gampy
Posts: 2333
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Hammer - new ls1 flash tool

Post by Gampy »

Also had this happen upon a cancel ...
[06:09:50:610] Kernel upload 100% complete.
[06:09:50:737] Cancel button clicked.
[06:09:53:107] Kernel Version: 010301BB
[06:09:53:128] Kernel uploaded to PCM succesfully.
[06:09:53:218] PCM and image file are both operating system 12587603
[06:09:53:266] Unable to determine which flash chip is in this PCM
[06:09:53:284] Unsupported flash chip ID 00000000. Manufacturer: Unknown
The flash memory in this PCM is not supported by this version of PCM Hammer.
Please look for a thread about this at pcmhacking.net, or create one if necessary.
We do aim to add support for all flash chips eventually.
[06:09:53:305] Something went wrong. Error in the application.
[06:09:53:321] Do not power off the PCM! Do not exit this program!
[06:09:53:337] Try flashing again. If errors continue, seek help online.
[06:09:53:353] viewtopic.php?f=42&t=6080
[06:09:53:368]
[06:09:53:415] System.ApplicationException: Error in the application.
at PcmHacking.FlashChip.Create(UInt32 chipId, ILogger logger)
at PcmHacking.CKernelWriter.<Write>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at PcmHacking.CKernelWriter.<Write>d__5.MoveNext()
[06:09:53:436] Elapsed time 00:00:11.8349609
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
User avatar
NSFW
Posts: 679
Joined: Fri Feb 02, 2018 3:13 pm

Re: PCM Hammer - new ls1 flash tool

Post by NSFW »

I fixed the casing error, thanks.

It looks like you clicked cancel as it was querying the flash chip ID, and that led to the app thinking you have an unsupported flash chip, and the app doesn't handle that well. I opened this: https://github.com/LegacyNsfw/PcmHacks/issues/141
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!
User avatar
Gampy
Posts: 2333
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Hammer - new ls1 flash tool

Post by Gampy »

Thank you ...

Could we also do AddBlockChecksum(byte[] Block) to match ...
[edit] And Sum as well ...

Code: Select all

        /// <summary>
        /// Write a 16 bit sum at the end of a block.
        /// </summary>
        /// <remarks>
        /// Overwrites the last 2 bytes at the end of the array with the sum
        /// </remarks>
        public static byte[] AddBlockChecksum(byte[] Block)
        {
            UInt16 Sum = 0;

            for (int i = 4; i < Block.Length - 2; i++) // skip prio, dest, src, mode
            {
                Sum += Block[i];
            }

            Block[Block.Length - 2] = unchecked((byte)(Sum >> 8));
            Block[Block.Length - 1] = unchecked((byte)(Sum & 0xFF));

            return Block;
        }
    }
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
jlvaldez
Posts: 155
Joined: Mon Feb 11, 2019 12:48 pm
cars: '01 - Corvette Z06
'20 - Sierra Denali
'03 - Volvo S80 T6
'16 - Accord V6
Location: DFW, Texas

Re: PCM Hammer - new ls1 flash tool

Post by jlvaldez »

Looking promising :)

A question, since you had to pull in some packet ignoring code for me to be able to perform a full read on my P59 in car, does this same code exist for a write? I lack the bench flashing hardware (but can build it if needed, just don't want to pull the PCM if I don't have to), and want to try to do a full flash in car. I know it might get borked, which is fine. I have other vehicles and can live without it for a few weeks if it came to it lol
User avatar
Tazzi
Posts: 3428
Joined: Thu May 17, 2012 8:53 pm
cars: VE SS Ute
Location: WA
Contact:

Re: PCM Hammer - new ls1 flash tool

Post by Tazzi »

jlvaldez wrote:Looking promising :)

A question, since you had to pull in some packet ignoring code for me to be able to perform a full read on my P59 in car, does this same code exist for a write? I lack the bench flashing hardware (but can build it if needed, just don't want to pull the PCM if I don't have to), and want to try to do a full flash in car. I know it might get borked, which is fine. I have other vehicles and can live without it for a few weeks if it came to it lol
There shouldnt be an issue with other modules communicating as comms from other modules should be disabled when beginning the flash.
Your Local Aussie Reverse Engineer
Contact for Software/Hardware development and Reverse Engineering
Site:https://www.envyouscustoms.com
Mob:+61406 140 726
Image
160plus
Posts: 90
Joined: Thu Sep 21, 2017 3:00 pm

Re: PCM Hammer - new ls1 flash tool

Post by 160plus »

jlvaldez wrote:Looking promising :)

A question, since you had to pull in some packet ignoring code for me to be able to perform a full read on my P59 in car, does this same code exist for a write? I lack the bench flashing hardware (but can build it if needed, just don't want to pull the PCM if I don't have to), and want to try to do a full flash in car. I know it might get borked, which is fine. I have other vehicles and can live without it for a few weeks if it came to it lol
With any program/tool that's working in 1x it's not uncommon for other modules to end up sending rouge messages that interfere with reading and writing, in 1x it can be very hard to deal with depending on the tool and a royal pain to deal with when it happens in 4x. However it's far less common to see when in 4x. I mean....it "shouldn't" happen...ever.... but the fact is it does and far too often it seems.

I have discussed this issue with a number of professional tuners and even managed to get direct access to a couple of vehicles that had a module that just wouldn't stay quit no matter what was done. Based on the vehicles I was able to work with the issue lies with other modules in the vehicle that seem to have degraded over time internally.....assuming it doesn't have an aftermarket radio with a converter tied into the data bus. The converters are prone to this type off issue but that's not an OEM part that's on the fritz.

When a flash is started the data bus is commanded to be quite and the software flashing takes over by sending a tester present message to keep the bus quite. In other words modules will only respond when they are spoken to. In the case of these rogue modules they end up doing 1 of 2 things. Either the module will go to sleep and stay asleep for a random amount of time and then just come back on line when it shouldn't have OR the module is commanded to go to sleep, sends the message back it's acknowledged the command but never actually stops talking over the bus. In either case the reason it's less common to see this type of issue in 4x is that very few of the modules are capable of talking on the bus at 4x speeds....they can only read messages in 4x so even though the module isn't working correctly it's unable to interfere with the flash.

Now I'm going to assume you are bringing up this issue using an OBDLink or Allpro. Both tools share the same fault here and that's when there is a module that's talking on the bus when it shouldn't be and the rogue modules chatter is picked up in place of the expected reply from the PCM. In some cases the tools port will stay open long enough after picking up the wrong message that it can be worked around.....but in other cases the tools port will close after reading the message from the rouge module and will completely miss the reply from the PCM. If this happens while reading the PCM another block request can be sent and not create a big deal. However if that happens while writing.....it likely won't end well.

Tuner Cats has a section in their FAQ about the issues above and the recommendation is to pull fuses for every module other then the PCM before you start to eliminate any possible issue from modules that just won't do as they are told. I can confirm that their suggested method does work and is about the only way to make sure there are no issue short of using a bench harness.
User avatar
Gampy
Posts: 2333
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Hammer - new ls1 flash tool

Post by Gampy »

2>CSC : error CS2001: Source file '...PcmHacks\Apps\PcmLibraryWindowsForms\Ports\HttpPort.cs' could not be found.
2>CSC : error CS2001: Source file '...PcmHacks\Apps\PcmLibraryWindowsForms\Ports\StandardPort.cs' could not be found.
The commit,
Show friendly port names in the device-picker dialog box.
creates a "ports" directory for PortDiscovery.cs, there is already a "Ports" directory, thus the failure.

[edit]
Move PortDiscovery.cs to Ports/
Delete ports/
Build
Open PcmHammer
Select: Select Device
Results in,
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Management.ManagementException: Not found
at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.PropertyData.RefreshPropertyInfo()
at System.Management.PropertyDataCollection.get_Item(String propertyName)
at System.Management.ManagementBaseObject.GetPropertyValue(String propertyName)
at PcmHacking.SerialPortInfo..ctor(ManagementObject property) in T:\Automotive\PcmHacks\PcmHacks\Apps\PcmLibraryWindowsForms\Ports\PortDiscovery.cs:line 95
at PcmHacking.PortDiscovery.GetPorts() in T:\Automotive\PcmHacks\PcmHacks\Apps\PcmLibraryWindowsForms\Ports\PortDiscovery.cs:line 26
at PcmHacking.DevicePicker.FillPortList() in T:\Automotive\PcmHacks\PcmHacks\Apps\PcmLibraryWindowsForms\DialogBoxes\DevicePicker.cs:line 113
at PcmHacking.DevicePicker.DevicePicker_Load(Object sender, EventArgs e) in T:\Automotive\PcmHacks\PcmHacks\Apps\PcmLibraryWindowsForms\DialogBoxes\DevicePicker.cs:line 65
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.7.3324.0 built by: NET472REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
PcmHammer
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///T:/Automotive/PcmHacks/PcmHacks/Apps/PcmHammer/bin/Debug/PcmHammer.exe
----------------------------------------
PcmLibraryWindowsForms
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///T:/Automotive/PcmHacks/PcmHacks/Apps/PcmHammer/bin/Debug/PcmLibraryWindowsForms.DLL
----------------------------------------
PcmLibrary
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///T:/Automotive/PcmHacks/PcmHacks/Apps/PcmHammer/bin/Debug/PcmLibrary.DLL
----------------------------------------
netstandard
Assembly Version: 2.0.0.0
Win32 Version: 4.6.26011.1
CodeBase: file:///T:/Automotive/PcmHacks/PcmHacks/Apps/PcmHammer/bin/Debug/netstandard.DLL
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.7.3324.0 built by: NET472REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.7.3353.0 built by: NET472REL1LAST_B
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.7.3221.0 built by: NET472REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.7.3324.0 built by: NET472REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.7.3324.0 built by: NET472REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.7.3221.0 built by: NET472REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Net.Http
Assembly Version: 4.2.0.0
Win32 Version: 4.6.26011.01
CodeBase: file:///T:/Automotive/PcmHacks/PcmHacks/Apps/PcmHammer/bin/Debug/System.Net.Http.DLL
----------------------------------------
System.Management
Assembly Version: 4.0.0.0
Win32 Version: 4.7.3221.0 built by: NET472REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Management/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Management.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
[edit]
Commenting out the following resolves the above exception ... It then works, I like it, nice touch.

Code: Select all

            //this.PNPClass = property.GetPropertyValue("PNPClass") as string ?? string.Empty;
            //this.PNPDeviceID = property.GetPropertyValue("PNPDeviceID") as string ?? string.Empty;
            this.PowerManagementCapabilities = property.GetPropertyValue("PowerManagementCapabilities") as int[] ?? new int[] { };
            this.PowerManagementSupported = property.GetPropertyValue("PowerManagementSupported") as bool? ?? false;
            //this.Present = property.GetPropertyValue("Present") as bool? ?? false;
Win7 Pro ...

[edit]
Select: Select Device
..Select your serial port
Select: OK
..Device Selection closes.
Select: Select Device

The Serial Port drop down fails to remember the port ...
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
Post Reply