View previous topic :: View next topic |
Author |
Message |
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
MCLR_FROM_RUN why? |
Posted: Mon Nov 07, 2005 6:01 pm |
|
|
One out of many units is rebooting sometimes.
n = restart_cause(); is returning 15 which means MCLR_FROM_RUN
Some thought on why one of many units does this, and the others never do it ?
The chip is a PIC18LF6720 (Silicon Rev A4) running at 3.3V. Supply is clean, MCLR is pulled up using a 22K. Units are tested at -40C up to +85C .
I'm starting to think this may be a bad chip, I'd appreciate some thoughts/opinions before I replace the chip..
Thanks |
|
|
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
Re: MCLR_FROM_RUN. How to insert a NOP at 0000 |
Posted: Mon Nov 07, 2005 10:28 pm |
|
|
Hans Wedemeyer wrote: | One out of many units is rebooting sometimes.
n = restart_cause(); is returning 15 which means MCLR_FROM_RUN
Some thought on why one of many units does this, and the others never do it ?
The chip is a PIC18LF6720 (Silicon Rev A4) running at 3.3V. Supply is clean, MCLR is pulled up using a 22K. Units are tested at -40C up to +85C .
I'm starting to think this may be a bad chip, I'd appreciate some thoughts/opinions before I replace the chip..
Thanks |
I checked the Errata sheet for rev. A4 and it appears the chip has a reset problem.
Changed the chip and the problem appears to be gone.
If this really is the issue, and it looks like it is, then Microchip has a work around:
Quote:
Work around
Insert a NOP instruction at address 0x0000.
end Quote.
First two lines of code from my LST
0000: GOTO E482
0008: MOVFF FE8,05
Looks like CCS did not cater for the workaround!
So how do I insert a nop at location 0000 ?
hansw |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Nov 07, 2005 10:54 pm |
|
|
Quote: | So how do I insert a nop at location 0000 ? |
Code: | #include <18F6720.H>
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay (clock=4000000)
// Tell compiler to put reset code at address 0x0002,
// instead of at 0x0000, as is normally done.
#build(reset=0x0002)
#ROM 0 = {0xFFFF} // Insert NOP at address 0
// Put interrupt service routines here.
//==============================
void main()
{
while(1);
} |
|
|
|
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
|
Posted: Tue Nov 08, 2005 8:19 am |
|
|
PCM programmer wrote: | Quote: | So how do I insert a nop at location 0000 ? |
Code: | #include <18F6720.H>
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay (clock=4000000)
// Tell compiler to put reset code at address 0x0002,
// instead of at 0x0000, as is normally done.
#build(reset=0x0002)
#ROM 0 = {0xFFFF} // Insert NOP at address 0
// Put interrupt service routines here.
//==============================
void main()
{
while(1);
} |
|
OK.... I think that did the trick.
Now the first line of the LST reads 0002: GOTO D5F8
Do I just assume an erased chip is full of NOP's ? or is there a way to "see" what's at location 0000 ?
Thanks for the help.
Best rgeards
Hans W |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Nov 08, 2005 8:59 am |
|
|
Yes, the erased chip would have nop's. Also, from MPLAB, you can view the program memory to verify that something not expected is sitting at location 0. |
|
|
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
|
Posted: Tue Nov 08, 2005 10:54 am |
|
|
Mark wrote: | Yes, the erased chip would have nop's. Also, from MPLAB, you can view the program memory to verify that something not expected is sitting at location 0. |
Thanks.... |
|
|
|