EmbeddedRelated.com
Forums

LPC2368 Read/Write flash memory during operation

Started by jp_qlomolr May 30, 2007
Hello, experts.

I'd like to ask a question.
LPC2368 has 512kb flash memory (sectors are from 0 to 27, total 28).
I'd like to use the sector between 18 and 21, these total size is
32kbyte x 4 sectors = 128kbytes for saving data.

for example, when the end user pushs the button, all the configuration
data is saved into LPC2368's flash memory.

Also, I'd like to read data from this area during my code is running.

for example, when the device turn on, device read the configuration
data from LPC2368's flash memory.

* my program code size is about 30-40kbytes max. so program code will
occupy from sector 0 to sector 8.

IAP function may help this, I think.
But I cannot find out that sample source code.
Any helps will be greatly appreciated.
Thank you.

Kind Regards.
Tetsuro

An Engineer's Guide to the LPC2100 Series

Hi

I'm intersting for the same use and I have the same problem with LPC
2292 (256kB).

If I solve problem I help you, if you have some information or
example can send me?

Thanks

Fabio

--- In l..., "jp_qlomolr" wrote:
>
> Hello, experts.
>
> I'd like to ask a question.
> LPC2368 has 512kb flash memory (sectors are from 0 to 27, total 28).
> I'd like to use the sector between 18 and 21, these total size is
> 32kbyte x 4 sectors = 128kbytes for saving data.
>
> for example, when the end user pushs the button, all the
configuration
> data is saved into LPC2368's flash memory.
>
> Also, I'd like to read data from this area during my code is
running.
>
> for example, when the device turn on, device read the configuration
> data from LPC2368's flash memory.
>
> * my program code size is about 30-40kbytes max. so program code
will
> occupy from sector 0 to sector 8.
>
> IAP function may help this, I think.
> But I cannot find out that sample source code.
> Any helps will be greatly appreciated.
> Thank you.
>
> Kind Regards.
> Tetsuro
>
HI, Fabio.
Actually say, I can do this.
I'm using Keil uVision3. and it's including that appropriate code.

If you are using same one, see your folder below:
keil\arm\flash\LPC_IAP2_256
( for me, keil\arm\flash\LPC_IAP2_512 )

that folder includes below:
IAP.S: IAP Execution Function
FlashDev.C: Device Description for Philips LPC2xxx 256kB Flash
FlashPrg.C: Flash Programming Functions adapted

And also go to keil\arm\flash\LPC_IAP2_256, you will find below:
FlashOS.H: Data structures and entries

My main() function has below:

unsigned char buf[256];
Init(0x00058000,4000000,2);
ProgramPage(0x00058000, 256 , buf);

* 0x00058000 is sector 18 head address for LPC2368.

and, for reading from memory, below:

unsigned char *flashdata;
flashdata = (unsigned char *)0x00058000;
Kind Regards.
Tetsuro

--- In l..., "fabicenn" wrote:
>
> Hi
>
> I'm intersting for the same use and I have the same problem with LPC
> 2292 (256kB).
>
> If I solve problem I help you, if you have some information or
> example can send me?
>
> Thanks
>
> Fabio
>
> --- In l..., "jp_qlomolr" wrote:
> >
> > Hello, experts.
> >
> > I'd like to ask a question.
> > LPC2368 has 512kb flash memory (sectors are from 0 to 27, total 28).
> > I'd like to use the sector between 18 and 21, these total size is
> > 32kbyte x 4 sectors = 128kbytes for saving data.
> >
> > for example, when the end user pushs the button, all the
> configuration
> > data is saved into LPC2368's flash memory.
> >
> > Also, I'd like to read data from this area during my code is
> running.
> >
> > for example, when the device turn on, device read the configuration
> > data from LPC2368's flash memory.
> >
> > * my program code size is about 30-40kbytes max. so program code
> will
> > occupy from sector 0 to sector 8.
> >
> > IAP function may help this, I think.
> > But I cannot find out that sample source code.
> >
> >
> > Any helps will be greatly appreciated.
> > Thank you.
> >
> > Kind Regards.
> > Tetsuro
>
Thanks
I ignored that program

Thanks now I try

Fabio

--- In l..., "jp_qlomolr" wrote:
>
> HI, Fabio.
> Actually say, I can do this.
> I'm using Keil uVision3. and it's including that appropriate code.
>
> If you are using same one, see your folder below:
> keil\arm\flash\LPC_IAP2_256
> ( for me, keil\arm\flash\LPC_IAP2_512 )
>
> that folder includes below:
> IAP.S: IAP Execution Function
> FlashDev.C: Device Description for Philips LPC2xxx 256kB Flash
> FlashPrg.C: Flash Programming Functions adapted
>
> And also go to keil\arm\flash\LPC_IAP2_256, you will find below:
> FlashOS.H: Data structures and entries
>
> My main() function has below:
>
> unsigned char buf[256];
> Init(0x00058000,4000000,2);
> ProgramPage(0x00058000, 256 , buf);
>
> * 0x00058000 is sector 18 head address for LPC2368.
>
> and, for reading from memory, below:
>
> unsigned char *flashdata;
> flashdata = (unsigned char *)0x00058000;
> Kind Regards.
> Tetsuro
>
> --- In l..., "fabicenn" wrote:
> >
> > Hi
> >
> > I'm intersting for the same use and I have the same problem with
LPC
> > 2292 (256kB).
> >
> > If I solve problem I help you, if you have some information or
> > example can send me?
> >
> > Thanks
> >
> > Fabio
> >
> > --- In l..., "jp_qlomolr" wrote:
> > >
> > > Hello, experts.
> > >
> > > I'd like to ask a question.
> > > LPC2368 has 512kb flash memory (sectors are from 0 to 27, total
28).
> > > I'd like to use the sector between 18 and 21, these total size
is
> > > 32kbyte x 4 sectors = 128kbytes for saving data.
> > >
> > > for example, when the end user pushs the button, all the
> > configuration
> > > data is saved into LPC2368's flash memory.
> > >
> > > Also, I'd like to read data from this area during my code is
> > running.
> > >
> > > for example, when the device turn on, device read the
configuration
> > > data from LPC2368's flash memory.
> > >
> > > * my program code size is about 30-40kbytes max. so program
code
> > will
> > > occupy from sector 0 to sector 8.
> > >
> > > IAP function may help this, I think.
> > > But I cannot find out that sample source code.
> > >
> > >
> > > Any helps will be greatly appreciated.
> > > Thank you.
> > >
> > > Kind Regards.
> > > Tetsuro
> > >
>