All FSCI packets contain a checksum field to verify data integrity. Every time a FSCI packet is created (by the Host or a Kinetis device) a new CRC is calculated based on every data byte in the FSCI frame.
Compute CRC for TX packet
The CRC field is calculated by XORing each byte contained in the FSCI command (opcode group, opcode, payload length and payload data). Checksum field then, accumulates the result of every XOR instruction.
In the firmware, the CRC is calculated in the 'FSCI_transmitPayload()' function wich is located in '<HSDK project>/framework/FSCI/Source/FsciCommunication.c' file. See FSCI_computeChecksum().
Example:
TX: AspSetXtalTrim.Request 02 95 0A 01 30 AE
Sync [1 byte] = 02
OpGroup [1 byte] = 95
OpCode [1 byte] = 0A
Length [1 byte] = 01
trimValue [1 byte] = 30
CRC [1 byte] = AE <------- (0x95) XOR (0A) XOR (0x01) XOR (0x30) = 0xAE
Disable CRC field validation
Every time a FSCI packet is received, the device verifies the checksum value.
The next changes will allow the board to receive FSCI packets without verifying the CRC field. However, the board will send the FSCI responses to the Host with this CRC field.
The FSCI message is sent without a CRC field and the board responses to the command successfully.