Calculating checksums? Can't get OS to work

They go by many names, P01, P59, VPW, '0411 etc . Circa 1999 to 2006. All VPW OBD2 PCMs.
Posts: 20
Joined: Thu Jan 16, 2014 12:41 pm

Re: Calculating checksums? Can't get OS to work

Postby 04colyZQ8 » Fri Feb 19, 2021 11:11 am

jlvaldez wrote:Hey all, Gampy was helpful with information calculating the checksums for the various segments. I threw together a simple python script to generate and check the checksums of the various segments in a binary. Right now, I'm trying the P01/411 binary off my corvette, and I can get all segments to work correctly, except the OS.

From this thread that Gampy pointed me to: viewtopic.php?f=42&t=6198#p91839

Code: Select all
success &= this.ValidateRange(      0, 0x7FFFD,   0x500, "Operating system");
            success &= this.ValidateRange( 0x8002, 0x13FFF,  0x8000, "Engine calibration");
            success &= this.ValidateRange(0x14002, 0x16DFF, 0x14000, "Engine diagnostics.");
            success &= this.ValidateRange(0x16E02, 0x1BDFF, 0x16E00, "Transmission calibration");
            success &= this.ValidateRange(0x1BE02, 0x1C7FF, 0x1BE00, "Transmission diagnostics");
            success &= this.ValidateRange(0x1C802, 0x1E51F, 0x1C800, "Fuel system");
            success &= this.ValidateRange(0x1E522, 0x1EE9F, 0x1E520, "System");
            success &= this.ValidateRange(0x1EEA2, 0x1EF9F, 0x1EEA0, "Speedometer");

And Gampy pointed out that the correct OS segment information is:
0x000000 -> 0x0004FF
0x000502 -> 0x003FFF
0x020000 -> 0x07FFFF
Checksum is stored at 0x500

Yet for whatever reason, whenever I go through and add up these segments, I get invalid checksums, but the rest of the addresses in the code block work correctly (checksum + sum of 16-bit words = 0).

To be clear about how I'm doing this:
1) Sum each 16-bit word within each segment together.
2) Sum each of the sums from each segment
3) Bitwise and with 0xFFFF (truncate)

This strategy works for all segments except the OS, which leads me to believe an address range is wrong?

Code: Select all
Sum iteration: 0x0 0x4ff Size: 1280
Sum iteration: 0x502 0x3fff Size: 15102
Sum iteration: 0x20000 0x7ffff Size: 393216

I'm having trouble manually calculating some checksums on a BCM, I think its down similarly to the GM pcms. I can figure out the first 4 bits of a segment that's the sum 2s compliant, then byte swap. However the first crc16 checksum how is that calculated? what do you mean by "(checksum + sum of 16-bit words = 0)" ? I tired crc16 of the whole segment - the sum 16 bit of the segment, except the first 4 bits (second checksum), and that didn't equal zero? Please explain how to calculate the first checksum located at 8 from the start of the segment. Thanks -Jamie


Return to GM LS1 512Kbyte and 1Mbyte

Who is online

Users browsing this forum: Tazzi and 4 guests