Searching \ for '[PIC:] Flash corruption' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: piclist.com/techref/microchip/memory.htm?key=flash
Search entire site for: 'Flash corruption'.

Exact match. Not showing close matches.
PICList Thread
'[PIC:] Flash corruption'
2004\05\19@154333 by Koebel, Alen

flavicon
face
I posted this question a while back but with an incorrect tag,
so some people might not have seen it.

I am infrequently seeing corruption of the Flash memory on an
16F877A device. I first suspected my "bootloader" routine (which
actually doesn't program on boot-up), but I can't find a reason
why it would jump into the programming routine at just the right
point to corrupt the memory, bypassing the normal checks on
the data to be programmed (comparing length and checksum). I'm
running at 5V +/-2% with brown-out detect enabled and triggering
at very close to the nominal 4.0 V. Any ideas what, besides a
code bug, could be corrupting the program memory?

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

2004\05\19@203258 by Mike Hord

picon face
How do you know the flash is getting corrupted?  Does the
chip not verify?

Do you have LVP enabled?  If so, could the chip be drifting
into programming mode?  Or somehow drifting into
programming mode with high voltage programming?

I would also be immediately suspicious of the bootloader.
Try putting the program on the chip without the bootloader,
and see if you still have the corruption problem.

Mike H.

{Quote hidden}

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee.
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

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

2004\05\19@220748 by Sergio Masci

picon face
----- Original Message -----
From: Koebel, Alen <.....AKoebelKILLspamspam.....CHRISTIEDIGITAL.COM>
To: <EraseMEPICLISTspam_OUTspamTakeThisOuTMITVMA.MIT.EDU>
Sent: Wednesday, May 19, 2004 8:45 PM
Subject: [PIC:] Flash corruption


{Quote hidden}

Id there a petern to the corruption. Try keeping a list of corrupted addresses
and if possible the previous value of the location so that you can compare it
with what should be there.

Regards
Sergio Masci

http://www.xcprod.com/titan/XCSB - optimising PIC compiler

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

2004\05\20@100035 by Koebel, Alen

flavicon
face
> How do you know the flash is getting corrupted?  Does the
> chip not verify?

Correct. Reading the device shows a few words here and there
are not correct. Specifically, either four or eight words,
usually on XXFC word boundaries.

> Do you have LVP enabled?

No.

> If so, could the chip be drifting into programming
> mode?  Or somehow drifting into programming mode
> with high voltage programming?

I've recently added a TVS to the Vpp line to guard against
this possibility.

> I would also be immediately suspicious of the bootloader.

I am, so I added some code just before the programming
segment that checks to see if it got there "legally." The
problem is, I've been unable to replicate the problem in
the lab, with the board in what is supposedly the
identical application environment. So I can't verify that
this is the cause. Either the real cause of the corruption
happens very rarely or the environments aren't really
identical.

> Try putting the program on the chip without the bootloader,
> and see if you still have the corruption problem.

Unfortunately, I can't ship product that way and I can't
replicate in the lab.

Mike H.

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

2004\05\20@113014 by Koebel, Alen

flavicon
face
> Id there a petern to the corruption. Try keeping a list of
> corrupted addresses and if possible the previous value of
> the location so that you can compare it with what should be
> there.

There is indeed a pattern. Typically four or eight words (but
once only three!) of program memory are different, always on
an XXFC address boundary. The first three words are usually
0x3FFF (all 1's), while the fourth word appears to be random.
The 16F877A programs four words at a time, so seeing that many
words or a multiple change is not surprising.

Here is a typical example:

Original code:

00FC  1283    bcf    0x3,0x5
00FD  0800    movf   0x0,W
00FE  008C    movwf  0xC
00FF  0A84    incf   0x4

New contents:

00FC  3FFF    addlw  0xff
00FD  3FFF    addlw  0xff
00FE  3FFF    addlw  0xff
00FF  1F00    btfss  0x0,0x6


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

2004\05\20@132929 by M. Adam Davis

flavicon
face
It's very interesting corruption because with the flash in the PICs you
can only clear bits one a byte by byte basis.  If you want to set bits
then you have to clear a full block of flash first.  So something in
your program is not only performing a block erase, but also writing to
the last byte.

Identify all the locations in your program that perform block erases,
and then put stops on them for debugging.  If you don't have the luxury
of debugging then replace that routine with one that lights a led and
halts the processor or (better yet) spits the call stack out the UART
and perhaps the contents of W, etc.

Are you underflowing or overflowing your stack?

-Adam

Koebel, Alen wrote:

{Quote hidden}

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

2004\05\20@133343 by M. Adam Davis

flavicon
face
Is this happening across multiple units?  Are any of the code
protections on?

If you only have this unit, swap with a new chip and observse.

-Adam

Koebel, Alen wrote:

{Quote hidden}

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

2004\05\20@155033 by Bob Axtell

face picon face
This looks like a problem I had when my programmer cable had a broken
GND pin on the programming connector. What I was seeing in the pattern
was 60hz hum...

--Bob

M. Adam Davis wrote:
> Is this happening across multiple units?  Are any of the code
> protections on?

--

 Replies: NOTE-Script, EXE,BAT and COM
    files will be rejected by server
             --------------
               Bob Axtell
       PIC Hardware & Firmware Dev
         http://beam.to/baxtell
             1-520-219-2363

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

2004\05\20@175114 by Koebel, Alen

flavicon
face
> Is this happening across multiple units?  Are any of the code
> protections on?

It's happened with four units so far, all (perhaps coincidently)
with the same PIC date code. There haven't been any others out
of 50-odd units shipped.

Code protections are not on. I can't really make use of code
protect for the different regions, but maybe the CP bit (all
program mem) would help. If I could only reproduce the problem,
I could see if it made a difference, but...

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

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