CRC on FSCI packets

cancel
Showing results for 
Search instead for 
Did you mean: 

CRC on FSCI packets

No ratings

CRC on FSCI packets

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.
    Ruta de FSCI.PNG
  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.
    Comentar.PNG
  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.PNG

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

response.png

Tags (3)
Version history
Revision #:
1 of 1
Last update:
‎08-24-2018 09:22 AM
Updated by: