PIC18F intermittant reset

Jul 19, 2007 4 Replies

Hi Folks,



I'm using a PIC18F4250 and having an internittant reset problem. It seems to occur at random. Sometimes minutes into testind, sometimes days.



I have added a trace to all parts of the code that call the reset vector to wiggle a port pin if called. I also wiggle the pin so i can trigger the scope on a reset event.



I have triggered on the external reset chip (MCP130) and watched the power. Those are rock steady when the diagnostic pin triggers the scope (I'm looking at 100mS before the triger.)



Is there any kind of code problem that can cause an internal reset. I'm not doing any kind of division and no stack. Just reading an a2d and outputing the data on the serial port.



Part is clocked from an external 12Mhz oscillator and running on 3.3V.



Any ideas what internal fault chip could cause a reset?


I assume you've tried a different chip just to rule out a bad part. Do you have the watch dog disabled (WDT)? What about the brown-out detect (BOD)? If you ran off the end of the program or jumped into unused code space, a blank chip (at least 16F series) will wrap around and look allot like a reset.

If it did jump to a blank address space, what whould that do? Assume the OP code woul be 0x0FF? Reset like action?

I have tried different chips and all act the same. The only thing I cna figure is somewhere in the code an instruction is executing on the A2D readings or something and causing a invalid condition which makes the chip reset.

I don't know what conditions would cause the chip to reset though.

On a 16F, the instruction 0x3FFF is "ADDLW 0xFF", on the 18F the instruction

0xFFFF is a "NOP". So yep, it will run until the PC wraps around and that will likely look like a reset to you.

The watchdog timer (WDT), a brownout detect (BOD), MCLR assertion, or a power on reset (POR). That's about it for a 16F. Looks like the 18F4520 adds stack over/underflow and an actual RESET instruction to the list. That's going to be the only ways (discounting things like static zaps) of causing an actual device reset.

Since you are using 3.3V, beware of the BOD.

Have a close look for stack overflows. They cause some weird 'random' resets that are hard to catch.

Jim Nagy Elm Electronics

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required