CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

CCS intel HEX CRC calculation

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ncubed



Joined: 27 May 2014
Posts: 1
Location: ישראל

View user's profile Send private message AIM Address

CCS intel HEX CRC calculation
PostPosted: Tue May 27, 2014 3:57 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue May 27, 2014 5:15 am     Reply with quote

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: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Tue May 27, 2014 10:43 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed May 28, 2014 2:00 am     Reply with quote

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: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Wed May 28, 2014 8:48 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group