cancel
Showing results for 
Search instead for 
Did you mean: 

ARM SPI CRC Definition Polynomial Structure

B.Michele
Associate III
Posted on December 16, 2014 at 12:39

Good morning there is someone who has found the whole chart 

of the values, of the SPI_CRCPolynomial ??  like:

SPI_InitStructure.

SPI_CRCPolynomial

= 7;  

I have see 7 the most useful value, but who knows the other values and the meaning??

may be value from 1 to 8 ?? or over ??

Thank you

Best regards

5 REPLIES 5
ivani
Associate II
Posted on December 16, 2014 at 13:14

This field (and CRC register) defines the CRC polynomial in a binary form. You could see some standard CRC-8 polynomials from here (scroll to the table at the bottom):

http://en.wikipedia.org/wiki/Cyclic_redundancy_check

Value 7 corresponds to CRC-8-CCITT.
B.Michele
Associate III
Posted on December 16, 2014 at 15:19

Thank you, now is more clear!:  

do you know if there is a disable value in the SP1 STM32F100...STM32F101 family

 like:  hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLED;  of

the STMF4 micro     

I have SPI_InitStructure.SPI_CRCPolynomial = 7; 

0 isn't a valid value in the structure, i don't know i fthere is a disable value, when

i not use the CRC ???

Thank you

Posted on December 16, 2014 at 15:31

Well one might expect it to be an 8-bit value (and perhaps 16-bit if that width selected).

It's not an ''ARM'' peripheral, the peripherals are added to the core by the vendor, in this case ST

The polynominals present as a binary representation, with the high order bit inferred as it's always one and just beyond the scope of the register.

So 0x07 -> 0x107 -> x8 + x2 + x1 + 1

http://en.wikipedia.org/wiki/Polynomial_representations_of_cyclic_redundancy_checks

As I recall you have to jump through other hoops at the end of the transmission to send the CRC, or read the status register to see if they match (ie divide with a remainder of zero). But I think it gets computed either way.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ivani
Associate II
Posted on December 16, 2014 at 16:26

do you know if there is a disable value in the SP1 STM32F100...STM32F101 family

As far as I can see the function SPI_CalculateCRC(SPI_TypeDef* SPIx, FunctionalState NewState) is the only place where CRCEN bit of SPI CR1 register is altered. It should be called before enabling of SPI to enable the CRC calculation.

The clearing of CRC also requires a special procedure - look at the RM0090 Manual section 26.3.6.

B.Michele
Associate III
Posted on December 16, 2014 at 17:36

Thanks