Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Subject: Using flash memory instead of eeprom?

Subject: Using flash memory instead of eeprom?

2005-01-31 by Owen Mooney

Yes I have. Its easy, but you have to use up a whole page (unless you read - modify - write) I had lots of spare flash and was typically saving a configuration just a few times so these limitations didn't matter.

Code using IAP instructions below.

Accessing the stored structure is just a direct memory access.

The write cycle limitations have been well documented by those willing to offer an opinion but not answer your question !!!

Owen Mooney

#define IAP_LOCATION 0x7ffffff1

void savesetup(struct SETUP *setup){
   typedef void (*IAP)(unsigned int [],unsigned int[]);
   unsigned int command[5];
   unsigned int result[2];
   IAP iap_entry;
   __ARMLIB_disableIRQ();
   iap_entry=(IAP) IAP_LOCATION;
   // get part ID
   command[0]=54;
   result[0]=0;
   iap_entry(command, result);
   // result in result[1] 
   // prepare to erase
   command[0]=50;
   command[1]=14;
   command[2]=14;
   iap_entry(command, result);
   if (result[0] != 0) goto error;
   // erase
   command[0]=52;
   command[1]=14;
   command[2]=14;
   command[3]=14745;
   iap_entry(command, result);
   if (result[0] != 0) goto error;
   // prepare to program
   iap_entry=(IAP) IAP_LOCATION;
   command[0]=50;
   command[1]=14;
   command[2]=14;
   iap_entry(command, result);
   if (result[0] != 0) goto error;
   //  program
   command[0]=51;
   command[1]=0x1C000;
   command[2]=(int)setup;
   command[3]=512;
   command[4]=14745;
   iap_entry(command, result);
   if (result[0] != 0) goto error;
   __ARMLIB_enableIRQ();
   return;
   error:
   __ARMLIB_enableIRQ();
   printf("bum");
}


Hi!

Has someone used the flash memory of the lpc21xx for eeprom purposes?
Or is it more usefull to take an additive eeprom to the design? I only
want to store some parameters.

Thank you for feedback!
Martin





____________

Re: Subject: Using flash memory instead of eeprom?

2005-02-01 by gewitter2000

Hi Owen,

Yes, this helps a lot.
Thank you!

Martin

--- In lpc2000@yahoogroups.com, Owen Mooney <ojm@s...> wrote:
> Yes I have. Its easy, but you have to use up a whole page (unless
you read - modify - write) I had lots of spare flash and was typically
saving a configuration just a few times so these limitations didn't
matter.
> 
> Code using IAP instructions below.
> 
> Accessing the stored structure is just a direct memory access.
> 
> The write cycle limitations have been well documented by those
willing to offer an opinion but not answer your question !!!
Show quoted textHide quoted text
> 
> Owen Mooney
> 
> #define IAP_LOCATION 0x7ffffff1
> 
> void savesetup(struct SETUP *setup){
>    typedef void (*IAP)(unsigned int [],unsigned int[]);
>    unsigned int command[5];
>    unsigned int result[2];
>    IAP iap_entry;
>    __ARMLIB_disableIRQ();
>    iap_entry=(IAP) IAP_LOCATION;
>    // get part ID
>    command[0]=54;
>    result[0]=0;
>    iap_entry(command, result);
>    // result in result[1] 
>    // prepare to erase
>    command[0]=50;
>    command[1]=14;
>    command[2]=14;
>    iap_entry(command, result);
>    if (result[0] != 0) goto error;
>    // erase
>    command[0]=52;
>    command[1]=14;
>    command[2]=14;
>    command[3]=14745;
>    iap_entry(command, result);
>    if (result[0] != 0) goto error;
>    // prepare to program
>    iap_entry=(IAP) IAP_LOCATION;
>    command[0]=50;
>    command[1]=14;
>    command[2]=14;
>    iap_entry(command, result);
>    if (result[0] != 0) goto error;
>    //  program
>    command[0]=51;
>    command[1]=0x1C000;
>    command[2]=(int)setup;
>    command[3]=512;
>    command[4]=14745;
>    iap_entry(command, result);
>    if (result[0] != 0) goto error;
>    __ARMLIB_enableIRQ();
>    return;
>    error:
>    __ARMLIB_enableIRQ();
>    printf("bum");
> }
> 
> 
> Hi!
> 
> Has someone used the flash memory of the lpc21xx for eeprom purposes?
> Or is it more usefull to take an additive eeprom to the design? I only
> want to store some parameters.
> 
> Thank you for feedback!
> Martin
> 
> 
> 
> 
> 
> ____________

Re: [lpc2000] Re: Subject: Using flash memory instead of eeprom?

2005-02-01 by microbit

Hi Owen / Martin,

Maybe it's also worth to point out that you can emulate EEPROM closer
by "spreading" the data in Flash, and leaving markers - although I'm not
sure with the sector sizes involved, it would have to be large amounts to
make it worth.
If you have plenty spare Flash, you can get closer to EEPROM by typically
using 4-8 times the amount of Flash, and emulate EEPROM like that.
(ie. for 4 K EEPROM you'd need at least 16K Flash)
If you need further info, send me a direct Email.

Cheers,
Kris


> --- In lpc2000@yahoogroups.com, Owen Mooney <ojm@s...> wrote:
> > Yes I have. Its easy, but you have to use up a whole page (unless
> you read - modify - write) I had lots of spare flash and was typically
> saving a configuration just a few times so these limitations didn't
> matter.
> >
> > Code using IAP instructions below.
> >
> > Accessing the stored structure is just a direct memory access.
> >
> > The write cycle limitations have been well documented by those
> willing to offer an opinion but not answer your question !!!
> >
> > Owen Mooney
> >
> > #define IAP_LOCATION 0x7ffffff1
> >
> > void savesetup(struct SETUP *setup){
> >    typedef void (*IAP)(unsigned int [],unsigned int[]);
> >    unsigned int command[5];
> >    unsigned int result[2];
> >    IAP iap_entry;
> >    __ARMLIB_disableIRQ();
> >    iap_entry=(IAP) IAP_LOCATION;
> >    // get part ID
> >    command[0]=54;
> >    result[0]=0;
> >    iap_entry(command, result);
> >    // result in result[1]
> >    // prepare to erase
> >    command[0]=50;
> >    command[1]=14;
> >    command[2]=14;
> >    iap_entry(command, result);
> >    if (result[0] != 0) goto error;
> >    // erase
> >    command[0]=52;
> >    command[1]=14;
> >    command[2]=14;
> >    command[3]=14745;
> >    iap_entry(command, result);
> >    if (result[0] != 0) goto error;
> >    // prepare to program
> >    iap_entry=(IAP) IAP_LOCATION;
> >    command[0]=50;
> >    command[1]=14;
> >    command[2]=14;
> >    iap_entry(command, result);
> >    if (result[0] != 0) goto error;
> >    //  program
> >    command[0]=51;
> >    command[1]=0x1C000;
> >    command[2]=(int)setup;
> >    command[3]=512;
> >    command[4]=14745;
> >    iap_entry(command, result);
> >    if (result[0] != 0) goto error;
> >    __ARMLIB_enableIRQ();
> >    return;
> >    error:
> >    __ARMLIB_enableIRQ();
> >    printf("bum");
> > }
> >
> >
> > Hi!
> >
> > Has someone used the flash memory of the lpc21xx for eeprom purposes?
> > Or is it more usefull to take an additive eeprom to the design? I only
> > want to store some parameters.
> >
> > Thank you for feedback!
> > Martin
> >
> >
> >
> >
> >
> > ____________
>
>
>
>
>
> --------------------------------------------------------------------------
------
Show quoted textHide quoted text
> Yahoo! Groups Links
>
>   a.. To visit your group on the web, go to:
>   http://groups.yahoo.com/group/lpc2000/
>
>   b.. To unsubscribe from this group, send an email to:
>   lpc2000-unsubscribe@yahoogroups.com
>
>   c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.