CRC on FSCI packets

Document created by Miguel Agustin Gonzalez Rivera Employee on Aug 24, 2018Last modified by Miguel Agustin Gonzalez Rivera Employee on Aug 24, 2018
Version 3Show Document
  • View in full screen mode

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.

  1. Go to 'FsciCommunication.c' file.
    FsciCommunication.c file location
  2. Search for 'fsci_packetStatus_t FSCI_checkPacket( clientPacket_t *pData, uint16_t bytes, uint8_t* pVIntf )' function.
  3. Comment all line codes related to checksum verifying. The image below shows what has to be commented.
    Disable CRC field commenting these lines.
  4. Compile project and load it to the board.
  5. Verify functionality with Test Tool. Select any command and check Raw Data checkbox. Delete the CRC data field and send the FSCI message pressing Send Raw. The loaded command set will vary depending on the demo you are using (Thread, ZigBee, BLE, etc.).

Test Tool CRC

The FSCI message is sent without a CRC field and the board responses to the command successfully.

Board response

3 people found this helpful

Attachments

    Outcomes