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.

TMAG5170-Q1: CRC calculation for the Rx data from the sensor

Part Number: TMAG5170-Q1
Other Parts Discussed in Thread: TMAG5170

Hello Team, 

I would like to understand, how does the TMAG5170 calculates the CRC value while sending the X/Y/Z raw count results over SPI. 

While verifying one of the results below is seen

1. The received data including CRC is 0x6080 00A9

2. When calculated with 0x608000A0, the CRC obtained is (b0100) calculated using code posted earlier on TI e2e for Tx data. 

This does not match with the CRC received. Please suggest how the CRC should be validated for the Rx data. 

3. The CRC is enabled, and there is no error observed for the Calculated CRC for the Tx data.

Thank you,

Aditya

  • Hello Aditya,

    Thanks for considering to use Texas Instruments. When I calculate the CRC for 0x608000A0, I get b1001.  You might have an error in your calculation.  Maybe you can test whether your CRC data matches the calculations in the attached excel sheet.  Hex inputs are in row 2 and the CRC bits are in column AN.  The excel document uses the formulas found in section 7.5.2.5 of the datasheet.

    TMAG5170-CRC-Calculation.xlsx

  • Hi Patrick,

    Thank you for sharing the calculation.

    To verify the Rx CRC, we were attempting to calculate the CRC on the complete value 0x608000A9, and expecting a CRC value of 0 to be calculated, however that's not the case. The CRC calculation returns 1.



    Also when I try to calculate the CRC for disabling the CRC command, a different value is returned than mentioned in data sheet

    i.e for 0x0F000400 expected CRC is 7, but result obtained is 0x06;


    Please let me know if these interpretations are correct. Also let me know if  I have missed anything during the calculation.

    Also for verifying the crc received from the sensor, which approach would be suggested,

    - calculate the CRC for the whole data (including CRC value and look for a 0)

    - Calculate the CRC for 28 bit data and  compare the CRC. Point to consider is both CRC and data are transmitted.

    Thank you

    Aditya

  • Hello Aditya,

    Looks like I made a mistake in my calculations.  Cell C4 was not properly referencing C3 and updating.  Below is the updated version.  You should calculate with the 28 MSB bits and assume bits 0 through 3 are 0.

    3683.TMAG5170-CRC-Calculation.xlsx