LPC1549 EEPROM update time

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1549 EEPROM update time

660 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by EtaPhi on Thu Feb 12 07:44:29 MST 2015
Hello,
I want to implement "persistent" variables which keep their value even if power is switched off.
The C language doesn't define this kind of variables, but it's easy to add their management.
The macro persistent extends C syntax as follows:

#define persistent __attribute__ ((section(".nvram")))


A persistent variable definition becomes:

persistent unsigned int SomeVariable = 1
;

When the C compiler processes this definition, it reserves four bytes in the "nvram" section and saves SomeVariable initial value so that the startup code can initialize it.
The persistent macro can also used with other storage attributes, such as "volatile", "const", "static", "register" etc. For istance,

persistent volatile int Variable = 2;


is a valid statement (it also explains why the macro name isn't "nonvolatile")

The "nvram" section size is fixed.
"nvram" size should be a multiple of 64 bytes which is LPC15xx EEPROM page size.
It must also be smaller than 1984 bytes because the upper 64 bytes of EEPROM are reserved and because EEPROM must store two copies: the startup one and the shutdown one.

The startup code use a copy to restore the previous values, while the BOD (Brown Out Detector) interrupt updates the shutdown copy.
Some precautions must be taken to recognize a valid startup copy, but they don't matter for this post, which deals with the shutdown copy update.

It seems that only the ROM API can write or read LPC15xx EEPROM, even if it's mapped from 0x0320000 to 0x03200FFF and it's connected to AHB Matrix.
Perhaps LPC15xx EEPROM can't be read or written at AHB maximum speed, so AHB must be slowed to 12 MHz or less by using SYSAHBCLKDIV register.
This isn't a issue for BOD interrupt handler, because LPC1549 is "dying" when it's executed and no other code must run.

The time it takes to erase some pages and to update their data is the issue!

LPC15xx Datasheet says that it typically takes 2.9 ms to write 64 bytes.
It doesn't say if EEPROM update time increases linearly as the number of 64 bytes to write.
It doesn't say if a previous bulk erase may shorten update time.
UM10736 doesn't explain EEPROM CTRL registers and it doesn't say if it's possible to access EEPROM data without ROM API.

I need these infos to check if the bulk capacitor has enough energy to finish EEPROM update in the WORST CASE.

Is here someone who can help me?

EtaPhi
Labels (1)
0 Kudos
1 Reply

483 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xianghuiwang on Thu Apr 02 10:14:24 MST 2015
Hi, EtaPhi,
For LPC1500, IAP is only operating at 12MHz. Other NXP parts like LPC5410x can use variable IAP frequency. There is an error in the UM of LPC1500 in this regard, we will correct it.
For flash, a bulk erase will help in the write time through put. I do not believe this can be done for EEPROM as an erase has to be done right before write. I will double check on this.
regards,

0 Kudos