CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC18F67K22 Erased code What happened
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Mar 01, 2014 9:26 pm     Reply with quote

The Config bits from your hex file match what you put into you have in
your #fuses line.

These are the fuses reported at the end of the .LST file for a program
with your #fuses statements (with _NOT_PROTECTED_ defined).
I put the INTRC_HP in brackets because that's a bug in the compiler's
Config bits report. The bug is still there in vs. 5.020.
In some cases the settings may seem strange, for example with brownout
it has Zero Power Brownout mode selected, but that's the default if you
don't specify it, and you're not enabling brownout anyway so it doesn't
matter.
Code:
Configuration Fuses:
   Word  1: D315   VREGSLEEP [INTRC_HP] SOSC_DIG NOXINST HSM PLLEN FCMEN IESO
   Word  2: 1C68   PUT NOBROWNOUT BORV27 ZPBORM NOWDT WDT128
   Word  3: 8801   RTCOSC_T1 CCP2E7 MSSPMSK7 MCLR
   Word  4: 0091   STVREN BBSIZ2K NODEBUG
   Word  5: C0FF   NOPROTECT NOCPB NOCPD
   Word  6: E0FF   NOWRT NOWRTC NOWRTB NOWRTD
   Word  7: 40FF   NOEBTR NOEBTRB



The numbers above are allocated as shown below. You can look in the
Config bits section of the 18F67K22 data sheet (in the Special Features
section) and see that they match the intended settings in your #fuses.
Code:

Config1L 15
Config1H D3

Config2L 68
Config2H 1C

Config3L 01
Config3H 88

Config4L 91
Config4H N/A

Config5L FF
Config5H C0

Config6L FF
Config6H E0

Config7L FF
Config7H 40



I didn't intend that you think your #fuses were changed. That was a
problem with the other guy who accidently had some units programmed
with an old program, I suspect. I wanted to bring up the issue of
using Brownout. I answered your question but this whole post really
wasn't necessary.
soonc



Joined: 03 Dec 2013
Posts: 215

View user's profile Send private message

PostPosted: Sat Mar 01, 2014 9:39 pm     Reply with quote

Thanks for decoding those fuses.

Is there a utility that can decode the HEX or did you do it all manually ?

Power Glitches:

There are no power glitches in excess of 3.3V BUT there is one big power glitch (dip) 1.3mS after power up. It dips about 1V.

Power up ramps up in 500uS. Clearly that's not good.

Power down is clean.

Thanks for all the help.
I'll post my finding if/when I get a result I can trust and repeat.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Mar 01, 2014 9:51 pm     Reply with quote

I did the fuses manually.

The slow ramp up and the glitch in the power supply output are probably
causing the problem.
soonc



Joined: 03 Dec 2013
Posts: 215

View user's profile Send private message

PostPosted: Sat Mar 01, 2014 10:27 pm     Reply with quote

I'll investigate the power glitch some more.

I appreciate you taking the time to decode the Fuses.
Perhaps it's a feature CCS could add to the IDE.

May be it's already "in there" but I have not seen it.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Mar 02, 2014 8:14 pm     Reply with quote

You can import the hex file into MPLAB. First go to the Configure menu
and select the correct PIC. Then go to File/Import and import the Hex
file. Then got to Configure/Configuration bits and you'll see the Config
bit fields and their settings.
soonc



Joined: 03 Dec 2013
Posts: 215

View user's profile Send private message

PostPosted: Sun Mar 02, 2014 8:33 pm     Reply with quote

Thanks that's a great tip.

BTW the power up ramp really was not an issue: What was NOT GOOD was the glitch that happened right after power up.
I've fixed that, and have rigged up a system to cycle the power ON and OFF every 120 Seconds. I'll leave it running for a few days.

Thanks again for the help.
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Mon Mar 03, 2014 12:57 am     Reply with quote

Have to agree. The ramp time is well inside the figures allowed from the data sheet (yes this is specified). However the glitch is bad. Realistically, this _is_ a brownout, so I have to ask why the brownout fuse is 'off'. Even if you fix the core problem, worth possibly having the 'belt and braces' of enabling this as well.

Best Wishes
soonc



Joined: 03 Dec 2013
Posts: 215

View user's profile Send private message

PostPosted: Mon Mar 03, 2014 2:43 am     Reply with quote

Ttelmah,
Yes I understand.
Basically the uP keeps it own power ON by raising a "keep alive" line as soon as the simple mechanical Push Button switch is pressed. That works fine but when switching OFF the uP lowers the "keep alive" line and switches off the LDO reg.
If the BROWNOUT is enabled as the system dies it issues a reset and the uP boots up again.
By not allowing the BROWNOUT the shutdown is clean.

The "big glitch" was due to lack of thought on my part I had used a far too large a Tantalum cap at the LDO output and it produced the first bad glitch that I think was the cause for the program wipe out. That glitch is GONE however it exposed a very fast second glitch at about 43mS from when Vdd is switched ON.
The PIC data sheets suggests there is a 65mS power up timer so I don't think this second glitch is under my control except by supplying a lower Z output LDO reg. The LDO is a Linear part LTC1844-3V3 it gets it's RAW DC from a Maxim DC-DC that is always ON. The MAXIM DC-DC can deliver 500mA. The DC-DC runs off of 2 "D" cells.

If I could figure out how to post scope images I'd upload to show you what I mean.

UPDATE on Testing:
I rigged up an automated ON/OFF cycle tester last night and it cycles the DUT power ON / OFF every 90 seconds with enough time to allow the system to drain down to near zero in the DUT each time.

So far it has Switched ON/OFF 183 times with no failures.
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Mon Mar 03, 2014 2:49 am     Reply with quote

Fun... Smile

I'd suggest that by tuning the cap/resistor on the MCLR pin, you should be able to ensure that the chip remains in reset for more than 50mSec after power comes on. Then the high speed glitch shouldn't matter (this may already be what is happening).

Best Wishes
soonc



Joined: 03 Dec 2013
Posts: 215

View user's profile Send private message

Conclusion
PostPosted: Thu Mar 06, 2014 9:40 am     Reply with quote

With or without changes to "tune" the RC reset at the !MCLR pin so as to avoid complications with a glitch during power ON I tested using an automated On/Off controller.

Over 2600 on/off cycles each cycle allows the unit to power up for 30 seconds and Off for 30 seconds which is enough time for the Vdd to drain to near 0V.

No failures.

Over 900 test in original condition. No Failures.

Conclusion: Tests are inconclusive.

Final Action:
Removed Cap and Diode on MCLR and installed a MCP10-263 reset generator.
If indeed the failure was due to power up or down, the MCP does a super job of providing a 125mS delay at Power ON ensuring the uP is halted.
At power down when the Vdd falls to 2.63V the MCLR pin is clamped down at GND ensuring the uP is again Halted,

Lesson Learned: Use a Reset generator. Current consumption is < 5uA and cost is about the same because the Cap and Diode are not needed.

Thanks for all the help.
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Thu Mar 06, 2014 9:55 am     Reply with quote

All you've really proven is that when the device is operated in the manner it was designed, it works well. What happens if you alter the automated power on/off test to simulate an impatient user? A user that only powers it up for a second, off for 5, then on again? ...Stuff like that...

I have a feeling you'll find the bug under that type of operating condition(s).
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Thu Mar 06, 2014 10:05 am     Reply with quote

The quote that comes to mind in these cases (working with user interfaces) is "it is hard to make things foolproof -- fools are so ingenious" The users out there come up with more strange ways of doing things that the designer never even thought of that cause strange failures sometimes.
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Thu Mar 06, 2014 11:14 am     Reply with quote

Here's a classic example of an operator doing something the designer didn't account for with deadly results: http://en.wikipedia.org/wiki/Therac-25
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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