2009-02-18 02:17 AM
STM32 CRC calculation unit
2011-05-17 04:03 AM
Hi everyone,
do someone know, where to find software algorithm for CRC calculation that works in the same way like CRC calculation unit. I tried to use standard CRC-32 algorithm with poly: 0x4C11DB7 and initial value of CRC: 0xffffffff. The result differs from hardware calculation result. Is there anyone, who tried CRC calculation unit in STM32 family??2011-05-17 04:03 AM
I haven't used the CRC calculation unit but is the result you're seeing the inverse of what you would expect? If so then you need to inverse the result (as the hardware has no way of knowing you're finished running data through it).
In general a CRC32 is inverted at the end. [ This message was edited by: trevor on 17-02-2009 13:06 ] [ This message was edited by: trevor on 17-02-2009 14:51 ]2011-05-17 04:03 AM
I'm using stm32 library, so I'm using CalcBlockCRC function, which looks like that:
Code:
<BR><BR>u32 CRC_CalcBlockCRC(u32 pBuffer[], u32 BufferLength) <BR><BR>{ <BR><BR> u32 index = 0; <BR><BR> for(index = 0; index < BufferLength; index++) <BR><BR> CRC->DR = pBuffer[index]; <BR><BR> return (CRC->DR); <BR><BR>} <BR><BR>
It seems there is not necesary to invert bits of result... :\ [ This message was edited by: wywrotj on 17-02-2009 13:41 ] [ This message was edited by: wywrotj on 17-02-2009 13:46 ]2011-05-17 04:03 AM
Hi Friends,
See my post here with full C code : Cheers, STOne-32. [ This message was edited by: STOne-32 on 17-02-2009 21:15 ]2011-05-17 04:03 AM
Yeah, indeed works fine now. Thanks for help!! :D