We have just experienced some problems with MCB2130 board and
uVision3 in regard to the EEPROM demo similar to what you had
reported. However, we have verified that the EE_demo code itself is
working as expected. This is how we have modified the EE_demo.c file
in order to bypass the uVision3 environment and verify sw validity:
1) add a new variable in the main():
volatile unsigned int _debug_count;
2) add the following code in front of the initial EEPROM erase
section:
IODIR1 = 0x00FF0000;
IOCLR1 = 0x00FF0000;
ee_count(command_ee,response_ee);
status = response_ee[0];
_debug_count = response_ee[1];
IOSET1 = (_debug_count & 0x000000FF) << 16;
3) EEPROM erase at the end of the EE_demo.c embed into the following
code:
if((IOPIN0 & 0x00008000)==0x00000000){
ee_erase(command_ee,response_ee);
status = response_ee[0];
}
This code reads the number of valid records in the EEPROM before
anything else is executed in the main() and puts the 8-bit readout
on pins P1.23:16. If P0.15=0, the EEPROM will be erased before the
infinite loop while(1) is entered. If P0.15=1, the EEPROM will not
be erased at the end of demo.
Create EE_demo.hex corresponding to the modified EE_demo.c file.
Then, after you completely erase the LPC213x flash, using the
Philips LPC2000 Flash Utility, load this hex file into the LPC213x
flash (do not forget to select "Vector Calc" option once you
load
the EE_demo.hex file and before you click "Upload to Flash").
Here is what you should do after you upload EE_demo into the micro:
a) power down your board, connect P0.15 to the ground, and power up
the board. After this you will see P1.23:16=0x00;
b) connect P0.15 to 3.3V, reset the board and you will still see
P1.23:16=0x00; however, if you reset the board again, P1.23:16=0x0B.
Once you change the P0.15 level, it takes two resets to get the
valid P1.23:16 output.
This proves that the ee_count() function works as specified. It
seems that there might be some problem within the sw/hw environment
(uVision3). We will try to resolve this in the following days.
Regards,
Philips Apps Team
--- In lpc2000@yahoogroups.com, "ashuvighne" <ashu.vighne@w...>
wrote:
> --- In lpc2000@yahoogroups.com, "philips_apps" <philips_apps@y...>
> wrote:
> > Hello all,
> >
> > We have just uploaded EE_demo.zip in the Files section of the
> group.
> > When unzipped, EE_demo folder with EE_demo.uv2 project developed
> in
> > Keil's uVision3 environment is created.
> >
> > Here you will find a demo code developed for LPC2138 that shows
> how
> > to configure and use microcontroller's on-chip Flash as EEPROM
> > memory. The code is written in C and provides EEPROM erase,
write
> > single entry, read last entry, read the n-th entry, and count
> > entries functions.
> >
> > Details on the software implementation can be found in
EE_demo.txt
> > and EE_setup.txt files in the Documentation section of the
project.
> >
> > Although the project was developed for LPC2138 device, the code
> can
> > be easily modified and ported to other LPC2000 microcontrollers.
> >
> > Regards,
> >
> > Philips Apps Team
>
> Hi:
>
> While trying to use this ee_demo project (using Keil uV3 and Keil
> MCB2130 board).
> Noticed -
> - all works well as is, I mean when tried running the project
> without any chnages.
> - however, when only "ee_count()" is called from main(), following
> a reset. Which was to test/ verify whether or not the Flash
> contents are retained.
> The count (in fact both response_ee[0] and [1]) returned 0!
> I was expecting response_ee[1] to be 0x0B as it showed with
> unchanged ee_demo execution.
>
> Is the flash area, which is supposed to be "reserved" being
stepped Show quoted textHide quoted text
> over or reinitialized somehow. Any known cures for this issue?
>
> Any help, suggestions in this regard will be greatly appreciated.
>
> Thanks;