PCM Logger XML

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 Logger XML

Post by NSFW »

I've been meaning to explain this. :) Some background information first... There are two ways to request a value from the PCM:

1) Request a value by parameter ID. The SAE defined a bunch of parameters, and I think GM extended the SAE's list. The convenient thing about this approach is that the parameter IDs are standard across all operating system. If you ask for parameter ID 0005 you will get engine coolant temp no matter which OS the PCM is running. Not all PCMs support all parameters, but there's a pretty long list of parameters that are supported by most operating systems. That's what's in Parameters.Standard.xml.

2) Request a value by RAM address. These addresses are unique per operating system - different operating systems mostly work with the same values, but they store them in different places in RAM. Since the addresses are unqiue per operating system, I figured we should have a separate file for each operating system. My Corvette was running 12593358 at the time, so I made Parameters.12593358.xml to describe the RAM addresses for that operating system. (I plan to switch to 7603 soon.)

When you start the logger, it checks your OS and looks for a file named Parameters.YOUR_OSID.xml. Then it populates the parameter list with the standard parameters and whatever was in Parameters.YOUR_OSID.xml (if it found one).

In many cases there are RAM values that correspond to the standard parameters, but with higher precision. For example the standard parameter might be one byte, but the RAM parameter might be 2 or 4 bytes.

In many cases, there are values in RAM that don't have any corresponding standard parameter. When I was working on the logger I was also tuning idle, so I found the RAM values for the proportional, integral, and derivative terms of the feedback loop that manages the throttle blade angle. I don't think there are standard parameter IDs for any of those.

With enough reverse engineering we should be able to find RAM parameters for everything anyone could want. It takes a lot of time to do that reverse engineering, so I encourage people to run the 2156, 6125, or 7603 operating systems. I'll be working on finding RAM parameters in 7603, and I'm guessing that we'll have volunteers to work on 2156 and/or 6125. For other operating systems, I think the odds of getting reverse engineered are much lower. (To be honest I'd kind of like to see the P01 standardize on either 6125, to reduce the number of operating system to be reverse engineered even futher, but I'm not sure that's practical. 6125 has flex-fuel, but I wonder if GM had to trade off anything interesting to make room for the flex-fuel code or data.)

And then there are the math parameters... This lets you log a value by doing math on two other values. For example you can calculate injector duty cycle by doing some math on RPM and pulse width, or you can get grams-per-cylinder by doing math on RPM and MAF.

Parameters.DidNotWork.xml is just me taking notes of stuff I tried. The software doesn't use it.

Parameters.SAE.xml is obsolete, I just deleted it a minute ago to avoid confusion.

I just added this to the wiki at GitHub: https://github.com/LegacyNsfw/PcmHacks/ ... -XML-Files
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: 2330
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Logger XML

Post by Gampy »

Now it makes sense ... Thank you!

-Enjoy
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
joukoy
Posts: 392
Joined: Tue Dec 17, 2019 3:27 am
cars: Pontiac Firebird 1978

Re: PCM Logger XML

Post by joukoy »

UniversalPatcher can find some RAM addresses.
Attachments
pid-ramaddress-2021-08-1.jpg
pid-ramaddress-2021-08-1.jpg (103.16 KiB) Viewed 2845 times
User avatar
NSFW
Posts: 679
Joined: Fri Feb 02, 2018 3:13 pm

Re: PCM Logger XML

Post by NSFW »

That's really cool, I could see that being very useful for reverse engineering. Could you export the PIDs, addresses, and names to a CSV file?
Then we could write scripts to import the CSV data into IDA or Ghidra.
The more RAM addresses you label in IDA and Ghidra, the easier it gets to figure out the code that uses those addresses.
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: 2330
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Logger XML

Post by Gampy »

NSFW wrote:That's really cool, I could see that being very useful for reverse engineering. Could you export the PIDs, addresses, and names to a CSV file?
Already does ... Well actually, it's a Semi-Colon separated value file.

-Enjoy
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 Logger XML

Post by NSFW »

Close enough. :)
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: 2330
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Logger XML

Post by Gampy »

Nowhere can I find where it loads Parameters.OsID.xml, and that has baffled me ...

I can only find where it's loading these three,
Parameters.Standard.xml
Parameters.MATH.xml
Parameters.RAM.xml

Parameters.RAM.xml is the important one here, it does what I believe were the intentions of Parameters.OsID.xml.

Looking at an entry from Parameters.RAM.xml, it has a Location element ...

Code: Select all

  <RamParameter
    id="RamThrottleCrackerAirflow"
    name="Throttle Cracker Airflow"
    description=""
    storageType="uint16"
    bitMapped="False">
    <Location os="12593358" address="0xFF97F0" />
    <Conversion units="g/s" expression="x/1024.0" format="0.00" />
  </RamParameter>
And the code that loads Parameters.RAM.xml has a Location loop ...

Code: Select all

                    foreach (XElement location in parameterElement.Elements("Location"))
                    {
                        string osidString = location.Attribute("os").Value;
                        uint osid = uint.Parse(osidString);

                        string addressString = location.Attribute("address").Value;
                        uint address = UnsignedHex.GetUnsignedHex(addressString);

                        addresses[osid] = address;
                    }
So, Each entry in Parameters.RAM.xml is capable of multiple Os's and corresponding Address.
Thus, this

Code: Select all

  <RamParameter
    id="RamThrottleCrackerAirflow"
    name="Throttle Cracker Airflow"
    description=""
    storageType="uint16"
    bitMapped="False">
    <Location os="12593358" address="0xFF97F0" />
    <Location os="12216125" address="0xXXXXXX" />
    <Conversion units="g/s" expression="x/1024.0" format="0.00" />
  </RamParameter>
is how an OS is added to a Parameter.RAM entry that already exists.

Obviously with a valid address, I personally don't know any addresses of RAM parameters.

One still has to hand edit the LogProfile to add the RAM Parameters, and guard it carefully, if your LogProfile is active and you add a parameter from the Parameters tab, it will wipe out your RAM Parameter entries ... So beware!

-Enjoy
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 Logger XML

Post by NSFW »

Whoops. You're right! The Parameters.OSID.xml file is left over from an earlier release.

And apparently I didn't finish switching from the file-per-OSID approach to the all-OSIDs-in-one approach. :(

I will work on that ASAP.
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: 2330
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Logger XML

Post by Gampy »

I like the all in one approach ...

Thank you
-Enjoy
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: 2330
Joined: Sat Dec 15, 2018 7:38 am

Re: PCM Logger XML

Post by Gampy »

Just to put this out there ...

Parameters.RAM.xml ... A bit more about it.

In this example we are going to create a fictitious Temperature Parameter in the PCM called RAMTemperature.
Each OS will have a different Address in RAM for this 'RAMTemperature' parameter as well as two different conversion factors, Fahrenheit and Celsius ...

The 'Location' element is used internally by PCMLogger, it's how PCMLogger knows where to look (ask) for the Value in each OS, it's pretty simple, it links an OsID to an Address ...

However, the 'Conversion' element is of interest ...

So, the Parameters.RAM entry for our fake RAMTemperature might look like,

Code: Select all

  <RamParameter
    id="RAMTemperature"
    name="RAM Temperature"
    description="RAM Temperature Sensor"
    storageType="uint8"
    bitMapped="False">
    <Location os="12212156" address="0x12345A" />
    <Location os="12216125" address="0x12345B" />
    <Location os="12587603" address="0x12345C" />
    <Conversion units="°C" expression="(x-40)" format="0.00" />
    <Conversion units="°F" expression="((x-40) * 1.8 + 32.0)" format="0.00" />
  </RamParameter>
Now, if you want the RAMTemperature in Fahrenheit in PCM Logger, you would use the 'units' attribute in the RamParameter element of the LogProfile like,

Code: Select all

    <RamParameters>
        <RamParameter id="RAMTemperature" units="°F" />
    </RamParameters>
Or if you wanted Celsius,

Code: Select all

    <RamParameters>
        <RamParameter id="RAMTemperature" units="°C" />
    </RamParameters>
If you desire to see them both :wtf:, go for it,

Code: Select all

    <RamParameters>
        <RamParameter id="RAMTemperature" units="°F" />
        <RamParameter id="RAMTemperature" units="°C" />
    </RamParameters>
How about adding Raw to it ...
Add our Conversion to the 'RAMTemperature' element in Parameters.RAM.xml

Code: Select all

  <RamParameter
    id="RAMTemperature"
    name="RAM Temperature"
    description="RAM Temperature Sensor"
    storageType="uint8"
    bitMapped="False">
    <Location os="12212156" address="0x12345A" />
    <Location os="12216125" address="0x12345B" />
    <Location os="12587603" address="0x12345C" />
    <Conversion units="Raw" expression="x" format="0.00" />
    <Conversion units="°C" expression="(x-40)" format="0.00" />
    <Conversion units="°F" expression="((x-40) * 1.8 + 32.0)" format="0.00" />
  </RamParameter>
Then add it to our LogProfile,

Code: Select all

    <RamParameters>
        <RamParameter id="RAMTemperature" units="Raw" />
        <RamParameter id="RAMTemperature" units="°F" />
        <RamParameter id="RAMTemperature" units="°C" />
    </RamParameters>
Hopefully this is useful to someone ...

-Enjoy
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