cancel
Showing results for 
Search instead for 
Did you mean: 

CRC Hardware with SPI and DMA

gfoujanet
Associate II
Posted on April 09, 2013 at 17:29

I configured a SPI transfer with DMA. 

It's working.

Now I would like to add a CRC16 at the end of the frame. I enable the CRC clock and I set the CRCEN bit.

The CRC16 is send via SPI link. But I can't check if the CRC is well done or not! Do you know what are the parameters to calculate the CRC?

-->polynom: ok

-->initial value?

-->final xor value?

--> final value inversed?

The stm used is the STM3L152.

thanks ,

GF.

#stm32-crc-dma-spi
1 REPLY 1
Posted on April 09, 2013 at 17:53

It's documented to reset the register to zero, and one suspects it leaves a remainder of zero if the data+crc divides through cleanly. The most frequent usages I see don't use any inversion, and in all cases it's done it complicates the hw implementation.

You define the left shifting polynomial. ie MSB out first.

The search space is pretty small, if you have a couple of example data streams, with appended CRC, it should be fairly evident what going on, and if it works properly. The SPI peripheral seems to need a lot of user intervention to append the out going CRC.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..