Reply by Fabio Filippa●February 11, 20082008-02-11
You need to check the CRC of HEX programming file or build a
communication protocol with your CRC check about data integrity?
Regards
Fabio Filippa
-----Messaggio originale-----
Da: S...@ansaldo-signal.co.in
[mailto:S...@ansaldo-signal.co.in]
Inviato: luned11 febbraio 2008 11.35
A: l...
Oggetto: [lpc2000] CRC in LPC 2106?
Hi,
I am newbie to this field.
I am using LPC2106 microcontroller and KEIL microvision to develop
the application.
Is there any CRC calculation is implemented automatically?
How I can calculate the CRC for the different Hex output file.
Any one knows please brief about it.
----- Original Message -----
From:
To:
Sent: Monday, February 11, 2008 10:34 AM
Subject: [lpc2000] CRC in LPC 2106? > Hi,
> I am newbie to this field.
> I am using LPC2106 microcontroller and KEIL microvision to develop
> the application.
> Is there any CRC calculation is implemented automatically?
> How I can calculate the CRC for the different Hex output file.
> Any one knows please brief about it.
Here's a 32-bit CRC I'm using with the LPC2148:
/* Initialized first time "crc32()" is called. If you prefer, you can
* statically initialize it at compile time. [Another exercise.]
*/
u_long crc32(u_char *buf, int len)
{
u_char *p;
u_long crc;
if (!crc32_table[1]) /* if not already done, */
init_crc32(); /* build table */
crc = 0xffffffff; /* preload shift register, per CRC-32 spec
*/
for (p = buf; len > 0; ++p, --len)
crc = (crc << 8) ^ crc32_table[(crc >> 24) ^ *p];
return ~crc; /* transmit complement, per CRC-32 spec */
}
/*
* Build auxiliary table for parallel byte-at-a-time CRC-32.
*/
#define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */
init_crc32()
{
int i, j;
u_long c;
for (i = 0; i < 256; ++i) {
for (c = i << 24, j = 8; j > 0; --j)
c = c & 0x80000000 ? (c << 1) ^ CRC32_POLY : (c <<
1);
crc32_table[i] = c;
}
}
I found it with Google, but I can't remember where.
Leon
Reply by stfk_slavo●February 11, 20082008-02-11
--- In l..., "Leon" wrote: >
> ----- Original Message -----
> From:
> To:
> Sent: Monday, February 11, 2008 10:34 AM
> Subject: [lpc2000] CRC in LPC 2106?
> > Hi,
> > I am newbie to this field.
> > I am using LPC2106 microcontroller and KEIL microvision to develop > > the application.
> > Is there any CRC calculation is implemented automatically?
> > How I can calculate the CRC for the different Hex output file.
> > Any one knows please brief about it.
>
> Here's a 32-bit CRC I'm using with the LPC2148:
> /* Initialized first time "crc32()" is called. If you prefer, you can
> * statically initialize it at compile time. [Another exercise.]
> */
>
> u_long crc32(u_char *buf, int len)
> {
> u_char *p;
> u_long crc;
>
> if (!crc32_table[1]) /* if not already done, */
> init_crc32(); /* build table */
> crc = 0xffffffff; /* preload shift register, per CRC-32 spec > */
> for (p = buf; len > 0; ++p, --len)
> crc = (crc << 8) ^ crc32_table[(crc >> 24) ^ *p];
> return ~crc; /* transmit complement, per CRC-32 spec */ > }
>
> /*
> * Build auxiliary table for parallel byte-at-a-time CRC-32.
> */
> #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */
>
> init_crc32()
> {
> int i, j;
> u_long c;
>
> for (i = 0; i < 256; ++i) {
> for (c = i << 24, j = 8; j > 0; --j)
> c = c & 0x80000000 ? (c << 1) ^ CRC32_POLY : (c << > 1);
> crc32_table[i] = c;
> }
> }
> I found it with Google, but I can't remember where.
>
> Leon
>
Hi,
U can use fnk with static crc32 table like this:
uint32_t CRC32(uint32_t qty, uint8_t *buf)
{
uint32_t i,crc32=0xFFFFFFFF;
Reply by Sara...@ansaldo-signal.co.in●February 11, 20082008-02-11
Hi,
I am newbie to this field.
I am using LPC2106 microcontroller and KEIL microvision to develop
the application.
Is there any CRC calculation is implemented automatically?
How I can calculate the CRC for the different Hex output file.
Any one knows please brief about it.
Thanks & regards,
S.Saravanakumar