Hi everyone,
We are using MC9S12XF512 to build a FlexRay application. However, we cannot figure out how the Header CRC configured for each message buffer is calculated.
The official FlexRay does give an algorighm, but it looks like that the actual implementation in MC9S12XF512 is different. Because we tried to use that algorithm to calculate the Header CRC, but the result is different from the value given in the sample applications.
Any advice?
Thanks a lot.
Yu
The Flexray_CC.c module in the NVC7383 demo code has the header crc calc function in it.
Hi,
The FlexRay protocol specs document (can be obtained from www.flexray.com) contains the algorithm, for the header CRC remember to have the inital values as:
vCrcSize=11;
vCrcInit=[0 0 0 0 0 0 1 1 0 1 0];
vData=[1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0];
vCrcPolynomial=[0 1 1 1 0 0 0 0 1 0 1];
vData as you know is
1 bit 1 bit 11bits 7bits
[syncFrameBit,startUpFrameBit,frameID,payloadLength]
I found that the CRC result in the end was the other way around (LSB was on the left!)
Good luck!
Kassem
I found that the CRC result in the end was the other way around (LSB was on the left!)
That's because vData have LSB left, i.e. SY bit is LSB.