Post Go back to editing

CRC32 for Verify ADuCM362

Good afternoon. Give me please software implementation of the CRC32 algorithm for verifying the flash-page in the ADuCM362. In accordance with AN-1160 I use the following algorithm :

unsigned long Crc32Lookup[256];

void Crc32_Make_tbl(unsigned long *crc_table)
{
   unsigned long crc;

   for (int i = 0; i < 256; i++)
   {
       crc = i;
       for (int j = 0; j < 8; j++)
       crc = crc & 1 ? (crc >> 1) ^ 0x04C11DB7UL: crc >> 1;

       crc_table[i] = crc;
  };
}

unsigned long Crc32(const unsigned long *crc_table, const void *v_buf, unsigned long len)
{
   unsigned long crc = 0xFFFFFFFFUL;
   if(crc_table == 0) 
   return crc;
   unsigned char* buf = (unsigned char*)v_buf;

   while (len--)
   crc = crc_table[(crc ^ *buf++) & 0xFF] ^ (crc >> 8);
   return crc ^ 0xFFFFFFFFUL;
}

Data of my page:

00 04 00 20 E9 01 00 00 F5 01 00 00 F5 01 00 00

FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

...............................................................................

FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   (Total 2048 Bytes)

This algorithm produces a CRC32 = 0xFB395CEF (for length = 2040   -  since 2048 without the last 8 bytes)

But CM3WSD generates CRC32 = 0xE9A4F056. :

OUT 08 
IN 41 44 75 43 4d 33 36 32 20 20 20 32 35 36 20 43 33 30 2d 2f 20 20 0d 0a  (ADuCM362   256)
OUT 07 0e 06 45 00 00 00 00 01 b4 (Erase)
IN 06
OUT 07 0e 15 57 00 00 00 00 00 04 00 20 e9 01 00 00 f5 01 00 00 f5 01 00 00 9a  (Write)
IN 06 
OUT 07 0e 09 56 80 00 00 00 ff ff ff ff 25 19 (Verif 1)

IN 06
OUT 07 0e 09 56 90 00 00 00 ff ff ff ff 15 19 (Verif2)

IN 06
OUT 07 0e 09 56 00 00 00 00 56 f0 a4 e9 ce (Verif3) 
IN 06 

For ADuCM360, Page=512 and  CRC24_D32 (from LFSR CODE EXAMPLE in AN-1160) everything works correctly.

what could be the problem?