Skip to main content
wywrotj
Associate II
February 18, 2009
Question

STM32 CRC calculation unit

  • February 18, 2009
  • 5 replies
  • 836 views
Posted on February 18, 2009 at 11:17

STM32 CRC calculation unit

    This topic has been closed for replies.

    5 replies

    wywrotj
    wywrotjAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:03

    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 ]

    trevor1
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:03

    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 ]

    wywrotj
    wywrotjAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:03

    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??

    16-32micros
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:03

    Hi Friends,

    See my post here with full C code :

    http://www.st.com/mcu/forums-cat-7171-23.html

    Cheers,

    STOne-32.

    [ This message was edited by: STOne-32 on 17-02-2009 21:15 ]

    wywrotj
    wywrotjAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:03

    Yeah, indeed works fine now. Thanks for help!! :D