Searching \ for '[PIC]: 16f87x code protected bulk erase algorithm' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=16F
Search entire site for: '16f87x code protected bulk erase algorithm'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: 16f87x code protected bulk erase algorithm '
2002\10\29@155351 by Sean Olson

picon face
Here's my problem:
I was playing with some programming software and set the code protect bits on a 16f876.
I tried the erase commands on fpp and winpicprog but they would not reset the code
protection.

So, I downloaded the 16f87x memory programming datasheet (DS39025F), booted into linux,
and wrote a simple programmer.  According to the datasheet, the only way to disable code
protection on the chip is to perform a code ptotected bulk erase sequence.  I implemented
that with the following routine:

void bulk_erase(void) {
 int i;
 device_reset();
 send_command(LOAD_CONFIG);
 send_data(0x3fff);
 for(i = 0; i < 7; i++)
   send_command(INCREMENT_ADDR);
 send_command(BULK_ERASE_SETUP1);
 send_command(BULK_ERASE_SETUP2);
 send_command(BEGIN_ERASE_PROG);
 nano_sleep(ERASE_CYCLE_MAX + PROG_CYCLE_MAX);
 send_command(BULK_ERASE_SETUP1);
 send_command(BULK_ERASE_SETUP2);
 device_reset();
}

All this routine seems to do is try to write 0x3fff to the config register.  It will set
the bits that don t have anything to do with code protection, but it doesn t erase the
device.  I have tried adjusting the time delays but there was no difference.

I have searched through the archives and found some similar posts but the changes
suggested (adding an extra begin programming cycle and such) didn t seem to make a
difference and most were geared more towards the 16x84.  Also, with my slow dial up
connection and the mailing list archive queries taking a few tries each time, I didn t
exactly get through every message.

As for hardware, I am using a TLVP programmer (http://www.finitesite.com/d3jsys) connected to
the 5V output of an AT power supply.  I checked the voltage with a DMM and read 5.2V,
which is in the proper range for performing a code protected bulk erase (4.5   5.5).  The
TLVP is plugged directly into the parallel port.

Any tips, suggestions, or other help on how to bulk erase a code protected 16f87x part
would be greatly appreciated.

Sean


__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\10\30@161440 by Olin Lathrop

face picon face
part 1 644 bytes content-type:text/plain; (decoded 7bit)

> All this routine seems to do is try to write 0x3fff to the config
register.  It will set
> the bits that don t have anything to do with code protection, but it
doesn t erase the
> device.

To fully erase the device, you have to make sure the code protection bits
start out 0.  Apparently it is the transition from 0 to 1 that erases all
the bits covered by the code protect bits.

The attached ZIP file contains source code that works.  See the
PICPRG_ERASE_16F routine in the PICPRG_16.PAS module.  I also included the
PICPRG.INS.PAS file to help you guess what some of the subroutines might
do.


part 2 8423 bytes content-type:application/octet-stream; (decode)

part 3 318 bytes

*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics



'[PIC]: 16f87x code protected bulk erase algorithm '
2002\11\01@170745 by Sean Olson
picon face
> To fully erase the device, you have to make sure the code protection bits
> start out 0.  Apparently it is the transition from 0 to 1 that erases all
> the bits covered by the code protect bits.

I implemented the code Olin sent, however it did not affect the outcome of the bulk
erase.  It seems as if all the sequence is doing is trying to write 0x3fff to the config
register.  The bulk erase doesn't happen.  I can program and read the ID registers so I'm
sure my data communication routines are fine.  I'm rather stumped as to why the bulk
erase doesn't happen.

My TLVP programmer is implemented exactly as described at
http://www.finitesite.com/d3jsys with the exception of using an HCT373 instead of an
HCT573.  I rechecked voltages and am getting 5.25V at high.  Has anyone had success using
this programmer and getting a code protected bulk erase to work with a 16F876?  I don't
know if this makes any difference or not, but the device ID word is 0x09E4.

I just recieved my new batch of PIC's (16F877, 18F452, 18F458) so this isn't as much as
an issue since I can use them.  However, I would really like to figure out why this
doesn't seem to work.

Sean

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2002\11\01@185623 by Olin Lathrop

face picon face
> I implemented the code Olin sent, however it did not affect the outcome
of the bulk
> erase.  It seems as if all the sequence is doing is trying to write
0x3fff to the config
> register.  The bulk erase doesn't happen.  I can program and read the ID
registers so I'm
> sure my data communication routines are fine.  I'm rather stumped as to
why the bulk
> erase doesn't happen.

The source I sent is the actual operational source for my programmer,
which can definitely erase a code protected 16F877.  Are the Vpp and Vdd
voltages within spec.  Note that the allowable Vdd range is narrower for
erasing and programming the chip than for verifying it.  If I remember
right, Vpp needs to be 13V +-.5 and Vdd 5V +-.5.  I would want to be
closer than +-.5V.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2002\11\02@005002 by Sean Olson
picon face
> The source I sent is the actual operational source for my programmer,
> which can definitely erase a code protected 16F877.  Are the Vpp and Vdd
> voltages within spec.  Note that the allowable Vdd range is narrower for
> erasing and programming the chip than for verifying it.  If I remember
> right, Vpp needs to be 13V +-.5 and Vdd 5V +-.5.  I would want to be
> closer than +-.5V.

I'm using a low voltage programmer, so Vpp = Vdd = 5.25V.  The 16f87x memory programming
datasheet (DS39025F) doesn't explicitly state that LVP mode is able to do a code
protected bulk erase, however it does say that other than the lower Vpp voltage and
dedicating RB3 to programming, "All other specifications for high voltage ICSP apply".

I'm beginning to think that maybe the code protected bulk erase needs Vpp at the high
voltage level (Vdd + 3.5) rather than the low voltage level (Vdd) as provided by my
programmer.  I'm going to modify my TLVP to use a higher Vpp (make it a THVP) and see if
that solves the problem.  Have you (or anyone else for that matter) found any
documentation that says LVP mode can or can't do this kind of erase?

Sean

__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamKILLspammitvma.mit.edu


2002\11\02@082105 by Olin Lathrop

face picon face
> I'm using a low voltage programmer, so Vpp = Vdd = 5.25V.

Is the low voltage programming enable bit set.

> The 16f87x memory programming
> datasheet (DS39025F) doesn't explicitly state that LVP mode is able to
do a code
> protected bulk erase, however it does say that other than the lower Vpp
voltage and
> dedicating RB3 to programming, "All other specifications for high
voltage ICSP apply".
>
> I'm beginning to think that maybe the code protected bulk erase needs
Vpp at the high
> voltage level (Vdd + 3.5) rather than the low voltage level (Vdd) as
provided by my
> programmer.  I'm going to modify my TLVP to use a higher Vpp (make it a
THVP) and see if
> that solves the problem.  Have you (or anyone else for that matter)
found any
> documentation that says LVP mode can or can't do this kind of erase?

I thought you couldn't erase code protected memory with low voltage
programming, but I just checked the spec and found the same thing you did.
I don't have any experience with low voltage programming.  My programmer
always uses high voltage.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu


2002\11\08@015108 by Sean Olson

picon face
> > I'm using a low voltage programmer, so Vpp = Vdd = 5.25V.
> Is the low voltage programming enable bit set?

The LVP bit was set in the config register.

> I thought you couldn't erase code protected memory with low voltage
> programming, but I just checked the spec and found the same thing you did.
> I don't have any experience with low voltage programming.  My programmer
> always uses high voltage.

Well, as it turns out, you were right about low voltage programming being the problem.  I
converted my TLVP to a THVP with a Vpp of 11.5V and a Vdd of 5.25V.  After inverting the
MCLR pin in software to account for the circuit change, the code protected bulk erase
seemed to work perfectly in both fpp and my own programming software.

Here's some debug output from my programmer:

Config = 0x3FFF
Setting Config = 0x0000
Config = 0x0400
ID:  2EAA  1DD5  0CCC  3FB3
Starting Bulk Erase
Checking values after Bulk Erase
Config = 0x3FFF
ID:  3FFF  3FFF  3FFF  3FFF

The same sequence using the LVP programmer would only set a few bits in the config block
and wouldn't touch the ID bytes.

From this it would seem that a code protected bulk erase using a low voltage programmer
will not work in this series of PIC's, which is contrary to the datasheet.  Or maybe my
programmer wasn't all it could be...  Either way,  I would still like to hear from anyone
who has been able to perform a code protected bulk erase on the PIC16F87x series using a
low voltage on MCLR.

Thanks for the help Olin.

Sean


__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...