Can you give me the specifics on the algorithm for UCRCCalculation using the 0x1021 poly.
- Initial CRC value?
- Final XOR value?
- Input reflected?
- Result reflected?
Thanks!
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.
Can you give me the specifics on the algorithm for UCRCCalculation using the 0x1021 poly.
Thanks!
Algorithm for using uCRC is described in the TRM. Is the customer looking for more than this ?
• Save the current value of the CRC result register (uCRCRES) into the stack to allow calculation of
CRC in nested interrupt.
• Clear the CRC result register (uCRCRES) by setting the CLEAR field of the uCRCCONTROL register
to ‘1’.
• Configure uCRC polynomials (CRC8, CRC16-P1, CRC16-P2 or CRC32) in the uCRCCONFIG register.
• Read the data from memory locations for which CRC needs to be calculated using mirrored address.
• Read the μCRCRES register to get the calculated CRC value. Pop the last save value of the CRC from
stack and store it into the CRC result register (uCRCRES).
Looking at the questions
Initial CRC value?
>> Cleared on writing 1 to μCRCCONTROL. CLEAR. Could be initialized to a new value by directly writing to μCRCRES register.
Final XOR value?
>> We do not have a provision to add a final “XOR value” in hardware.
Input reflected?
>> I think the question here is whether the bits are reversed, and the answer is that CRC calculation is performed MSB first and LSB last. Note that uCRC will be updated only on byte wide reads.
Result reflected?
>> Result is not reflected (Bit reversed).