Find help, specifications and source code for the LPC900. The LPC900 challenges Microchip and AVR based on the worlds most popular 8-bit architecture the 80C51. With a 2-clock core the LPC900 series is a high performance, very flexible and low cost 8-bit microcontroller family. Designers using or interested in these devices are encouraged to share their know-how and ask questions.
LPC2000 to LPC91x ICP driver... - =?iso-8859-1?q?Carsten_Gr=F8n?= - Jun 22 13:59:20 2006
Hello,
I know it is (probably) a long shot, but are there any of you guy's
that have ported (part of) the ISP->ICP bridge software for the LPC9xx
processors to the LPC2000 devices (I'm interested in the "ICP" part of
the code)? If not, I'll dig into it myself, but thought I might ask
first :o)
I have a design here with a LPC2148 which is coupled to a LPC915 (used
as a "UART on a I2C bus"), and I need to be able to put new firmare
into the LPC915 from the LPC2148 (coming "over the air" via GPRS).
(Also posted this on the LPC2000 forum....)
Regards,
Carsten

(You need to be a member of LPC900_users -- send a blank email to LPC900_users-subscribe@yahoogroups.com )
Re: LPC2000 to LPC91x ICP driver... - =?iso-8859-1?q?Carsten_Gr=F8n?= - Jun 23 7:32:03 2006
Guess not :o)
I'm doing the software right now, have managed to get the LPC9x into=20
ICP mode, and reading the manuf. ID, device ID etc etc...
So if anybody needs....
Regards,
Carsten
--- In l...@yahoogroups.com, Carsten Gr=F8n
wrote:
>
> Hello,
>=20
> I know it is (probably) a long shot, but are there any of you guy's
> that have ported (part of) the ISP->ICP bridge software for the=20
LPC9xx
> processors to the LPC2000 devices (I'm interested in the "ICP"=20
part of
> the code)? If not, I'll dig into it myself, but thought I might ask
> first :o)
>=20
>=20
> I have a design here with a LPC2148 which is coupled to a LPC915=20
(used
> as a "UART on a I2C bus"), and I need to be able to put new firmare
> into the LPC915 from the LPC2148 (coming "over the air" via GPRS).
>=20
> (Also posted this on the LPC2000 forum....)
>=20
> Regards,
> Carsten
>
=20
=20
=20

(You need to be a member of LPC900_users -- send a blank email to LPC900_users-subscribe@yahoogroups.com )Re: LPC2000 to LPC91x ICP driver... - philips_marketing_usa - Jun 27 14:59:55 2006
Hello Carsten,
Sorry for not getting back to you sooner. It is possible to program=20
the LPC91x by an LPC2000 through ICP, as long as the ICP entry=20
waveforms are met and the bitshifting timing is adjusted, the same=20
code should be able to be used as from the bridge code. It should=20
be easier if you use IAP lite on the LPC91x and have a simpler=20
communication protocol between the LPC2000 and the LPC91x. An IAP=20
Lite example is given in the following appnote:=20=20
http://www.standardics.philips.com/support/documents/microcontrollers
/pdf/an10342.pdf
--- In l...@yahoogroups.com, Carsten Gr=F8n
wrote:
>
> Guess not :o)
>=20
> I'm doing the software right now, have managed to get the LPC9x=20
into=20
> ICP mode, and reading the manuf. ID, device ID etc etc...
> So if anybody needs....
>=20
> Regards,
> Carsten
>=20
>=20
> --- In l...@yahoogroups.com, Carsten Gr=F8n wrote:
> >
> > Hello,
> >=20
> > I know it is (probably) a long shot, but are there any of you=20
guy's
> > that have ported (part of) the ISP->ICP bridge software for the=20
> LPC9xx
> > processors to the LPC2000 devices (I'm interested in the "ICP"=20
> part of
> > the code)? If not, I'll dig into it myself, but thought I might=20
ask
> > first :o)
> >=20
> >=20
> > I have a design here with a LPC2148 which is coupled to a LPC915=20
> (used
> > as a "UART on a I2C bus"), and I need to be able to put new=20
firmare
> > into the LPC915 from the LPC2148 (coming "over the air" via=20
GPRS).
> >=20
> > (Also posted this on the LPC2000 forum....)
> >=20
> > Regards,
> > Carsten
>
=20
=20
=20
______________________________
controlSUITE software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!

(You need to be a member of LPC900_users -- send a blank email to LPC900_users-subscribe@yahoogroups.com )Re: LPC2000 to LPC91x ICP driver... - =?iso-8859-1?q?Carsten_Gr=F8n?= - Jun 28 12:47:19 2006
No problem,
I already have the code working without any problems. It was very=20
easy to follow the ICP description from Philips, the only problem I=20
faced was the need to let the Vcc fall _very_ close to GND before=20
attempting to start the ICP mode on it (by toggling RTS 7 times as=20
per description).
The only "problem" left, is the CRC calculation, I use the "get=20
global CRC" on the ICP bus to get the CRC of the "current firmware=20
running in the LPC915". This CRC should then be checked with the=20
(calculated) CRC from the "new" firmware which is held in the=20
firmware for the '2148....
I have _tried_ to implement the calculation as described in new ICP=20
description, but my code does not agree with the CRC returned from=20
the '915 device :o)
If there is any code around (preferably C code), I would very much=20
like a copy of it.....
(the 2148 and 915 are going into a product that is sold in more that=20
85.000 pieces at the moment, and we are not even finished with it)
Regards,
Carsten
--- In l...@yahoogroups.com, "philips_marketing_usa"=20
wrote:
>
> Hello Carsten,
>=20
> Sorry for not getting back to you sooner. It is possible to=20
program=20
> the LPC91x by an LPC2000 through ICP, as long as the ICP entry=20
> waveforms are met and the bitshifting timing is adjusted, the same=20
> code should be able to be used as from the bridge code. It should=20
> be easier if you use IAP lite on the LPC91x and have a simpler=20
> communication protocol between the LPC2000 and the LPC91x. An IAP=20
> Lite example is given in the following appnote:=20=20
>=20
http://www.standardics.philips.com/support/documents/microcontrollers
> /pdf/an10342.pdf
>=20
>=20
> --- In l...@yahoogroups.com, Carsten Gr=F8n wrote:
> >
> > Guess not :o)
> >=20
> > I'm doing the software right now, have managed to get the LPC9x=20
> into=20
> > ICP mode, and reading the manuf. ID, device ID etc etc...
> > So if anybody needs....
> >=20
> > Regards,
> > Carsten
> >=20
> >=20
> > --- In l...@yahoogroups.com, Carsten Gr=F8n =20
wrote:
> > >
> > > Hello,
> > >=20
> > > I know it is (probably) a long shot, but are there any of you=20
> guy's
> > > that have ported (part of) the ISP->ICP bridge software for=20
the=20
> > LPC9xx
> > > processors to the LPC2000 devices (I'm interested in the "ICP"=20
> > part of
> > > the code)? If not, I'll dig into it myself, but thought I=20
might=20
> ask
> > > first :o)
> > >=20
> > >=20
> > > I have a design here with a LPC2148 which is coupled to a=20
LPC915=20
> > (used
> > > as a "UART on a I2C bus"), and I need to be able to put new=20
> firmare
> > > into the LPC915 from the LPC2148 (coming "over the air" via=20
> GPRS).
> > >=20
> > > (Also posted this on the LPC2000 forum....)
> > >=20
> > > Regards,
> > > Carsten
> > >
>
=20
=20
=20

(You need to be a member of LPC900_users -- send a blank email to LPC900_users-subscribe@yahoogroups.com )RE: Re: LPC2000 to LPC91x ICP driver... - Eric Rullens - Jun 28 13:10:01 2006
Carsten,
> I have _tried_ to implement the calculation as described in new ICP=20
> description, but my code does not agree with the CRC returned from=20
> the '915 device :o)
>=20
> If there is any code around (preferably C code), I would very much=20
> like a copy of it.....
>=20
> (the 2148 and 915 are going into a product that is sold in more that=20
> 85.000 pieces at the moment, and we are not even finished with it)
I've written code that implements the CRC calculation as described in the
ICP manual. No problems. (Can't release the code though.)
So (assuming you've copied the algorithm correctly), the problem may be in
the programming of the device. Do you use an erase global? (I assume 'yes'.=
)
Then when calculating the checksum, do you patch your binary to the correcy
length (i.e. entire memory space) with the correct value? That will affect
the final CRC...
Sincerely,
Eric
> --- In l...@yahoogroups.com, "philips_marketing_usa"=20
>
wrote:
> >
> > Hello Carsten,
> >=20
> > Sorry for not getting back to you sooner. It is possible to=20
> program=20
> > the LPC91x by an LPC2000 through ICP, as long as the ICP entry=20
> > waveforms are met and the bitshifting timing is adjusted, the same=20
> > code should be able to be used as from the bridge code. It should=20
> > be easier if you use IAP lite on the LPC91x and have a simpler=20
> > communication protocol between the LPC2000 and the LPC91x. An IAP=20
> > Lite example is given in the following appnote:=20=20
> >=20
> http://www.standardics.philips.com/support/documents/microcontrollers
> > /pdf/an10342.pdf
> >=20
> >=20
> > --- In l...@yahoogroups.com, Carsten Gr=F8n wrote:
> > >
> > > Guess not :o)
> > >=20
> > > I'm doing the software right now, have managed to get the LPC9x=20
> > into=20
> > > ICP mode, and reading the manuf. ID, device ID etc etc...
> > > So if anybody needs....
> > >=20
> > > Regards,
> > > Carsten
> > >=20
> > >=20
> > > --- In l...@yahoogroups.com, Carsten Gr=F8n =20
> wrote:
> > > >
> > > > Hello,
> > > >=20
> > > > I know it is (probably) a long shot, but are there any of you=20
> > guy's
> > > > that have ported (part of) the ISP->ICP bridge software for=20
> the=20
> > > LPC9xx
> > > > processors to the LPC2000 devices (I'm interested in the "ICP"=20
> > > part of
> > > > the code)? If not, I'll dig into it myself, but thought I=20
> might=20
> > ask
> > > > first :o)
> > > >=20
> > > >=20
> > > > I have a design here with a LPC2148 which is coupled to a=20
> LPC915=20
> > > (used
> > > > as a "UART on a I2C bus"), and I need to be able to put new=20
> > firmare
> > > > into the LPC915 from the LPC2148 (coming "over the air" via=20
> > GPRS).
> > > >=20
> > > > (Also posted this on the LPC2000 forum....)
> > > >=20
> > > > Regards,
> > > > Carsten
> > > >
> > >
> >
>=20
>=20
>=20
>=20
>=20
>=20
> =20
>=20
>=20=20
>
=20

(You need to be a member of LPC900_users -- send a blank email to LPC900_users-subscribe@yahoogroups.com )Re: LPC2000 to LPC91x ICP driver... - =?iso-8859-1?q?Carsten_Gr=F8n?= - Jun 28 13:37:27 2006
Hello Eric,
Yes, I am using the global erase, and when I do the CRC calculation,
I patch the rest of the 2KB with 0xFF (I'm assuming that's
the "erased" state of the FLASH)...
Hmm, would it be possible for you to send me a "buffer" of data (say
maybe 16 bytes or so) and the correct CRC number for that ?
That way, I would have something to test up against....
Regards,
Carsten
--- In l...@yahoogroups.com, Eric Rullens
wrote:
>
> Carsten,
>
> > I have _tried_ to implement the calculation as described in new
ICP
> > description, but my code does not agree with the CRC returned
from
> > the '915 device :o)
> >
> > If there is any code around (preferably C code), I would very
much
> > like a copy of it.....
> >
> > (the 2148 and 915 are going into a product that is sold in more
that
> > 85.000 pieces at the moment, and we are not even finished with
it)
>
> I've written code that implements the CRC calculation as described
in the
> ICP manual. No problems. (Can't release the code though.)
>
> So (assuming you've copied the algorithm correctly), the problem
may be in
> the programming of the device. Do you use an erase global? (I
assume 'yes'.)
> Then when calculating the checksum, do you patch your binary to
the correcy
> length (i.e. entire memory space) with the correct value? That
will affect
> the final CRC...
>
> Sincerely,
>
> Eric

(You need to be a member of LPC900_users -- send a blank email to LPC900_users-subscribe@yahoogroups.com )Re: LPC2000 to LPC91x ICP driver... - geejee_lpc - Jun 28 13:39:47 2006
See if this works...
Regards,
Gertjan
unsigned char *calc_crc32(unsigned char *memory,unsigned int length)
{
#define LPC900_POLY_0 0x07
#define LPC900_POLY_1 0x00
#define LPC900_POLY_2 0x40
#define LPC900_POLY_3 0x00
static unsigned char retstr[9];
unsigned char crc32[4];
unsigned char overflow;
unsigned int n;
//Clear buffer
for(n=3D0;n<4;n++) {
crc32[n]=3D0x00;
}
for(n=3D0;n
//Shift left CRC
overflow=3Dcrc32[3] & 0x80;
crc32[3]<<=3D1;
if(crc32[2] & 0x80) crc32[3]++;
crc32[2]<<=3D1;
if(crc32[1] & 0x80) crc32[2]++;
crc32[1]<<=3D1;
if(crc32[0] & 0x80) crc32[1]++;
crc32[0]<<=3D1;
//EXOR data into CRC
if(memory[n] & 0x01) crc32[0]^=3D0x01;
if(memory[n] & 0x02) crc32[0]^=3D0x08;
if(memory[n] & 0x04) crc32[0]^=3D0x20;
if(memory[n] & 0x08) crc32[1]^=3D0x01;
if(memory[n] & 0x10) crc32[1]^=3D0x04;
if(memory[n] & 0x20) crc32[1]^=3D0x20;
if(memory[n] & 0x40) crc32[2]^=3D0x01;
if(memory[n] & 0x80) crc32[2]^=3D0x04;
//EXOR lpc900 poly into CRC
if(overflow) {
crc32[0]^=3DLPC900_POLY_0;
crc32[1]^=3DLPC900_POLY_1;
crc32[2]^=3DLPC900_POLY_2;
crc32[3]^=3DLPC900_POLY_3;
}
}
sprintf(retstr,"%02X%02X%02X%02X",crc32[3],crc32[2],crc32[1],crc32
[0]);
return(retstr);
}
--- In l...@yahoogroups.com, Carsten Gr=F8n
wrote:
>
> No problem,
> I already have the code working without any problems. It was very=20
> easy to follow the ICP description from Philips, the only problem I=20
> faced was the need to let the Vcc fall _very_ close to GND before=20
> attempting to start the ICP mode on it (by toggling RTS 7 times as=20
> per description).
>=20
> The only "problem" left, is the CRC calculation, I use the "get=20
> global CRC" on the ICP bus to get the CRC of the "current firmware=20
> running in the LPC915". This CRC should then be checked with the=20
> (calculated) CRC from the "new" firmware which is held in the=20
> firmware for the '2148....
>=20
> I have _tried_ to implement the calculation as described in new ICP=20
> description, but my code does not agree with the CRC returned from=20
> the '915 device :o)
>=20
> If there is any code around (preferably C code), I would very much=20
> like a copy of it.....
>=20
> (the 2148 and 915 are going into a product that is sold in more=20
that=20
> 85.000 pieces at the moment, and we are not even finished with it)
>=20
> Regards,
> Carsten
>=20
>=20
>=20
>=20
> --- In l...@yahoogroups.com, "philips_marketing_usa"=20
> wrote:
> >
> > Hello Carsten,
> >=20
> > Sorry for not getting back to you sooner. It is possible to=20
> program=20
> > the LPC91x by an LPC2000 through ICP, as long as the ICP entry=20
> > waveforms are met and the bitshifting timing is adjusted, the=20
same=20
> > code should be able to be used as from the bridge code. It=20
should=20
> > be easier if you use IAP lite on the LPC91x and have a simpler=20
> > communication protocol between the LPC2000 and the LPC91x. An IAP=20
> > Lite example is given in the following appnote:=20=20
> >=20
>=20
http://www.standardics.philips.com/support/documents/microcontrollers
> > /pdf/an10342.pdf
> >=20
> >=20
> > --- In l...@yahoogroups.com, Carsten Gr=F8n wrote:
> > >
> > > Guess not :o)
> > >=20
> > > I'm doing the software right now, have managed to get the LPC9x=20
> > into=20
> > > ICP mode, and reading the manuf. ID, device ID etc etc...
> > > So if anybody needs....
> > >=20
> > > Regards,
> > > Carsten
> > >=20
> > >=20
> > > --- In l...@yahoogroups.com, Carsten Gr=F8n =20
> wrote:
> > > >
> > > > Hello,
> > > >=20
> > > > I know it is (probably) a long shot, but are there any of you=20
> > guy's
> > > > that have ported (part of) the ISP->ICP bridge software for=20
> the=20
> > > LPC9xx
> > > > processors to the LPC2000 devices (I'm interested in=20
the "ICP"=20
> > > part of
> > > > the code)? If not, I'll dig into it myself, but thought I=20
> might=20
> > ask
> > > > first :o)
> > > >=20
> > > >=20
> > > > I have a design here with a LPC2148 which is coupled to a=20
> LPC915=20
> > > (used
> > > > as a "UART on a I2C bus"), and I need to be able to put new=20
> > firmare
> > > > into the LPC915 from the LPC2148 (coming "over the air" via=20
> > GPRS).
> > > >=20
> > > > (Also posted this on the LPC2000 forum....)
> > > >=20
> > > > Regards,
> > > > Carsten
> > > >
> > >
>
=20
=20
=20

(You need to be a member of LPC900_users -- send a blank email to LPC900_users-subscribe@yahoogroups.com )RE: Re: LPC2000 to LPC91x ICP driver... - Eric Rullens - Jun 28 13:46:38 2006
Hi Carsten,
> Yes, I am using the global erase, and when I do the CRC calculation,
> I patch the rest of the 2KB with 0xFF (I'm assuming that's
> the "erased" state of the FLASH)...
Try 0, that should work much better... ;-)
> Hmm, would it be possible for you to send me a "buffer" of data (say
> maybe 16 bytes or so) and the correct CRC number for that ?
> That way, I would have something to test up against....
Don't have that here, but you can load a file in Flash Magic and check the
individual sector CRCs of the buffer... That will give you the same info.
Sincerely,
Eric
> --- In l...@yahoogroups.com, Eric Rullens
> wrote:
> >
> > Carsten,
> >
> > > I have _tried_ to implement the calculation as described in new
> ICP
> > > description, but my code does not agree with the CRC returned
> from
> > > the '915 device :o)
> > >
> > > If there is any code around (preferably C code), I would very
> much
> > > like a copy of it.....
> > >
> > > (the 2148 and 915 are going into a product that is sold in more
> that
> > > 85.000 pieces at the moment, and we are not even finished with
> it)
> >
> > I've written code that implements the CRC calculation as described
> in the
> > ICP manual. No problems. (Can't release the code though.)
> >
> > So (assuming you've copied the algorithm correctly), the problem
> may be in
> > the programming of the device. Do you use an erase global? (I
> assume 'yes'.)
> > Then when calculating the checksum, do you patch your binary to
> the correcy
> > length (i.e. entire memory space) with the correct value? That
> will affect
> > the final CRC...
> >
> > Sincerely,
> >
> > Eric
> >
> >
>

(You need to be a member of LPC900_users -- send a blank email to LPC900_users-subscribe@yahoogroups.com )Re: LPC2000 to LPC91x ICP driver... - =?iso-8859-1?q?Carsten_Gr=F8n?= - Jun 28 14:25:05 2006
Hi Eric,
I already tried the Flashmafic approch, but it wont give me the CRC
unless it can talk with a board with LPC9x in it.....
I'll go ahead and try Gertjan's code....
Regards,
Carsten
--- In l...@yahoogroups.com, Eric Rullens
wrote:
>
> Hi Carsten,
>
> > Yes, I am using the global erase, and when I do the CRC
calculation,
> > I patch the rest of the 2KB with 0xFF (I'm assuming that's
> > the "erased" state of the FLASH)...
>
> Try 0, that should work much better... ;-)
>
> > Hmm, would it be possible for you to send me a "buffer" of data
(say
> > maybe 16 bytes or so) and the correct CRC number for that ?
> > That way, I would have something to test up against....
>
> Don't have that here, but you can load a file in Flash Magic and
check the
> individual sector CRCs of the buffer... That will give you the
same info.
>
> Sincerely,
>
> Eric
>

(You need to be a member of LPC900_users -- send a blank email to LPC900_users-subscribe@yahoogroups.com )Re: LPC2000 to LPC91x ICP driver... - =?iso-8859-1?q?Carsten_Gr=F8n?= - Jun 28 14:38:56 2006
Hi Gertjan,
I just tried your code, it does not give the same CRC as the global
CRC (or I'm doing something wrong (most probably!))...
I have patched the full 2KB of my array with 0xFF, and then I copy
my "firmware" into this array, and do the calculation on the array...
I tried to make a CRC on an array with 8 bytes in it, values were
0x01,0x02....0x08.
Your routine gives the crc bytes: 0x00,0x00,0x01,0x5A
Can you cross check ?
Regards,
Carsten
--- In l...@yahoogroups.com, "geejee_lpc"
wrote:
>
> See if this works...
> Regards,
> Gertjan
> unsigned char *calc_crc32(unsigned char *memory,unsigned int
length)
> {
> #define LPC900_POLY_0 0x07
> #define LPC900_POLY_1 0x00
> #define LPC900_POLY_2 0x40
> #define LPC900_POLY_3 0x00
>
> static unsigned char retstr[9];
> unsigned char crc32[4];
> unsigned char overflow;
> unsigned int n;
>
> //Clear buffer
> for(n=0;n<4;n++) {
> crc32[n]=0x00;
> }
>
> for(n=0;n
> //Shift left CRC
> overflow=crc32[3] & 0x80;
> crc32[3]<<=1;
> if(crc32[2] & 0x80) crc32[3]++;
> crc32[2]<<=1;
> if(crc32[1] & 0x80) crc32[2]++;
> crc32[1]<<=1;
> if(crc32[0] & 0x80) crc32[1]++;
> crc32[0]<<=1;
>
> //EXOR data into CRC
> if(memory[n] & 0x01) crc32[0]^=0x01;
> if(memory[n] & 0x02) crc32[0]^=0x08;
> if(memory[n] & 0x04) crc32[0]^=0x20;
> if(memory[n] & 0x08) crc32[1]^=0x01;
> if(memory[n] & 0x10) crc32[1]^=0x04;
> if(memory[n] & 0x20) crc32[1]^=0x20;
> if(memory[n] & 0x40) crc32[2]^=0x01;
> if(memory[n] & 0x80) crc32[2]^=0x04;
>
> //EXOR lpc900 poly into CRC
> if(overflow) {
> crc32[0]^=LPC900_POLY_0;
> crc32[1]^=LPC900_POLY_1;
> crc32[2]^=LPC900_POLY_2;
> crc32[3]^=LPC900_POLY_3;
> }
> }
>
> sprintf(retstr,"%02X%02X%02X%02X",crc32[3],crc32[2],crc32
[1],crc32
> [0]);
> return(retstr);
> }

(You need to be a member of LPC900_users -- send a blank email to LPC900_users-subscribe@yahoogroups.com )Re: LPC2000 to LPC91x ICP driver... - =?iso-8859-1?q?Carsten_Gr=F8n?= - Jun 28 14:44:35 2006
Thanks Gertjan,
I'll stuff that into the '2148 and see if that does the trick (I bet=20
it does :o)
Thanks,
Carsten
--- In l...@yahoogroups.com, "geejee_lpc"
wrote:
>
> See if this works...
> Regards,
> Gertjan
>=20
>=20
> unsigned char *calc_crc32(unsigned char *memory,unsigned int=20
length)
> {
> #define LPC900_POLY_0 0x07
> #define LPC900_POLY_1 0x00
> #define LPC900_POLY_2 0x40
> #define LPC900_POLY_3 0x00
>=20
> static unsigned char retstr[9];
> unsigned char crc32[4];
> unsigned char overflow;
> unsigned int n;
>=20
> //Clear buffer
> for(n=3D0;n<4;n++) {
> crc32[n]=3D0x00;
> }
>=20
> for(n=3D0;n
> //Shift left CRC
> overflow=3Dcrc32[3] & 0x80;
> crc32[3]<<=3D1;
> if(crc32[2] & 0x80) crc32[3]++;
> crc32[2]<<=3D1;
> if(crc32[1] & 0x80) crc32[2]++;
> crc32[1]<<=3D1;
> if(crc32[0] & 0x80) crc32[1]++;
> crc32[0]<<=3D1;
>=20
> //EXOR data into CRC
> if(memory[n] & 0x01) crc32[0]^=3D0x01;
> if(memory[n] & 0x02) crc32[0]^=3D0x08;
> if(memory[n] & 0x04) crc32[0]^=3D0x20;
> if(memory[n] & 0x08) crc32[1]^=3D0x01;
> if(memory[n] & 0x10) crc32[1]^=3D0x04;
> if(memory[n] & 0x20) crc32[1]^=3D0x20;
> if(memory[n] & 0x40) crc32[2]^=3D0x01;
> if(memory[n] & 0x80) crc32[2]^=3D0x04;
>=20
> //EXOR lpc900 poly into CRC
> if(overflow) {
> crc32[0]^=3DLPC900_POLY_0;
> crc32[1]^=3DLPC900_POLY_1;
> crc32[2]^=3DLPC900_POLY_2;
> crc32[3]^=3DLPC900_POLY_3;
> }
> }
>=20
> sprintf(retstr,"%02X%02X%02X%02X",crc32[3],crc32[2],crc32
[1],crc32
> [0]);
> return(retstr);
> }
>=20
>=20
>=20
>=20
> --- In l...@yahoogroups.com, Carsten Gr=F8n wrote:
> >
> > No problem,
> > I already have the code working without any problems. It was=20
very=20
> > easy to follow the ICP description from Philips, the only=20
problem I=20
> > faced was the need to let the Vcc fall _very_ close to GND=20
before=20
> > attempting to start the ICP mode on it (by toggling RTS 7 times=20
as=20
> > per description).
> >=20
> > The only "problem" left, is the CRC calculation, I use the "get=20
> > global CRC" on the ICP bus to get the CRC of the "current=20
firmware=20
> > running in the LPC915". This CRC should then be checked with the=20
> > (calculated) CRC from the "new" firmware which is held in the=20
> > firmware for the '2148....
> >=20
> > I have _tried_ to implement the calculation as described in new=20
ICP=20
> > description, but my code does not agree with the CRC returned=20
from=20
> > the '915 device :o)
> >=20
> > If there is any code around (preferably C code), I would very=20
much=20
> > like a copy of it.....
> >=20
> > (the 2148 and 915 are going into a product that is sold in more=20
> that=20
> > 85.000 pieces at the moment, and we are not even finished with=20
it)
> >=20
> > Regards,
> > Carsten
> >=20
> >=20
> >=20
> >=20
> > --- In l...@yahoogroups.com, "philips_marketing_usa"=20
> > wrote:
> > >
> > > Hello Carsten,
> > >=20
> > > Sorry for not getting back to you sooner. It is possible to=20
> > program=20
> > > the LPC91x by an LPC2000 through ICP, as long as the ICP entry=20
> > > waveforms are met and the bitshifting timing is adjusted, the=20
> same=20
> > > code should be able to be used as from the bridge code. It=20
> should=20
> > > be easier if you use IAP lite on the LPC91x and have a simpler=20
> > > communication protocol between the LPC2000 and the LPC91x. An=20
IAP=20
> > > Lite example is given in the following appnote:=20=20
> > >=20
> >=20
>=20
http://www.standardics.philips.com/support/documents/microcontrollers
> > > /pdf/an10342.pdf
> > >=20
> > >=20
> > > --- In l...@yahoogroups.com, Carsten Gr=F8n =20
wrote:
> > > >
> > > > Guess not :o)
> > > >=20
> > > > I'm doing the software right now, have managed to get the=20
LPC9x=20
> > > into=20
> > > > ICP mode, and reading the manuf. ID, device ID etc etc...
> > > > So if anybody needs....
> > > >=20
> > > > Regards,
> > > > Carsten
> > > >=20
> > > >=20
> > > > --- In l...@yahoogroups.com, Carsten Gr=F8n =20
> > wrote:
> > > > >
> > > > > Hello,
> > > > >=20
> > > > > I know it is (probably) a long shot, but are there any of=20
you=20
> > > guy's
> > > > > that have ported (part of) the ISP->ICP bridge software=20
for=20
> > the=20
> > > > LPC9xx
> > > > > processors to the LPC2000 devices (I'm interested in=20
> the "ICP"=20
> > > > part of
> > > > > the code)? If not, I'll dig into it myself, but thought I=20
> > might=20
> > > ask
> > > > > first :o)
> > > > >=20
> > > > >=20
> > > > > I have a design here with a LPC2148 which is coupled to a=20
> > LPC915=20
> > > > (used
> > > > > as a "UART on a I2C bus"), and I need to be able to put=20
new=20
> > > firmare
> > > > > into the LPC915 from the LPC2148 (coming "over the air"=20
via=20
> > > GPRS).
> > > > >=20
> > > > > (Also posted this on the LPC2000 forum....)
> > > > >=20
> > > > > Regards,
> > > > > Carsten
> > > > >
> > > >
> > >
>
=20
=20
=20

(You need to be a member of LPC900_users -- send a blank email to LPC900_users-subscribe@yahoogroups.com )RE: Re: LPC2000 to LPC91x ICP driver... - Eric Rullens - Jun 28 17:21:25 2006
Carsten,
Try presetting the buffer to 0, not 255...
If that doesn't work I'll fire up some tools over here (time permitting).
Eric
> -----Oorspronkelijk bericht-----
> Van: Carsten Gr=F8n [mailto:c...@mail.dk]
> Verzonden: woensdag 28 juni 2006 20:22
> Aan: l...@yahoogroups.com
> Onderwerp: [lpc900_users] Re: LPC2000 to LPC91x ICP driver...
>=20
>=20
> Hi Gertjan,
>=20
> I just tried your code, it does not give the same CRC as the global=20
> CRC (or I'm doing something wrong (most probably!))...
>=20
> I have patched the full 2KB of my array with 0xFF, and then I copy=20
> my "firmware" into this array, and do the calculation on the array...
>=20
> I tried to make a CRC on an array with 8 bytes in it, values were=20
> 0x01,0x02....0x08.
> Your routine gives the crc bytes: 0x00,0x00,0x01,0x5A
>=20
> Can you cross check ?
>=20
> Regards,
> Carsten
>=20
>=20
>=20
> --- In l...@yahoogroups.com, "geejee_lpc"
wrote:
> >
> > See if this works...
> > Regards,
> > Gertjan
> >=20
> >=20
> > unsigned char *calc_crc32(unsigned char *memory,unsigned int=20
> length)
> > {
> > #define LPC900_POLY_0 0x07
> > #define LPC900_POLY_1 0x00
> > #define LPC900_POLY_2 0x40
> > #define LPC900_POLY_3 0x00
> >=20
> > static unsigned char retstr[9];
> > unsigned char crc32[4];
> > unsigned char overflow;
> > unsigned int n;
> >=20
> > //Clear buffer
> > for(n=3D0;n<4;n++) {
> > crc32[n]=3D0x00;
> > }
> >=20
> > for(n=3D0;n
> > //Shift left CRC
> > overflow=3Dcrc32[3] & 0x80;
> > crc32[3]<<=3D1;
> > if(crc32[2] & 0x80) crc32[3]++;
> > crc32[2]<<=3D1;
> > if(crc32[1] & 0x80) crc32[2]++;
> > crc32[1]<<=3D1;
> > if(crc32[0] & 0x80) crc32[1]++;
> > crc32[0]<<=3D1;
> >=20
> > //EXOR data into CRC
> > if(memory[n] & 0x01) crc32[0]^=3D0x01;
> > if(memory[n] & 0x02) crc32[0]^=3D0x08;
> > if(memory[n] & 0x04) crc32[0]^=3D0x20;
> > if(memory[n] & 0x08) crc32[1]^=3D0x01;
> > if(memory[n] & 0x10) crc32[1]^=3D0x04;
> > if(memory[n] & 0x20) crc32[1]^=3D0x20;
> > if(memory[n] & 0x40) crc32[2]^=3D0x01;
> > if(memory[n] & 0x80) crc32[2]^=3D0x04;
> >=20
> > //EXOR lpc900 poly into CRC
> > if(overflow) {
> > crc32[0]^=3DLPC900_POLY_0;
> > crc32[1]^=3DLPC900_POLY_1;
> > crc32[2]^=3DLPC900_POLY_2;
> > crc32[3]^=3DLPC900_POLY_3;
> > }
> > }
> >=20
> > sprintf(retstr,"%02X%02X%02X%02X",crc32[3],crc32[2],crc32
> [1],crc32
> > [0]);
> > return(retstr);
> > }
> >=20
> >=20
>=20
>=20
>=20
>=20
>=20
>=20
> =20
>=20
>=20=20
>
=20

(You need to be a member of LPC900_users -- send a blank email to LPC900_users-subscribe@yahoogroups.com )Re: LPC2000 to LPC91x ICP driver... - =?iso-8859-1?q?Carsten_Gr=F8n?= - Jun 28 18:01:42 2006
Hi Eric,
It turns out that the code from Gertjan works ok :o)
The code is working perfect now, there were in fact two problems in=20
my code/system:
1) The "patched" bytes needs to be 0x00 not 0xFF !
2) The "BIN2C" program I got from somewhere on the 'net added the=20
last byte twice at the end of the C array !
I changed Gertjan's code a little to take the padding into account:
(that way I can present the routine with the memory and the length=20
of the memory, together with the "total" size of the memory, the=20
routine will then pad the data up until 'total_length'.
Thanks for all you help !
//-------------------------------------------------------------------
----------
// calculate_crc()
// Calculates the CRC of a chunk of memory the same way as the=20
LPC9x devices does.
// Input:
// buffer: memory to calculate CRC from
// length: number of bytes in 'buffer'
// total_length: the calculation will pad from 'length'=20
to 'total_length' with 0x00 bytes
// F.ex if the 'length' is 0x123 and the total=20
memory size of the LPC9x device
// is 2 KB, then specify length=3D0x123 and=20
total_length=3D0x800
//-------------------------------------------------------------------
----------
unsigned int calculate_crc(unsigned char *buffer, int length, int=20
total_length) {
#define LPC900_POLY_0 0x07
#define LPC900_POLY_1 0x00
#define LPC900_POLY_2 0x40
#define LPC900_POLY_3 0x00
unsigned char crc32[4];
unsigned char overflow, value;
unsigned int n;
//Clear buffer
for(n=3D0;n<4;n++) {
crc32[n]=3D0x00;
}
for(n=3D0;n
//Shift left CRC
overflow=3Dcrc32[3] & 0x80;
crc32[3]<<=3D1;
if(crc32[2] & 0x80) crc32[3]++;
crc32[2]<<=3D1;
if(crc32[1] & 0x80) crc32[2]++;
crc32[1]<<=3D1;
if(crc32[0] & 0x80) crc32[1]++;
crc32[0]<<=3D1;
// If we still have valid data in the buffer..
if (n
value=3Dbuffer[n]; // ..use the data from the buffer
else
value=3D0; // ..no more data in the buffer, pad with '0'
//EXOR data into CRC
if(value & 0x01) crc32[0]^=3D0x01;
if(value & 0x02) crc32[0]^=3D0x08;
if(value & 0x04) crc32[0]^=3D0x20;
if(value & 0x08) crc32[1]^=3D0x01;
if(value & 0x10) crc32[1]^=3D0x04;
if(value & 0x20) crc32[1]^=3D0x20;
if(value & 0x40) crc32[2]^=3D0x01;
if(value & 0x80) crc32[2]^=3D0x04;
=20=20=20=20
//EXOR lpc900 poly into CRC
if(overflow) {
crc32[0]^=3DLPC900_POLY_0;
crc32[1]^=3DLPC900_POLY_1;
crc32[2]^=3DLPC900_POLY_2;
crc32[3]^=3DLPC900_POLY_3;
}
}
return (crc32[3]<<24) | (crc32[2]<<16) | (crc32[1]<<8) | (crc32
[0]);
}
Regards,
Carsten
--- In l...@yahoogroups.com, Eric Rullens
=20
wrote:
>
> Carsten,
>=20
> Try presetting the buffer to 0, not 255...
>=20
> If that doesn't work I'll fire up some tools over here (time=20
permitting).
>=20
> Eric
>=20
> > -----Oorspronkelijk bericht-----
> > Van: Carsten Gr=F8n [mailto:cgroen@...]
> > Verzonden: woensdag 28 juni 2006 20:22
> > Aan: l...@yahoogroups.com
> > Onderwerp: [lpc900_users] Re: LPC2000 to LPC91x ICP driver...
> >=20
> >
=20
=20
=20

(You need to be a member of LPC900_users -- send a blank email to LPC900_users-subscribe@yahoogroups.com )How to protect flash from getting erased accidentally - mithilesh singh - Jul 8 12:08:40 2006
Hi All,
I m developing a sytem using P89LPC936. One issue which i faced was that my
micro-controller gets earsed sometimes. I have to re-program it. I have used a capacitor
at Vcc to bypass the glicth. Can anyone plz help me on this?
Mithilesh
---------------------------------
Yahoo! Music Unlimited - Access over 1 million songs.Try it free.

(You need to be a member of LPC900_users -- send a blank email to LPC900_users-subscribe@yahoogroups.com )