View previous topic :: View next topic |
Author |
Message |
ncubed
Joined: 27 May 2014 Posts: 1 Location: ישראל
|
CCS intel HEX CRC calculation |
Posted: Tue May 27, 2014 3:57 am |
|
|
Hi,
CCS PICC creates an Intel HEX file, with the last line containing a 16-bit CRC code.
Presumably, this is a CCITT-16 code of the file.
Does anyone know if all characters are passed through the CRC register or binary data translated from the HEX?
Any help would be appreciated.
Best regards
Noam |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue May 27, 2014 5:15 am |
|
|
The checksum is a simple sum of the bytes in Flash memory and the Configuration bytes, i.e. it is not a CRC.
In the past there have been troubles with this checksum changing between compiler versions. Because documentation on this topic is poor it is difficult to say which variation is wrong or bad. Perhaps you are better of to write your own checksum calculation routine, then at least you know what is tested and you control the algorithm changes.
Here is an old 2003 discussion on the topic with an algorithm by Darren Rook (a CCS guy) that should give you a head start.
http://www.ccsinfo.com/forum/viewtopic.php?t=17536
In a 2012 thread another algorithm was presented but I don't trust this one as it is a CRC16 algorithm and not a simple summation:http://www.ccsinfo.com/forum/viewtopic.php?p=163228 |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Tue May 27, 2014 10:43 am |
|
|
You could always read up on the Intel Hex format...
http://en.wikipedia.org/wiki/Intel_HEX
It's CLEARLY explained there... _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Wed May 28, 2014 2:00 am |
|
|
As I understand it, the TS is asking about the checksum in the last line of the hex file. This is a line in comments and not part of a standard Intel Hex file so reading up on the Intel Hex format will not help to explain this CCS generated checksum. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Wed May 28, 2014 8:48 am |
|
|
as I re-read the post -- and your comment -- I realized what he (and you) are talking about.
As already ID'd, that's NOT part of the Intel Hex format.
Sorry - my bad.... _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
|