|
|
View previous topic :: View next topic |
Author |
Message |
rwskinner
Joined: 08 Dec 2006 Posts: 125 Location: Texas
|
Losing programming |
Posted: Fri Jul 09, 2010 3:13 pm |
|
|
Hello to all. I have an odd problem that I need to try and find a solution to. I have a 18F4550 (bunches of them) that randomly lose their program after a power cycle.
The panel can be up and operating fine, a technician goes out, powers down the panel, performs maintenance, powers back up, and the board with the pic 18F4550 is a dead. Reprogramming the flash with the program fixes it but we rather not have to do this !
I have several thousand 16F chips, and 18F series chips out running and I only ran across this a couple of times after a severe lightening storm, but never after a normal power cycle.
I was able to copy the flash, programming bits, and eeprom off one before I reprogrammed it and I'm about to start comparing bits to see where it's getting corrupt at.
Any tips what I might look for? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
Re: Losing programming |
Posted: Fri Jul 09, 2010 4:32 pm |
|
|
rwskinner wrote: | Hello to all. I have an odd problem that I need to try and find a solution to. I have a 18F4550 (bunches of them) that randomly lose their program after a power cycle.
The panel can be up and operating fine, a technician goes out, powers down the panel, performs maintenance, powers back up, and the board with the pic 18F4550 is a dead. Reprogramming the flash with the program fixes it but we rather not have to do this !
I have several thousand 16F chips, and 18F series chips out running and I only ran across this a couple of times after a severe lightening storm, but never after a normal power cycle.
I was able to copy the flash, programming bits, and eeprom off one before I reprogrammed it and I'm about to start comparing bits to see where it's getting corrupt at.
Any tips what I might look for? |
Disable LVP and enable brownout _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
rwskinner
Joined: 08 Dec 2006 Posts: 125 Location: Texas
|
|
Posted: Fri Jul 09, 2010 4:38 pm |
|
|
I did have the CCS CDC Bootloader and just did away with it.
I also already had
NOLVP, BROWNOUT, and BORV20
I just set the following for Grins, Maybe it will help:
PROTECT
CPD
WRT
WRTD
WRTC
WRTB
EBTR
EBTRB
CPB
When I compared the hex I read from the device and the hex that I programmed the device with originally they were so different it wasn't even funny. |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Fri Jul 09, 2010 4:44 pm |
|
|
rwskinner wrote: | I did have the CCS CDC Bootloader and just did away with it.
I also already had
NOLVP, BROWNOUT, and BORV20
I just set the following for Grins, Maybe it will help:
PROTECT
CPD
WRT
WRTD
WRTC
WRTB
EBTR
EBTRB
CPB
When I compared the hex I read from the device and the hex that I programmed the device with originally they were so different it wasn't even funny. |
If you are powering the PIC from +5volts then the BORV20 setting is too low. The PIC will already have crashed before it gets to this level. It should be more like 43 or whatever the value is for that specific PIC. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
rwskinner
Joined: 08 Dec 2006 Posts: 125 Location: Texas
|
|
Posted: Fri Jul 09, 2010 4:46 pm |
|
|
This is what I have. Previously, Brown out voltage was 2.0 volts and all memory was unprotected.
Code: |
NOW:
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES HSPLL //High speed Osc (> 4mhz)
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NODEBUG //No Debug mode for ICD
#FUSES USBDIV
#FUSES PLL5 //Divide By 5(48MHz oscillator input)
#FUSES CPUDIV1
#FUSES VREGEN //Voltage Regulator
#FUSES NOPBADEN //PortB pins are Digital
#FUSES BROWNOUT //Reset when brownout detected
#FUSES BORV20 //Brownout reset at 2.0V
#FUSES NOPUT //No Power Up Timer
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES MCLR //Master Clear pin enabled
#FUSES LPT1OSC //Timer1 configured for low-power operation
#FUSES PROTECT //Code protected from reading
#FUSES CPD // EE protection
#FUSES WRT //Program memory write protected
#FUSES WRTD //Data EEPROM write protected
#FUSES WRTC //configuration registers write protected
#FUSES WRTB //Boot block write protected
#FUSES EBTR //Memory protected from table reads
#FUSES EBTRB //Boot block protected from table reads
#FUSES CPB //Boot Block code protection
BEFORE:
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES HSPLL //High speed Osc (> 4mhz)
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NODEBUG //No Debug mode for ICD
#FUSES USBDIV
#FUSES PLL5 //Divide By 5(48MHz oscillator input)
#FUSES CPUDIV1
#FUSES VREGEN //Voltage Regulator
#FUSES NOPBADEN //PortB pins are Digital
#FUSES BROWNOUT //Reset when brownout detected
#FUSES BORV43 //Brownout reset at 4.3V
#FUSES NOPUT //No Power Up Timer
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES MCLR //Master Clear pin enabled
#FUSES LPT1OSC //Timer1 configured for low-power operation
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOWRTB //Boot block not write protected
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOCPB //No Boot Block code protection
|
|
|
|
rwskinner
Joined: 08 Dec 2006 Posts: 125 Location: Texas
|
|
Posted: Fri Jul 09, 2010 4:54 pm |
|
|
Ah, I overlooked the obvious, in the bootloader code, I did not have the fuses for Brownout and BOR set !!!
For Protection and Bootloader code, are these fuses ok?
PROTECT, NOCPD, NOWRT, NOWRTD, WRTB, WRTC, EBTR,EBTRB, CPB
This ought to protect everything but program memory and eeprom correct? |
|
|
rwskinner
Joined: 08 Dec 2006 Posts: 125 Location: Texas
|
|
Posted: Sat Jul 10, 2010 6:26 am |
|
|
Since I have your ear, where are the CCS Fuses for Brownout and Powerup Timer for the 18F26J50? I see the Deep Sleep Brownout DSBOR.
CONFIG3L in the datasheet, describes the config bits but it's all for Deep Sleep.
Richard |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Sat Jul 10, 2010 2:34 pm |
|
|
You do realise, that if you 'protect' the code, what you read back from a chip, will not resemble the hex file at all...
The 'verify' sequence with a chip with the protect fuse, is:
1) Write the chip without the protect fuse.
2) Verify against the hex file
3) Enable the protect fuse.
4) Read the data from the chip, and store it.
Then in future, program new chips, from the original hex file, but with the protect fuse set, and _verify_ against the file generated in step 4.
Best Wishes |
|
|
obdave
Joined: 25 Sep 2010 Posts: 1
|
|
Posted: Sat Sep 25, 2010 3:07 pm |
|
|
Howdy folks, I found this topic via Google because I just had one of my devices lose its mind. Here are particulars:
* processor is PIC18F25J11 (part of the PIC18F46J11 family)
* I have a bootloader
* processor went into a weird mode and stayed there
* rebooting umpteen times didn't resolve the issue
* code failed to verify using MPLAB ICD2
* flashing in new code via ICD2 fixed the problem
Sounds like program memory corruption to me.
Here's the thing - in studying the data sheet for this PIC, there is no fuse for Brown Out Reset. BOR is always enabled on this device, as is the internal voltage regulator. This PIC does have a Deep Sleep BOR fuse. I don't use Deep Sleep mode but I have the fuse enabled anyway. I'm not sure if I've overlooked anything or whether this is enough to eliminate BOR as a cause for my memory corruption.
Any suggestions would be gratefully accepted.
Regards,
Dave |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Sep 26, 2010 6:32 pm |
|
|
It could be any of the following, or several other things that are not listed:
Hardware:
1. A problem with your individual 18F25J11, or with the entire production
lot that your PIC is from.
2. A undiscovered errata with the silicon revision of your 18F25J11.
3. A problem with the design of your board, in the track layout,
component placement, and/or selection of component types or values.
Standard design practices may not have been followed.
4. A problem with a bad component on your individual board.
5. A misinterpretation of the PIC data sheet, so that the PIC on your
board is running outside of spec'ed design parameters. Or it could be
a misinterpretation of data sheets for other components on the board.
6. It could be a problem with the environment that the board operates
in, including electrical or temperature, etc.
Software:
7. It could be a problem with your version of the compiler. What is your
version ?
8. It could be a coding error done by you.
9. It could be the enabling of incorrect #fuses by you.
Here's a thread just on PCB track layout problems:
http://www.ccsinfo.com/forum/viewtopic.php?t=42775
The question is how to discover which of these things is causing the
problem. A lot of it can be done by swapping. Try using a similar PIC
from a "non-J" family. Try using a standard demo board from Microchip
as the platform, instead of your board. Try running the board in a
different environment. Try using a different CCS compiler version.
Try commenting out non-vital sections of your code. See if you still
get the problem.
Read my comments in this thread. See if you're doing any of those:
http://www.ccsinfo.com/forum/viewtopic.php?t=41964 |
|
|
assaad
Joined: 09 Dec 2009 Posts: 37
|
Re: Losing programming |
Posted: Tue Sep 28, 2010 9:18 am |
|
|
rwskinner wrote: | Hello to all. I have an odd problem that I need to try and find a solution to. I have a 18F4550 (bunches of them) that randomly lose their program after a power cycle.
The panel can be up and operating fine, a technician goes out, powers down the panel, performs maintenance, powers back up, and the board with the pic 18F4550 is a dead. Reprogramming the flash with the program fixes it but we rather not have to do this !
I have several thousand 16F chips, and 18F series chips out running and I only ran across this a couple of times after a severe lightening storm, but never after a normal power cycle.
I was able to copy the flash, programming bits, and eeprom off one before I reprogrammed it and I'm about to start comparing bits to see where it's getting corrupt at.
Any tips what I might look for? |
Do you use flash write ? It can be a bug in your software. I have this issue 2 years ago, but it was a bug. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|