bulk erasing eeprom

Started by Anish May 23, 2003
Hi I am trying to bulk erase the 768 Byte EEPROM in 6812b32. I have
written an assembly code for erasing it. I can see thru the debugger
that when my code executes the eeprom is erased and all contents are
FF but when I reset my processor then eeprom contains my previous
data.

Can any one suggest what I can do for permenantly erasing the eeprom.

Anish



Anish

Perhaps if you shouw us your setup and code we could offefr some
suggestions.
Regards
Dave Perreault Anish wrote:

>Hi I am trying to bulk erase the 768 Byte EEPROM in 6812b32. I have
>written an assembly code for erasing it. I can see thru the debugger
>that when my code executes the eeprom is erased and all contents are
>FF but when I reset my processor then eeprom contains my previous
>data.
>
>Can any one suggest what I can do for permenantly erasing the eeprom.
>
>Anish >
>-------------------- >
>">http://docs.yahoo.com/info/terms/



I am using the following code. I

void bulk_erase_eeprom(void)
{
int orig_eeprot,orig_eeprog,i;

orig_eeprot = EEPROT;
orig_eeprog = EEPROG;
EEPROT = 128; /*128 = 80H = 10000000 set all eeprom blocks to be
erased*/
EEPROG = 0; /*clear all bits in eeprog*/
EEPROG = 6; /*set 1stand 2nd bit*/
EEPROG = 7; /*turn on programming voltage */

while (i<100)
i++; /*give some delay*/

EEPROG &= ~(1<<0); /*turn off programming voltage*/
EEPROG &= ~(1<<1);

EEPROG = orig_eeprog;
EEPROT = orig_eeprot;

}

When my program comes to the last two line it restore what was there
previoulsy in the eeprom. my eeprom starts from 0D00-0FFF. Also I
would like to know how to remap my epprom to a different location.

Thanks

Anish
--- In , Dave Perreault <briggsroad@c...> wrote:
> Anish
>
> Perhaps if you shouw us your setup and code we could offefr some
> suggestions.
> Regards
> Dave Perreault > Anish wrote:
>
> >Hi I am trying to bulk erase the 768 Byte EEPROM in 6812b32. I
have
> >written an assembly code for erasing it. I can see thru the
debugger
> >that when my code executes the eeprom is erased and all contents
are
> >FF but when I reset my processor then eeprom contains my previous
> >data.
> >
> >Can any one suggest what I can do for permenantly erasing the
eeprom.
> >
> >Anish
> >
> >
> >
> >--------------------
> >
> >
> >
> >">http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> >




Anish

Comments in your code in red.

Regards
Dave Perreault Anish wrote:

>I am using the following code. I
>
>void bulk_erase_eeprom(void)
> {
> int orig_eeprot,orig_eeprog,i;
>
> orig_eeprot = EEPROT;
> orig_eeprog = EEPROG;
> EEPROT = 128; /*128 = 80H = 10000000 set all eeprom blocks to be
>erased*/
> EEPROG = 0; /*clear all bits in eeprog*/
> EEPROG = 6; /*set 1stand 2nd bit*/
You need to write a word to the array at this point to latch the address,
$FFFF->address $D00 is ok

> EEPROG = 7; /*turn on programming voltage */
>
> while (i<100)
> i++; /*give some delay*/
>
> EEPROG &= ~(1<<0); /*turn off programming voltage*/
> EEPROG &= ~(1<<1);
>
The previous line should turn off the erase bit as well in order to
r4ead the array, i.e.
EEPROG &= ~(3<<1);

>
> EEPROG = orig_eeprog;
> EEPROT = orig_eeprot;
>
> }
>
>When my program comes to the last two line it restore what was there
>previoulsy in the eeprom. my eeprom starts from 0D00-0FFF. Also I
>would like to know how to remap my epprom to a different location.
>
>Thanks
>
>Anish >
>--- In , Dave Perreault <briggsroad@c...> wrote: >>Anish
>>
>>Perhaps if you shouw us your setup and code we could offefr some
>>suggestions.
>>Regards
>>Dave Perreault
>>
>>
>>Anish wrote:
>>
>>
>>
>>>Hi I am trying to bulk erase the 768 Byte EEPROM in 6812b32. I
>>>
>>>
>have >>>written an assembly code for erasing it. I can see thru the
>>>
>>>
>debugger >>>that when my code executes the eeprom is erased and all contents
>>>
>>>
>are >>>FF but when I reset my processor then eeprom contains my previous
>>>data.
>>>
>>>Can any one suggest what I can do for permenantly erasing the
>>>
>>>
>eeprom. >>>Anish
>>>
>>>
>>>
>>>--------------------
>>>
>>>
>>>
>>>">http://docs.yahoo.com/info/terms/ >>>
>>>
>>>
>>>
>> >
>-------------------- >
>">http://docs.yahoo.com/info/terms/


Anish

Three other things.

1. You need to turn on the external programming voltage approx. 12 volts.

2. If you are running a slow clock, you need to switch to the on chip RC
oscillator.

3. I have no way of checking if your delay is long enough since it is
clock frequency dependent.

Regards
Dave Perreault
Anish wrote:

>I am using the following code. I
>
>void bulk_erase_eeprom(void)
> {
> int orig_eeprot,orig_eeprog,i;
>
> orig_eeprot = EEPROT;
> orig_eeprog = EEPROG;
> EEPROT = 128; /*128 = 80H = 10000000 set all eeprom blocks to be
>erased*/
> EEPROG = 0; /*clear all bits in eeprog*/
> EEPROG = 6; /*set 1stand 2nd bit*/
> EEPROG = 7; /*turn on programming voltage */
>
> while (i<100)
> i++; /*give some delay*/
>
> EEPROG &= ~(1<<0); /*turn off programming voltage*/
> EEPROG &= ~(1<<1);
>
> EEPROG = orig_eeprog;
> EEPROT = orig_eeprot;
>
> }
>
>When my program comes to the last two line it restore what was there
>previoulsy in the eeprom. my eeprom starts from 0D00-0FFF. Also I
>would like to know how to remap my epprom to a different location.
>
>Thanks
>
>Anish >
>--- In , Dave Perreault <briggsroad@c...> wrote: >>Anish
>>
>>Perhaps if you shouw us your setup and code we could offefr some
>>suggestions.
>>Regards
>>Dave Perreault
>>
>>
>>Anish wrote:
>>
>>
>>
>>>Hi I am trying to bulk erase the 768 Byte EEPROM in 6812b32. I
>>>
>>>
>have >>>written an assembly code for erasing it. I can see thru the
>>>
>>>
>debugger >>>that when my code executes the eeprom is erased and all contents
>>>
>>>
>are >>>FF but when I reset my processor then eeprom contains my previous
>>>data.
>>>
>>>Can any one suggest what I can do for permenantly erasing the
>>>
>>>
>eeprom. >>>Anish
>>>
>>>
>>>
>>>--------------------
>>>
>>>
>>>
>>>">http://docs.yahoo.com/info/terms/ >>>
>>>
>>>
>>>
>> >
>-------------------- >
>">http://docs.yahoo.com/info/terms/



Thanks,

The EEPROM I am using is not the flash. I think that only the flash
requires external 12V for programming. For the internal EEPROM the
voltage is generated internally.

I can see that the EEPROM is being erased as the values are changed
to FF. But when I reset my processor the original values in the
EEPROM are restored.

Also a new problem when I write data to the EEPROM the first time it
writes fine but when I run the same program again and want my result
in the same location of EEPROM it stores some garbage value(not my
actual result).

I want to know what the problem is with the EEPROM. EEPROM have 10000
read/write cycles so I dont think that is the problem.

The first time it writes but after that it keeps on writing the same
garbage value in that location. Thanks
Anish
University of Alabama Birmingham
--- In , Dave Perreault <briggsroad@c...> wrote:
> Anish
>
> Three other things.
>
> 1. You need to turn on the external programming voltage approx. 12
volts.
>
> 2. If you are running a slow clock, you need to switch to the on
chip RC
> oscillator.
>
> 3. I have no way of checking if your delay is long enough since it
is
> clock frequency dependent.
>
> Regards
> Dave Perreault >
> Anish wrote:
>
> >I am using the following code. I
> >
> >void bulk_erase_eeprom(void)
> > {
> > int orig_eeprot,orig_eeprog,i;
> >
> > orig_eeprot = EEPROT;
> > orig_eeprog = EEPROG;
> > EEPROT = 128; /*128 = 80H = 10000000 set all eeprom blocks to
be
> >erased*/
> > EEPROG = 0; /*clear all bits in eeprog*/
> > EEPROG = 6; /*set 1stand 2nd bit*/
> > EEPROG = 7; /*turn on programming voltage */
> >
> > while (i<100)
> > i++; /*give some delay*/
> >
> > EEPROG &= ~(1<<0); /*turn off programming voltage*/
> > EEPROG &= ~(1<<1);
> >
> > EEPROG = orig_eeprog;
> > EEPROT = orig_eeprot;
> >
> > }
> >
> >When my program comes to the last two line it restore what was
there
> >previoulsy in the eeprom. my eeprom starts from 0D00-0FFF. Also I
> >would like to know how to remap my epprom to a different location.
> >
> >Thanks
> >
> >Anish
> >
> >
> >
> >
> >
> >
> >--- In , Dave Perreault <briggsroad@c...>
wrote:
> >
> >
> >>Anish
> >>
> >>Perhaps if you shouw us your setup and code we could offefr some
> >>suggestions.
> >>Regards
> >>Dave Perreault
> >>
> >>
> >>Anish wrote:
> >>
> >>
> >>
> >>>Hi I am trying to bulk erase the 768 Byte EEPROM in 6812b32. I
> >>>
> >>>
> >have
> >
> >
> >>>written an assembly code for erasing it. I can see thru the
> >>>
> >>>
> >debugger
> >
> >
> >>>that when my code executes the eeprom is erased and all contents
> >>>
> >>>
> >are
> >
> >
> >>>FF but when I reset my processor then eeprom contains my
previous
> >>>data.
> >>>
> >>>Can any one suggest what I can do for permenantly erasing the
> >>>
> >>>
> >eeprom.
> >
> >
> >>>Anish
> >>>
> >>>
> >>>
> >>>--------------------
> >>>
> >>>
> >>>
> >>>">http://docs.yahoo.com/info/terms/
> >
> >
> >>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >--------------------
> >
> >
> >
> >">http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> >
>





Anish,

The problem is most likely within your code, and not in the EEPROM.

However, if you suspect the EEPROM, you can try to program it using your
BDM tool.
If it programs well using you BDM tool, then it is you code that doesn't work.
If it doesn't program well using you BDM tool, then you know it is the
EEPROM that doesn't work.

Look in your code especially at the delays used to erase and program the
EEPROM.
Using too short delays will not erase or program the EEPROM, and using too
long delays may fry the EEPROM and make it un-usable.
It is very important to get the delays to within the specified range in the
Motorola data sheets.

Hope this helps,

Doron
Nohau Corporation
HC12 In-Circuit Emulators
www.nohau.com/emul12pc.html

At 08:20 PM 5/27/2003 +0000, you wrote:
>Thanks,
>
>The EEPROM I am using is not the flash. I think that only the flash
>requires external 12V for programming. For the internal EEPROM the
>voltage is generated internally.
>
>I can see that the EEPROM is being erased as the values are changed
>to FF. But when I reset my processor the original values in the
>EEPROM are restored.
>
>Also a new problem when I write data to the EEPROM the first time it
>writes fine but when I run the same program again and want my result
>in the same location of EEPROM it stores some garbage value(not my
>actual result).
>
>I want to know what the problem is with the EEPROM. EEPROM have 10000
>read/write cycles so I dont think that is the problem.
>
>The first time it writes but after that it keeps on writing the same
>garbage value in that location. >Thanks
>Anish
>University of Alabama Birmingham >
>--- In , Dave Perreault <briggsroad@c...> wrote:
> > Anish
> >
> > Three other things.
> >
> > 1. You need to turn on the external programming voltage approx. 12
>volts.
> >
> > 2. If you are running a slow clock, you need to switch to the on
>chip RC
> > oscillator.
> >
> > 3. I have no way of checking if your delay is long enough since it
>is
> > clock frequency dependent.
> >
> > Regards
> > Dave Perreault
> >
> >
> >
> > Anish wrote:
> >
> > >I am using the following code. I
> > >
> > >void bulk_erase_eeprom(void)
> > > {
> > > int orig_eeprot,orig_eeprog,i;
> > >
> > > orig_eeprot = EEPROT;
> > > orig_eeprog = EEPROG;
> > > EEPROT = 128; /*128 = 80H = 10000000 set all eeprom blocks to
>be
> > >erased*/
> > > EEPROG = 0; /*clear all bits in eeprog*/
> > > EEPROG = 6; /*set 1stand 2nd bit*/
> > > EEPROG = 7; /*turn on programming voltage */
> > >
> > > while (i<100)
> > > i++; /*give some delay*/
> > >
> > > EEPROG &= ~(1<<0); /*turn off programming voltage*/
> > > EEPROG &= ~(1<<1);
> > >
> > > EEPROG = orig_eeprog;
> > > EEPROT = orig_eeprot;
> > >
> > > }
> > >
> > >When my program comes to the last two line it restore what was
>there
> > >previoulsy in the eeprom. my eeprom starts from 0D00-0FFF. Also I
> > >would like to know how to remap my epprom to a different location.
> > >
> > >Thanks
> > >
> > >Anish
> > >
> > >
> > >
> > >
> > >
> > >
> > >--- In , Dave Perreault <briggsroad@c...>
>wrote:
> > >
> > >
> > >>Anish
> > >>
> > >>Perhaps if you shouw us your setup and code we could offefr some
> > >>suggestions.
> > >>Regards
> > >>Dave Perreault
> > >>
> > >>
> > >>Anish wrote:
> > >>
> > >>
> > >>
> > >>>Hi I am trying to bulk erase the 768 Byte EEPROM in 6812b32. I
> > >>>
> > >>>
> > >have
> > >
> > >
> > >>>written an assembly code for erasing it. I can see thru the
> > >>>
> > >>>
> > >debugger
> > >
> > >
> > >>>that when my code executes the eeprom is erased and all contents
> > >>>
> > >>>
> > >are
> > >
> > >
> > >>>FF but when I reset my processor then eeprom contains my
>previous
> > >>>data.
> > >>>
> > >>>Can any one suggest what I can do for permenantly erasing the
> > >>>
> > >>>
> > >eeprom.
> > >
> > >
> > >>>Anish
> > >>>