EmbeddedRelated.com
Forums

PIC 18 Reset Problem

Started by Tim Wescott August 1, 2007
I have an odd little problem, I'm hoping one of you could shed some 
light on it before I spend hours tracking it down.

I'm working on a board with a PIC18F8722.  We're setting it up to work 
in external clock mode with a 40MHz clock.  This clock is, in turn, 
sourced by an integrated oscillator module from ECS (ECS-8FM).

The problem that we're seeing is that sometimes the thing comes up going 
very slowly.  I haven't measured timing yet, but it appears to be 
running about 5x or 10x slower than it should.  The problem is somehow 
related to the power source, with faster rise times on the power supply 
inducing it much more often.  The only lead that I have on it right now 
is that with a sharp-rising power supply the oscillator takes several 
milliseconds to start up.

I'm wondering if the PIC 18 senses that the clock isn't present coming 
out of reset and defaults to an internal clock.  This seems screwy, but 
it makes a twisted kind of sense.  IIRC the oscillator is billed as 
working at 3.3V, so with a slowly-rising VCC it would presumably 
(possibly?) start working before the processor came out of reset.

Has anyone seen anything like this before, or am I on my own?

-- 

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html

Tim Wescott wrote:

> I have an odd little problem, I'm hoping one of you could shed some > light on it before I spend hours tracking it down. > > I'm working on a board with a PIC18F8722. We're setting it up to work > in external clock mode with a 40MHz clock. This clock is, in turn, > sourced by an integrated oscillator module from ECS (ECS-8FM). > > The problem that we're seeing is that sometimes the thing comes up going > very slowly. I haven't measured timing yet, but it appears to be > running about 5x or 10x slower than it should. The problem is somehow > related to the power source, with faster rise times on the power supply > inducing it much more often. The only lead that I have on it right now > is that with a sharp-rising power supply the oscillator takes several > milliseconds to start up. > > I'm wondering if the PIC 18 senses that the clock isn't present coming > out of reset and defaults to an internal clock. This seems screwy, but > it makes a twisted kind of sense. IIRC the oscillator is billed as > working at 3.3V, so with a slowly-rising VCC it would presumably > (possibly?) start working before the processor came out of reset. > > Has anyone seen anything like this before, or am I on my own?
I believe your reasoning is correct. I had very similar problem with 68HCS12 because of the clock monitor circuit. PIC18 does have the clock monitor also. Solution: Check the bit which tells that the micro is running on the internal osc. If it is so, initiate the reset. It is convenient to do all of that in the watchdog reset subroutine. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Vladimir Vassilevsky wrote:
> > > Tim Wescott wrote: > >> I have an odd little problem, I'm hoping one of you could shed some >> light on it before I spend hours tracking it down. >> >> I'm working on a board with a PIC18F8722. We're setting it up to work >> in external clock mode with a 40MHz clock. This clock is, in turn, >> sourced by an integrated oscillator module from ECS (ECS-8FM). >> >> The problem that we're seeing is that sometimes the thing comes up >> going very slowly. I haven't measured timing yet, but it appears to >> be running about 5x or 10x slower than it should. The problem is >> somehow related to the power source, with faster rise times on the >> power supply inducing it much more often. The only lead that I have >> on it right now is that with a sharp-rising power supply the >> oscillator takes several milliseconds to start up. >> >> I'm wondering if the PIC 18 senses that the clock isn't present coming >> out of reset and defaults to an internal clock. This seems screwy, >> but it makes a twisted kind of sense. IIRC the oscillator is billed >> as working at 3.3V, so with a slowly-rising VCC it would presumably >> (possibly?) start working before the processor came out of reset. >> >> Has anyone seen anything like this before, or am I on my own? > > I believe your reasoning is correct. > > I had very similar problem with 68HCS12 because of the clock monitor > circuit. PIC18 does have the clock monitor also. > > Solution: > > Check the bit which tells that the micro is running on the internal osc. > If it is so, initiate the reset. It is convenient to do all of that in > the watchdog reset subroutine. >
It seems like putting a bucket over the _real_ cause of the problem, but it looks like a solid answer if the PIC will cough up that information. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html
Tim Wescott wrote:
> I have an odd little problem, I'm hoping one of you could shed some > light on it before I spend hours tracking it down. > > I'm working on a board with a PIC18F8722. We're setting it up to work > in external clock mode with a 40MHz clock. This clock is, in turn, > sourced by an integrated oscillator module from ECS (ECS-8FM). > > The problem that we're seeing is that sometimes the thing comes up going > very slowly. I haven't measured timing yet, but it appears to be > running about 5x or 10x slower than it should. The problem is somehow > related to the power source, with faster rise times on the power supply > inducing it much more often. The only lead that I have on it right now > is that with a sharp-rising power supply the oscillator takes several > milliseconds to start up. > > I'm wondering if the PIC 18 senses that the clock isn't present coming > out of reset and defaults to an internal clock. This seems screwy, but > it makes a twisted kind of sense. IIRC the oscillator is billed as > working at 3.3V, so with a slowly-rising VCC it would presumably > (possibly?) start working before the processor came out of reset. > > Has anyone seen anything like this before, or am I on my own? >
We are having problems with two lots of PIC18F248 chips (old product) that are reseting randomly 0-10 seconds into startup. If they don't reset in that time they carry on working fine. They are running at 40MHz (HSPLL 10MHz). We have Microchip working on the problem. If we cool the chips with "Freeze Spray" before powerup they work fine. I was wondering if your problem is fixed the same way? This might give us some clues...
In article <oz3si.25354$RX.179@newssvr11.news.prodigy.net>, Vladimir 
Vassilevsky says...
> > > Tim Wescott wrote: > > > I have an odd little problem, I'm hoping one of you could shed some > > light on it before I spend hours tracking it down. > > > > I'm working on a board with a PIC18F8722. We're setting it up to work > > in external clock mode with a 40MHz clock. This clock is, in turn, > > sourced by an integrated oscillator module from ECS (ECS-8FM). > > > > The problem that we're seeing is that sometimes the thing comes up going > > very slowly. I haven't measured timing yet, but it appears to be > > running about 5x or 10x slower than it should. The problem is somehow > > related to the power source, with faster rise times on the power supply > > inducing it much more often. The only lead that I have on it right now > > is that with a sharp-rising power supply the oscillator takes several > > milliseconds to start up. > > > > I'm wondering if the PIC 18 senses that the clock isn't present coming > > out of reset and defaults to an internal clock. This seems screwy, but > > it makes a twisted kind of sense. IIRC the oscillator is billed as > > working at 3.3V, so with a slowly-rising VCC it would presumably > > (possibly?) start working before the processor came out of reset. > > > > Has anyone seen anything like this before, or am I on my own? > > I believe your reasoning is correct. > > I had very similar problem with 68HCS12 because of the clock monitor > circuit. PIC18 does have the clock monitor also. > > Solution: > > Check the bit which tells that the micro is running on the internal osc. > If it is so, initiate the reset. It is convenient to do all of that in > the watchdog reset subroutine.
If oscillator startup delay is the problem then surely the solution is to use a POR circuit with a longer delay before allowing the processor out of reset rather than some sort of software reset loop? Fix rather than mask the problem. Robert -- Posted via a free Usenet account from http://www.teranews.com
Tim Wescott wrote:
>
... snip ..
> > I'm working on a board with a PIC18F8722. We're setting it up to > work in external clock mode with a 40MHz clock. This clock is, in > turn, sourced by an integrated oscillator module from ECS (ECS-8FM). >
... snip ...
> > I'm wondering if the PIC 18 senses that the clock isn't present > coming out of reset and defaults to an internal clock. This seems > screwy, but it makes a twisted kind of sense. IIRC the oscillator > is billed as working at 3.3V, so with a slowly-rising VCC it would > presumably (possibly?) start working before the processor came out > of reset. > > Has anyone seen anything like this before, or am I on my own?
That actually makes sense, provided that the PIC reassigns that clock input pin to some other use when it doesn't find an active clock. I don't have any real answer. -- <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> <http://www.securityfocus.com/columnists/423> <http://www.aaxnet.com/editor/edit043.html> cbfalconer at maineline dot net -- Posted via a free Usenet account from http://www.teranews.com
DISCLAIMER:  I mostly use 16F PICs, but I am somewhat familiar with the 
18F's.

Tim Wescott wrote:
> I have an odd little problem, I'm hoping one of you could shed some > light on it before I spend hours tracking it down. > > I'm working on a board with a PIC18F8722. We're setting it up to work > in external clock mode with a 40MHz clock. This clock is, in turn, > sourced by an integrated oscillator module from ECS (ECS-8FM). > > The problem that we're seeing is that sometimes the thing comes up > going very slowly. I haven't measured timing yet, but it appears to > be running about 5x or 10x slower than it should. The problem is > somehow related to the power source, with faster rise times on the > power supply inducing it much more often. The only lead that I have > on it right now is that with a sharp-rising power supply the > oscillator takes several milliseconds to start up.
> I'm wondering if the PIC 18 senses that the clock isn't present coming > out of reset and defaults to an internal clock. This seems screwy, > but it makes a twisted kind of sense. IIRC the oscillator is billed > as working at 3.3V, so with a slowly-rising VCC it would presumably > (possibly?) start working before the processor came out of reset. > > Has anyone seen anything like this before, or am I on my own?
Allot of what you are describing could possibly be explained by your _CONFIG word values. The oscillator settings can be quite confusing. I assume that your external clock is really 10MHz and you are using the internal 4x multiplier. There is also the oscillator fail detection/switching and two-speed start-up that could be involved. Are you using the power-up timer?
On Thu, 02 Aug 2007 08:25:33 -0500, Anthony Fremont wrote:

> DISCLAIMER: I mostly use 16F PICs, but I am somewhat familiar with the > 18F's. > > Tim Wescott wrote: >> I have an odd little problem, I'm hoping one of you could shed some >> light on it before I spend hours tracking it down. >> >> I'm working on a board with a PIC18F8722. We're setting it up to work >> in external clock mode with a 40MHz clock. This clock is, in turn, >> sourced by an integrated oscillator module from ECS (ECS-8FM). >> >> The problem that we're seeing is that sometimes the thing comes up >> going very slowly. I haven't measured timing yet, but it appears to >> be running about 5x or 10x slower than it should. The problem is >> somehow related to the power source, with faster rise times on the >> power supply inducing it much more often. The only lead that I have >> on it right now is that with a sharp-rising power supply the >> oscillator takes several milliseconds to start up. > >> I'm wondering if the PIC 18 senses that the clock isn't present coming >> out of reset and defaults to an internal clock. This seems screwy, >> but it makes a twisted kind of sense. IIRC the oscillator is billed >> as working at 3.3V, so with a slowly-rising VCC it would presumably >> (possibly?) start working before the processor came out of reset. >> >> Has anyone seen anything like this before, or am I on my own? > > Allot of what you are describing could possibly be explained by your _CONFIG > word values. The oscillator settings can be quite confusing. I assume that > your external clock is really 10MHz and you are using the internal 4x > multiplier. There is also the oscillator fail detection/switching and > two-speed start-up that could be involved. Are you using the power-up > timer?
I am using a clock oscillator that puts out 40MHz, and feeding it straight into the PIC. They mention this as being OK in the data sheet. If you know of an oscillator fail detection/switching, can you tell me where to look in more detail? It seems that this is what is going on, but I haven't found a config bit to turn it off. Any power-up timer stuff is using the default configuration, but I looked at that and it all appears to be counters based off of the main clock. -- Tim Wescott Control systems and communications consulting http://www.wescottdesign.com Need to learn how to apply control theory in your embedded system? "Applied Control Theory for Embedded Systems" by Tim Wescott Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
On Wed, 01 Aug 2007 17:55:43 -0400, Robert Adsett wrote:

> In article <oz3si.25354$RX.179@newssvr11.news.prodigy.net>, Vladimir > Vassilevsky says... >> >> >> Tim Wescott wrote: >> >> > I have an odd little problem, I'm hoping one of you could shed some >> > light on it before I spend hours tracking it down. >> > >> > I'm working on a board with a PIC18F8722. We're setting it up to work >> > in external clock mode with a 40MHz clock. This clock is, in turn, >> > sourced by an integrated oscillator module from ECS (ECS-8FM). >> > >> > The problem that we're seeing is that sometimes the thing comes up going >> > very slowly. I haven't measured timing yet, but it appears to be >> > running about 5x or 10x slower than it should. The problem is somehow >> > related to the power source, with faster rise times on the power supply >> > inducing it much more often. The only lead that I have on it right now >> > is that with a sharp-rising power supply the oscillator takes several >> > milliseconds to start up. >> > >> > I'm wondering if the PIC 18 senses that the clock isn't present coming >> > out of reset and defaults to an internal clock. This seems screwy, but >> > it makes a twisted kind of sense. IIRC the oscillator is billed as >> > working at 3.3V, so with a slowly-rising VCC it would presumably >> > (possibly?) start working before the processor came out of reset. >> > >> > Has anyone seen anything like this before, or am I on my own? >> >> I believe your reasoning is correct. >> >> I had very similar problem with 68HCS12 because of the clock monitor >> circuit. PIC18 does have the clock monitor also. >> >> Solution: >> >> Check the bit which tells that the micro is running on the internal osc. >> If it is so, initiate the reset. It is convenient to do all of that in >> the watchdog reset subroutine. > > If oscillator startup delay is the problem then surely the solution is > to use a POR circuit with a longer delay before allowing the processor > out of reset rather than some sort of software reset loop? Fix rather > than mask the problem. > > Robert >
Ultimately, yes. The PIC18 is supposed to have its own internal POR circuit, so I'd have to add parts to the board. If I can fix it cleanly in software I will. -- Tim Wescott Control systems and communications consulting http://www.wescottdesign.com Need to learn how to apply control theory in your embedded system? "Applied Control Theory for Embedded Systems" by Tim Wescott Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
On Aug 2, 5:10 pm, Tim Wescott <t...@seemywebsite.com> wrote:
> On Thu, 02 Aug 2007 08:25:33 -0500, Anthony Fremont wrote: > > DISCLAIMER: I mostly use 16F PICs, but I am somewhat familiar with the > > 18F's. > > > Tim Wescott wrote: > >> I have an odd little problem, I'm hoping one of you could shed some > >> light on it before I spend hours tracking it down. > > >> I'm working on a board with a PIC18F8722. We're setting it up to work > >> in external clock mode with a 40MHz clock. This clock is, in turn,
Hi Tim, We had a problem when driving a PIC directly. It was solved by putting a small cap of 47pF in series between the oscillator and the PIC. Admittedly it was a 16Fxxx and the frequency was 3.579MHz, but you never know :) Rocky