cancel
Showing results for 
Search instead for 
Did you mean: 

Byte-wise only CRC for STM32L486?

dlane
Associate II
Posted on March 14, 2016 at 18:01

I'm using the CRC unit on the STM32L486. In the reference manual it states that:

''CRC computation is done on the whole 32-bit data

word or byte by byte depending on the format of the data being written.''

However, later in the documentation it states that:

''The data size can be dynamically adjusted to minimize the number of write accesses for a given number of bytes. For instance, a CRC for 5 bytes can be computed with a word write followed by a byte write.''

From my use of the CRC unit, it seems that I can only achieve the latter statement, which does a byte by byte calculation. Even if I write a whole word to the Data Register (DR), it will process the word a byte at a time.

From the first statement, it appears that the CRC should also do word-wise calculations, but I have not been able to accomplish that. 

Can I do word-wise calculations with this CRC or only byte-wise?

Any guidance or clarification on the capabilities of this MCU's CRC peripheral would be greatly appreciated!

#crc #stm32 #stm32l4 #bit-cloudy
13 REPLIES 13
dlane
Associate II
Posted on March 15, 2016 at 01:48

Thanks, clive1! That is helpful information. I should be able to run with this.

Posted on March 15, 2016 at 18:37

Sticking 0x00001021 into the ''bytes'' window is the equivalent to0x00 0x00 0x00 0x10 0x21

FFFFFFFF
00->4E08BFB4
00->00B7647D
00->B7647D00
10->8B15060B
21->CBA38BD8

Sticking00001021into the ''bytes'' window is the equivalent to0x00 0x00 0x10 0x21

FFFFFFFF
00->4E08BFB4
00->00B7647D
10->FB75A670
21->4BB7ED3F

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dlane
Associate II
Posted on March 15, 2016 at 18:42

Hi clive1,

Your software calculations were very helpful in verifying the hardware. I am now trying to find a way to adjust the CRC hardware settings so that it can produce standard CRC-32 Castagnoli calculations. I saw your hardware implementation for CRC-32PK, can you help me with CRC-32 Castagnoli?

Thanks!

dlane
Associate II
Posted on March 15, 2016 at 20:22

FYI, to anyone who may be interested, I found that the necessary CRC hardware settings to emulate CRC32-Castagnoli are the following:

Polynomial Coeff: 

0x1edc6f41

Reverse input data by byte

Reverse output data

Initial Value: 0xFFFFFFFF

Then apply a final XOR of 0xFFFFFFFF to get the final CRC value.