Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

FIT file CRC calculation in Section 3.3.2 of SDK

Rank

Total Posts: 7

Joined 2017-03-15

PM

I have trimmed some of the reports out of a FIT file and need to recalculate the CRC values in the Header and at the end of the file. Section 3.3.2 of SDK documentation provides code for doing this and I have found the java function CRC.get16(), which implements it. I've verified that I can obtain the Header CRC for a known good file. The SDK documentation states that the Header CRC is optional and can be set to 0x0000. However, if I take a known good file and set the Header CRC to zero (using a binary file editor) the conversion program FITToCSV.bat will no longer decode the file completely.
1) Is this because the Header bytes and Header CRC are included in the derivation of the CRC value at the end of the file?
     
RankRankRank

Total Posts: 67

Joined 0

PM

Yes, the header bytes are included in the CRC at the end of the file.

As a technical detail/property of the CRC16 calculation, the Header CRC just resets the CRC to the initial state because CRC16(x, x) == 0 regardless of the value of x.