View previous topic :: View next topic |
Author |
Message |
championx
Joined: 28 Feb 2006 Posts: 151
|
program corruption due to low voltage? |
Posted: Mon Mar 11, 2019 9:10 am |
|
|
Hi! is there a way that the code on a pic 16F1847 gets corrupted due to low voltage?
The thing is that we developed a board that has this pic and operates from 2 AAA batterys, some of the devices, after complete discharge of the cells, doesnt work anymore with new batterys. But if we flash the firmware again, they start working again....
fuses:
#fuses INTRC_IO,NOPROTECT, PUT, NOMCLR, WDT_SW, BROWNOUT, NOLVP, PLL_SW, FCMEN |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19569
|
|
Posted: Mon Mar 11, 2019 9:26 am |
|
|
Basically, no.
However one 'caveat'. If your code is using any write to the program memory
and this is attempted with a supply less than Vddmin (1.8v), then this can
result in corruption of the flash. |
|
|
championx
Joined: 28 Feb 2006 Posts: 151
|
|
Posted: Mon Mar 11, 2019 9:39 am |
|
|
Thanks for your answer Ttelmah, but, no write to program memory on my code. Any other hint? |
|
|
gaugeguy
Joined: 05 Apr 2011 Posts: 304
|
|
Posted: Mon Mar 11, 2019 10:00 am |
|
|
What is your brownout voltage set to?
What frequency are you running the processor at?
Have you verified that the brownout reset is working correctly? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19569
|
|
Posted: Mon Mar 11, 2019 12:35 pm |
|
|
Without knowing how your reset is generated, it is possible that the
chip wasn't actually corrupted, just not being properly reset.
Programming operates the MCLR line, so will force a chip reset.
Gaugeguy's comment about brownout could definitely apply. Though
you have BROWNOUT selected, what is the default voltage for this?. |
|
|
Jerson
Joined: 31 Jul 2009 Posts: 126 Location: Bombay, India
|
|
Posted: Mon Mar 11, 2019 9:27 pm |
|
|
I would add to Ttelmah's comment and check for any writes to internal eeprom as well. At voltages outside the manufacturer specified operating limits, what is meant to do an eeprom write could as well be writing your program space. _________________ Regards
Jerson Fernandes |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19569
|
|
Posted: Tue Mar 12, 2019 2:16 am |
|
|
A good point.
The EEPROM write could also give the same problem. Any write to ROM
is potentially a problem if attempted when the supply voltage is too
low. The code really needs to implement testing to verify the supply
is in an acceptable range for any such write. This is not hard to do, just
read the voltage from the FVR (set to 1.024v), using channel 31 of
the ADC, and the supply as the ADC reference. If this reads above about 580
then the supply is too low to support such writes. |
|
|
|