This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AWR1243BOOST: AWR1243, CRC calculation

Part Number: AWR1243BOOST
Other Parts Discussed in Thread: AWR1243, MMWAVE-DFP

Hello,

According to the AWR1xx_Radar_Interface_Control.pdf (mmwave_dfp_01_00_00_01) I try to calculate CRC of ENVELOPE to use AWR1243BOOST with external SPI controller. But I cant find suitable algorythm to calculate CRC of entire message.

I have AWR1243 and DCA1000EMV. Together with mmwave_studio evrything works fine. I am able to controll radar and recieve data from radar. 

But my task is to use external SPI controller to configure AWR1243. So I need to form data sequence and send it through SPI interface.

AWR1xx_Radar_Interface_Control.pdf describre the data sequence. I have an SPI Interface analyzer and the data I see on MISO,MOSI,CS,CLK when using mmwave_studio is correct.

I understand how to fill evry field of message except CRC.(page xxv of AWR1xx_Radar_Interface_Control.pdf - Radar Message Structure)

Help me please to calculate CRC.

I Have an example: Frame start message. AWR_RF_FRAME_TRIG_MSG

Message that I see is:

 0x12 SYNC
 0x34  
 0x43  
 0x21  
 0x02 OPCODE
 0x81  
 0x00 LENGTH DIRECTION =0b0001  MSGTYPE=0b00 MSGID = 0x0A (AWR_RF_FRAME_TRIG_MSG)
 0x16  
 0x90 FLAGS SEQNUM = 0b1001 CRCLEN = 0b00 (16-bit CRC) CRCREQ = 0b00 (CRC is appended to the message)
 0x00  
 0x00 REMCHUNKS
 0x00  
 0x00 NSBC
 0x01  
 0x6D CHKSUM ~(0x0281+0x0016+0x9000 +0x0000+0x0001)=0x6D67
 0x67  
 0x01 SBLKID
 0x40  
 0x00 SBLKLEN
 0x08  
 0x00 SBLKDATA, START_STOP_CMD
 0x01  
 0x00 SBLKDATA, RESERVED
 0x00  
 0x2A CRC
 0xA5  

How to get this CRC ?

Interface_Control documet contains that CRC is 16-bit CRC-CCITT and has Polynomial  x16 + x12 + x5 + 1. 

But Im not able to obtain this (0x2A 0xA5) CRC.

I see that CRC-CCITT may be different kinds. With different initial valuses and so on. Help me to understand how do I need to calculate CRC exactly to match requaired CRC. Maybe you have some examples.

Looking forward for your answer.

  • Hello Andrew,
    You can find crc_compute.c file in mmWave-DFP package which is being used by mmwavelink_example application to compute the CRC for message data communicated with AWR1243 device.

    This application will provide you good reference to start with development.

    Regards,
    Jitendra
  • Thank you very much! I will check the solution and notify you .
  • Something is wrong. Correct me please.
    I use data:

    uint8 data[20]= {0x02, 0x81, 0x00, 0x16, 0x90, 0x00, 0x00, 0x00, 0x00, 0x01, 0x6D, 0x67, 0x01, 0x40, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00};
    as it is descdibed above.

    I call function computeCRC with this arguments:

    computeCRC(&data[0], 20, 16)

    And I get result:

    0x7BF7

    But it should be 0x2AA5 as I see in data.

  • As I have mentioned mmWave-DFP contains mmWavelink_example project (visual studio).
    I would request you to once run this project and put a breakpoint around this function call and check for CRC calculation.

    As this example provided here communicate with AWR1243 with CRC data appended on. It generates CRC field while sending and recieving message to/from AWR1243 which does match what device generates.


    Regards,
    Jitendra
  • There was C code ina post above from mmWave-DFP.

    But now I see that bytes in 16bit words of message must be swapped. And CRC is computed in different order than it follows in SPI data line.
    Thus,
    The byte order in message(described above):
    uint8 data[20]= {0x02, 0x81, 0x00, 0x16, 0x90, 0x00, 0x00, 0x00, 0x00, 0x01, 0x6D, 0x67, 0x01, 0x40, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00};

    The byte order for CRC compute:
    uint8 data[20]= {0x81, 0x02, 0x16, 0x00, 0x00, 0x90, 0x00, 0x00, 0x01, 0x00, 0x66, 0x6D, 0x04, 0x01, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00};

    Thank you.
  • It was a bit unclear, because in example for header check sum bytes are added in stright order. Hope you will add more examples to AWR1xx_Radar_Interface_Control document.