Mar-17-2020, 04:51 PM
Good afternoon,
Looking for a little help if possible.
I've done some coding in python but not a massive amount.
In this case I've never done anything with checksums - especially CRC16 - CCITT.
I have a project car and I'm looking to make some mods such as heated seats. power fold mirrors etc. This part is easy enough, read the microcontroller EEPROM, change the byte options from 0x00 to 0x01 however I need to find and recalculate the CRC16-CCITT.(there are many within the binary file)
The CRC16-CCITT's could be anywhere in the file but are straight after the variable length data.
Basically I'm looking to have python script that will read the file byte by byte increasing the data one byte at a time, calculate the checksum and compare it with the next two bytes in the file. When the calculated checksum matches the next two bytes I want to ouput the start address of data, end address of data, checksum location and the actual checksum. Of course it needs to do this repeatedly until the end of file is reached.
When I know these parameters I will be able to mod the data and just recalculate the checksum. change it and reflash the eeprom.
In fairness I know how to read and write files etc in python but I need some pointers on CRC16-CCITT 0xFFFF checksums and how to implement them.
Will the processing overheads be too long and too slow?
To give a quick idea I have copied and pasted some of the data below:
80 07 24 06 FF 00 00 00 FF FF FF FF FF FF FF FF AC DC FF 03 88 DC FF 03 60 DC FF 03 20 56 06 01
7F 00 64 07 7D 82 64 07 81 82 64 07 99 82 7F 00 80 57 04 00 20 36 34 B0 46 36 FF 03 A6 51 7F 00
40 56 00 04 2A 56 94 B0 40 5E 00 04 2B 5E 9C B0 C5 1D 40 56 00 04 2A 56 9C B0 40 5E 00 04 2B 5E
4A B1 B5 15 40 56 00 04 2A 56 4C B1 40 5E 00 04 2B 5E F6 B2 A5 0D 40 56 00 04 2A 56 F8 B2 40 5E
00 04 2B 5E 24 B6 95 05 66 57 01 00 AA 59 67 5F 01 00 7F 00 00 00 00 00 80 07 06 00 7F 00 5C 1A
63 0F 01 00 A0 07 21 00 63 37 3D 00 63 3F 39 00 63 47 35 00 63 4F 31 00 63 57 2D 00 63 5F 29 00
63 67 25 00 63 6F 21 00 63 77 1D 00 63 7F 19 00 63 87 15 00 63 8F 11 00 63 97 0D 00 63 9F 09 00
F0 0F 40 00 63 0F 05 00 F1 0F 40 00 63 0F 01 00 BF FF AC FF 23 0F 01 00 E1 8F 20 00 23 0F 05 00
E1 87 20 00 23 9F 09 00 23 97 0D 00 23 8F 11 00 23 87 15 00 23 7F 19 00 23 77 1D 00 23 6F 21 00
23 67 25 00 23 5F 29 00 23 57 2D 00 23 4F 31 00 23 47 35 00 23 3F 39 00 23 37 3D 00 60 06 20 00
23 0F 01 00 44 1A E0 07 40 01 56 94 86 00 20 5E 32 00 20 56 20 00 40 37 .....data continues>>>
As you can see in the data above, the checksum (in bold) could be anywhere due to the data length(unknown). After the checksum the next data block starts followed by the next checksum.
My main task is to find these checksums within the data and log their locations.
Hope you guys can point me in the right direction.
Thanks in advance.
Mike
Looking for a little help if possible.
I've done some coding in python but not a massive amount.
In this case I've never done anything with checksums - especially CRC16 - CCITT.
I have a project car and I'm looking to make some mods such as heated seats. power fold mirrors etc. This part is easy enough, read the microcontroller EEPROM, change the byte options from 0x00 to 0x01 however I need to find and recalculate the CRC16-CCITT.(there are many within the binary file)
The CRC16-CCITT's could be anywhere in the file but are straight after the variable length data.
Basically I'm looking to have python script that will read the file byte by byte increasing the data one byte at a time, calculate the checksum and compare it with the next two bytes in the file. When the calculated checksum matches the next two bytes I want to ouput the start address of data, end address of data, checksum location and the actual checksum. Of course it needs to do this repeatedly until the end of file is reached.
When I know these parameters I will be able to mod the data and just recalculate the checksum. change it and reflash the eeprom.
In fairness I know how to read and write files etc in python but I need some pointers on CRC16-CCITT 0xFFFF checksums and how to implement them.
Will the processing overheads be too long and too slow?
To give a quick idea I have copied and pasted some of the data below:
80 07 24 06 FF 00 00 00 FF FF FF FF FF FF FF FF AC DC FF 03 88 DC FF 03 60 DC FF 03 20 56 06 01
7F 00 64 07 7D 82 64 07 81 82 64 07 99 82 7F 00 80 57 04 00 20 36 34 B0 46 36 FF 03 A6 51 7F 00
40 56 00 04 2A 56 94 B0 40 5E 00 04 2B 5E 9C B0 C5 1D 40 56 00 04 2A 56 9C B0 40 5E 00 04 2B 5E
4A B1 B5 15 40 56 00 04 2A 56 4C B1 40 5E 00 04 2B 5E F6 B2 A5 0D 40 56 00 04 2A 56 F8 B2 40 5E
00 04 2B 5E 24 B6 95 05 66 57 01 00 AA 59 67 5F 01 00 7F 00 00 00 00 00 80 07 06 00 7F 00 5C 1A
63 0F 01 00 A0 07 21 00 63 37 3D 00 63 3F 39 00 63 47 35 00 63 4F 31 00 63 57 2D 00 63 5F 29 00
63 67 25 00 63 6F 21 00 63 77 1D 00 63 7F 19 00 63 87 15 00 63 8F 11 00 63 97 0D 00 63 9F 09 00
F0 0F 40 00 63 0F 05 00 F1 0F 40 00 63 0F 01 00 BF FF AC FF 23 0F 01 00 E1 8F 20 00 23 0F 05 00
E1 87 20 00 23 9F 09 00 23 97 0D 00 23 8F 11 00 23 87 15 00 23 7F 19 00 23 77 1D 00 23 6F 21 00
23 67 25 00 23 5F 29 00 23 57 2D 00 23 4F 31 00 23 47 35 00 23 3F 39 00 23 37 3D 00 60 06 20 00
23 0F 01 00 44 1A E0 07 40 01 56 94 86 00 20 5E 32 00 20 56 20 00 40 37 .....data continues>>>
As you can see in the data above, the checksum (in bold) could be anywhere due to the data length(unknown). After the checksum the next data block starts followed by the next checksum.
My main task is to find these checksums within the data and log their locations.
Hope you guys can point me in the right direction.
Thanks in advance.
Mike