PIC internal oscillator running fast

E

Eric Behr

Jan 1, 1970
0
I have several 12f629s from different purchases. I just measured
the CLKOUT signal and I'm getting between 1.15 and 1.25 MHz both
with a simple freq. counter (DMM) and a decently calibrated scope.
Vdd between 3 and 5V doesn't make too much difference in what I'm
seeing.

I understand that Microchip INTOSC accuracy specs are optimistic,
but up to 25% off is way more than I expected. Other than really
lousy manufacturing tolerances, what else might be causing this?
Thanks for any ideas or hints.
 
B

Ben Jackson

Jan 1, 1970
0
I have several 12f629s from different purchases. I just measured
the CLKOUT signal and I'm getting between 1.15 and 1.25 MHz both

Did your programmer preserve OSCCAL? Are you setting it at startup?

call H'3FF'
bsf STATUS, RP0
movlw d'174'
movwf OSCCAL
bcf STATUS, RP0

If your programmer has wiped out OSCCAL at 3ff you are going to have
to work out what it should be.
 
E

Eric Behr

Jan 1, 1970
0
Did your programmer preserve OSCCAL? Are you setting it at startup?

I don't believe so; certainly not on all the parts I tried, unless
my PicKit 1 messes it up (Microchip claims that their tools always
preserve it). Plus I didn't think the OSCCAL value can alter the
frequency more than a few %. But I'll play around with it. Thanks.
 
E

Eric Behr

Jan 1, 1970
0
I don't believe so

I meant I believe the programmer preserves it.

But you were absolutely right. It looks like my PicKit was wiping
0x3ff while programming. I can't even complain, because I'm using
Microchip's unsupported Mac OSX software.

I never noticed this because I haven't needed much accuracy in the
past. I now calibrated all the chips I have via trial-and-error.
Live and learn... Thanks very much for prodding me towards this
possibility.
 
B

Ben Jackson

Jan 1, 1970
0
Did your programmer preserve OSCCAL? Are you setting it at startup?

call H'3FF'
bsf STATUS, RP0
movlw d'174'
movwf OSCCAL
bcf STATUS, RP0

Doh, on re-reading this I see that movlw in there for some reason. I
must have manually calibrated the chip I used for the project I was
quoting. So if someone wants to use that snippet, don't keep the
movlw!
 
F

feebo

Jan 1, 1970
0
I meant I believe the programmer preserves it.

But you were absolutely right. It looks like my PicKit was wiping
0x3ff while programming. I can't even complain, because I'm using
Microchip's unsupported Mac OSX software.

I never noticed this because I haven't needed much accuracy in the
past. I now calibrated all the chips I have via trial-and-error.
Live and learn... Thanks very much for prodding me towards this
possibility.
sonow you have them calibrated, what is the variance between them
(clock wise)
 
E

Eric Behr

Jan 1, 1970
0
sonow you have them calibrated, what is the variance between them
(clock wise)

I had to use 0x17 on one of them, 0x1c on another, and 0x23 on two
others. I didn't check the extremes, except I know that they ran at
up to 1.25 MHz CLCKOUT with - I assume - OSCCAL being all 1s.
 
Top