Re: microcontroller memory CRC
From: Albert van der Horst (albert_at_spenarnc.xs4all.nl)
Date: 12/30/03
- Next message: CBFalconer: "Re: Setup HI-TECH PICC8.02 compiler and MPLab 6.4"
- Previous message: Albert Lee Mitchell: "Re: An Ametuer Who needs Advice"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 29 Dec 2003 23:00:40 GMT
In article <3FDF5A92.50103@mycompanyname.com>,
Gary Peek <mylastname@mycompanyname.com> wrote:
>Does anyone know what typoe of CRC is being used with the
>Philips LPC9xx microcontrollers on the user code memory?
>It is 4 bytes but does not appear to be CRC-32. If the device
>is erased, or all zeros, the CRc returned is 00 00 00 00.
>(CRC-16 would return 00 00 as far as I can tell.)
Normally (like in ZIP) the checksum is initialised to -1, (which is
better), apparently Philips decided to initialise to 0.
If this is indeed a classical 32 bit crc you can find out its
polynomial represented as a 32 bit number.
Put a one in the most significant bit of the very last byte
and calculate the crc. The result is the polynomial.
You can then use the code of CRC and CRC-MORE of ciforth
to verify whether this is correct. ciforth is available in
Windows and Linux versions on my site below, or you can snatch
the code and run it under a Forth of your liking.
CRC has to be redefined or you can use its component CRC-MORE
as below.
(Redefinition `` : CRC 0 ROT ROT CRC-MORE ; '')
Dump the memory in a file, then start up ciforth
(e.g. lina under linux) and type
lina -e
REQUIRE CRC
0 "philips.dmp" GET-FILE CRC-MORE H.
BYE
Unfortunately there may be all kinds of variation. They may have
decided to pass the least significant bits first through the
checker. Or invert them first. They may fetch the data as
4 bytes big-endian, then start with the most significant bit
of this 32 bit value. You are best off by just asking.
But a little bit of experimenting must yield the answer too.
>--
>Gary Peek mailto:mylastname@mycompanyname.com
>Industrologic, Inc. http://www.industrologic.com
>Phone: (636) 723-4000 Fax: (636) 724-2288
>
--
Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS
One man-hour to invent,
One man-week to implement,
One lawyer-year to patent.
- Next message: CBFalconer: "Re: Setup HI-TECH PICC8.02 compiler and MPLab 6.4"
- Previous message: Albert Lee Mitchell: "Re: An Ametuer Who needs Advice"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]