cancel
Showing results for 
Search instead for 
Did you mean: 

is stm32f4 have crc16 unit?

imanpakii
Associate III
Posted on October 04, 2012 at 17:42

Hi guys 

Is anybody knows about crc16 in stm32f4 ? Is this have any crc16 calculator like crc32 ?

thank you

#reverse-polynomial #fire-codes
11 REPLIES 11
Posted on October 04, 2012 at 18:08

Is anybody knows about crc16 in stm32f4 ? Is this have any crc16 calculator like crc32 ?

 

It does not, the 32-bit one it supports is one of a myriad of polynomial and direction combinations. It has limited usefulness, being 32-bit only, and endian incompatible with the platform it's bolted too.

Your specific 16-bit CRC will need to be implemented in software. These can be done quite efficiently with tables, but it depends on the polynomial and the shift direction of the register and the data bits.

The STM32F303 has a more flexible CRC peripheral.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
imanpakii
Associate III
Posted on October 09, 2012 at 17:07

thank you clive1 

arsalan914
Associate II
Posted on February 12, 2013 at 04:17

the results i am getting from the STM32f40 crc are not according to the crc calculation from the website http://ghsi.de/CRC/index.php

the data input i used is: 0xF0033431

the checksum STM32F40 gives:0x0A401253

the checksum according to website calculator: 0x

CD44CF28

the polynomial that is used is fixed according to CRC32 i.e. 0x4C11DB7.....

Can anyone please help me? 

Posted on February 12, 2013 at 14:17

Can anyone please help me? 

Help you how?

The STM32 processes 32-bit words, NOT bytes, and NOT little endian

I've posted a number of software examples in the past.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
arsalan914
Associate II
Posted on February 12, 2013 at 14:34

thank you for the reply.

the question that is troubling me is :::why is the checksum of stm32 and the checksum calculated from the website (link given above) different. ??

looking forward to your reply 

Posted on February 12, 2013 at 15:51

the question that is troubling me is :::why is the checksum of stm32 and the checksum calculated from the website (link given above) different. ??

 

looking forward to your reply

Because neither you nor the web site guy grasp that the STM32 CRC32 is incongruent with byte operation, that the shift direction and endianess alter it's behaviour. The STM32 F1/F2/F4 CRC computation works on 32-bit WORDS ONLY.

Sequence STM32 implements (byte level equivalent operation)

crc = crc32byte(crc, byte[3]);

crc = crc32byte(crc, byte[2]);

crc = crc32byte(crc, byte[1]);

crc = crc32byte(crc, byte[0]);

crc = crc32byte(crc, byte[7]);

crc = crc32byte(crc, byte[6]);

crc = crc32byte(crc, byte[5]);

crc = crc32byte(crc, byte[4]);

..

Linear sequence expected by most online testers

crc = crc32byte(crc, byte[0]);

crc = crc32byte(crc, byte[1]);

crc = crc32byte(crc, byte[2]);

crc = crc32byte(crc, byte[3]);

crc = crc32byte(crc, byte[4]);

crc = crc32byte(crc, byte[5]);

crc = crc32byte(crc, byte[6]);

crc = crc32byte(crc, byte[7]);

..

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/DispForm.aspx?ID=15791&RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/CRC%20computation

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
arsalan914
Associate II
Posted on February 12, 2013 at 18:59

thanks a lot for the help and the algorithm stm32 uses. 

but i still am having a problem. if i  this 32 bit number 0xF0033431... for this 32 bit number the STM32 generates the checksum=0x0A401253....what should be the 32bit number that i should user for the online calculator inorder to get same checksum??

i will be very thankful to you for the help. 

arsalan914
Associate II
Posted on February 12, 2013 at 19:24

thanks a lot for the help and the algorithm stm32 uses. 

but i still am having a problem. if i have this 32 bit number 0xF0033431... for this 32 bit number the STM32 generates the checksum=0x0A401253....what should be the 32bit number that i should use for the online calculator inorder to get same checksum??

i will be very thankful to you for the help.

Posted on February 12, 2013 at 20:05

what should be the 32bit number that i should use for the online calculator inorder to get same checksum??

Can you? The online calculator assumes a ZERO initial state, the STM32 resets to all ONES

printf(''%08

X'',Crc32Fast(0xFFFFFFFF, 0xF0033431));
0A401253
printf(''%08

X'',Crc32Fast(0x00000000, 0xF0033431));
CD44CF28

You could do a similar thing by feeding 0xFFFFFFFF, then 0xF0033431 into your STM32 test. Or the online Poly 100000100110000010001110110110111 Data 46AF6449 F0033431 $ a401253 (hexadecimal) % 00001010010000000001001001010011 (binary) ! 171971155 (decimal) QED
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..