Reply by rtstofer November 16, 20062006-11-16
--- In l..., "Greg Esmond" wrote:
>
> I'm working on a project using an LPC2129 (IAR / Olimex kit), and I
need to store some variables in non-volatile memory. I've looked
through the documentation, but can't find what I'm looking for. Any
suggestions?
>
> Thanks,
> Greg
>
>

Why not just hang an I2C bus EEPROM on the system. Simple to
integrate and doesn't require keeping the system powered. They're
available in a fairly small 8 pin pkg. Atmel 24C256 comes to mind.

Richard

An Engineer's Guide to the LPC2100 Series

Reply by Michael Anton November 16, 20062006-11-16
> -----Original Message-----
> From: l...
> [mailto:l...]On Behalf
> Of Greg Esmond
> Sent: Thursday, November 16, 2006 6:18 PM
> To: l...
> Subject: RE: [lpc2000] Storing variable data in FLASH
> WOW! What a PITA! The data that I need to store is
> variable, so I don't see how I can declare them as constants.
> I just want to keep the values of some variables alive while
> the power is off. Is there a way to preserve the RAM with a battery?
>
> My application is a piggy-back automotive ECU that adjusts
> air / fuel ratio. These adjustments only change slightly
> between driving cycles, and I can't run the car battery dead
> by powering the MCU when the car is turned off.
>
> Thanks,
> Greg
>

If you can handle keeping the MPU powered, but stop the clocks,
you may be surprised at how little power is required. I feed one
of my LPC2148 designs using a low Iq switcher, and the stop mode
current from 12V is around 300uA (which would not be a problem for
an automotive system). RAM will be preserved in this mode.

Mike
Reply by Greg Esmond November 16, 20062006-11-16
WOW! What a PITA! The data that I need to store is variable, so I don't see how I can declare them as constants. I just want to keep the values of some variables alive while the power is off. Is there a way to preserve the RAM with a battery?

My application is a piggy-back automotive ECU that adjusts air / fuel ratio. These adjustments only change slightly between driving cycles, and I can't run the car battery dead by powering the MCU when the car is turned off.

Thanks,
Greg
Reply by mfra...@governors-america.com November 16, 20062006-11-16
Tom,
I must be missing something...I tried this and I keep getting "scalar
initializer is not a constant" error! Any ideas?
Thanks,
Mike
Reply by Saurabh Pandya November 16, 20062006-11-16
I have done this using IAP protocols.
Way of using IAP is differ from controller 2 controller.
In common with LPC-nxp.

To use IAP. [First I will suggest 2 see IAP documentation of your
controller]

Make Two Tables in RAM, among which first one contain list of arguments
and another
will catch returned satus codes.

After Creating tables, Call on-chip IAP routines either by pointer or by
function.

There are various on-chip IAP routines in LPC that allows you to erase
sector, copy RAM data to Flash
Unlock sector for write operation etc. These commands have unique command ID
, that you need to give
as argument with function call.
On 11/15/06, Greg Esmond wrote:
>
> I'm working on a project using an LPC2129 (IAR / Olimex kit), and I need
> to store some variables in non-volatile memory. I've looked through the
> documentation, but can't find what I'm looking for. Any suggestions?
>
> Thanks,
> Greg
>
>
>
Reply by November 16, 20062006-11-16
Greg,
I earlier wrote about using IAP in the LPC devices to store variables
in non-volatile memory, at that point I assumed you had the need to
store variables "once in a while" in non-volatile memory (setable
parameters etc)... If it is indeed just "constants" I think that most
of the tools will do just that if you (as Tom suggests) just declare
them as "const". This works at least in Keil (RealView), they are
automatically placed in FLASH.

Regards,
Carsten

--- In l..., Tom Walsh wrote:
>
> Greg Esmond wrote:
> >
> > I'm working on a project using an LPC2129 (IAR / Olimex kit), and
I
> > need to store some variables in non-volatile memory. I've looked
> > through the documentation, but can't find what I'm looking for.
Any
> > suggestions?
> >
> Not sure about IAR, but in gcc I would cast those data vars
a 'const'.
> Making them a const will keep them in Flash, for example:
> const struct FCI7100LOOKUPS Fci7100Lookups [] = {
> { 0, 0, " ", 0, 0 }, /* placeholder */
> { ctTrouble, 0, "AC FLT TO ", bTROUBLE, 0 },
> { ctTrouble, 0, "AC FLT TO RSTRD ", bTROUBLE,
bEVENT_RESTORE },
> { ctTrouble, 0, "ACCESS ", bPANELMSG, C4_GENERAL },
> { ctTrouble, 0, "ACCESS RSTRD ", bPANELMSG, C4_GENERAL },
> { ctAction, 0, "ACTION ", bSUPERVISORY, 0 },
> { ctAction, 0, "ACTION RSTRD ", bSUPERVISORY,
bEVENT_RESTORE },
> ...
> };
> --
> Tom Walsh - WN3L - Embedded Systems Consultant
> http://openhardware.net http://cyberiansoftware.com
http://openzipit.org
> "Windows? No thanks, I have work to do..."
> ----------------
>
Reply by Tom Walsh November 16, 20062006-11-16
Greg Esmond wrote:
>
> I'm working on a project using an LPC2129 (IAR / Olimex kit), and I
> need to store some variables in non-volatile memory. I've looked
> through the documentation, but can't find what I'm looking for. Any
> suggestions?
>
Not sure about IAR, but in gcc I would cast those data vars a 'const'.
Making them a const will keep them in Flash, for example:
const struct FCI7100LOOKUPS Fci7100Lookups [] = {
{ 0, 0, " ", 0, 0 }, /* placeholder */
{ ctTrouble, 0, "AC FLT TO ", bTROUBLE, 0 },
{ ctTrouble, 0, "AC FLT TO RSTRD ", bTROUBLE, bEVENT_RESTORE },
{ ctTrouble, 0, "ACCESS ", bPANELMSG, C4_GENERAL },
{ ctTrouble, 0, "ACCESS RSTRD ", bPANELMSG, C4_GENERAL },
{ ctAction, 0, "ACTION ", bSUPERVISORY, 0 },
{ ctAction, 0, "ACTION RSTRD ", bSUPERVISORY, bEVENT_RESTORE },
...
};
--
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net http://cyberiansoftware.com http://openzipit.org
"Windows? No thanks, I have work to do..."
----------------
Reply by Murtaza Karim November 15, 20062006-11-15
Hello Carsten,

I am also looking for a way to store variables in FLASH but I am using
external flash, and on the same flash device, I am also storing code. My
controller (LPC2220) does not have internal flash. Is it possible, or does
anyone have any experience on this?

-------------------------
Murtaza M. Karim
Embedded Systems Engineer
Arlyn Scales, Inc.
59 2nd Street,
East Rockaway, NY 11518
Tel: (516) 593-4301 ext. 104
Email: K...@ArlynScales.com
Web: http://www.arlynscales.com
Reply by November 15, 20062006-11-15
Mike (and Greg)

I think you will need to implement the IAP protocol, this will allow
you to save a chunk of memory to the FLASH memory of the device.
There have been numerous articles on this group about the usage of
the IAP (I also think there is something in the files section)
If everything else fails, I have the code running here for Keil
(RealView).

Regards,
Carsten
--- In l..., mfrazier@... wrote:
>
> I am looking for the same thing, but I'm using Keil...I'll let you
know if
> I get lucky.
>
> Thanks,
> Mike
>
>
>
Reply by mfra...@governors-america.com November 15, 20062006-11-15
I am looking for the same thing, but I'm using Keil...I'll let you know if
I get lucky.

Thanks,
Mike