Can an INTERNAL and EXTERNAL oscillator run at the same time?

Thread Starter

camerart

Joined Feb 25, 2013
3,731
Hi,
My project is working using a 32mHz Crystal, and one of the timers I want to use uses PRE and POST scale to achieve the correct timing, that uses an 8mHz INT osc.
Can both internal and external run at the same time.
Camerart
 

Papabravo

Joined Feb 24, 2006
21,258
Hi,
My project is working using a 32mHz Crystal, and one of the timers I want to use uses PRE and POST scale to achieve the correct timing, that uses an 8mHz INT osc.
Can both internal and external run at the same time.
Camerart
In some cases when there are separate oscillators on chip. What does the datasheet have to say on the matter?
 

Thread Starter

camerart

Joined Feb 25, 2013
3,731
Depends on the processor.
On ARM processors, yes they can. It starts up on the internal oscillator, and software can select which oscillator it uses.
Hi P and I,
I'm using an 18F4431 PIC, but after reading the manual, I don't find it clear whether one or both oscillators can be used at the same time. I don't hink it says?
C
 

ericgibbs

Joined Jan 29, 2010
18,988
Hi C,
This clip from the 18F4431 d/s suggests that it cannot be used for an external Xtal.
2.6.1 INTIO MODES
Using the internal oscillator as the clock source can
eliminate the need for up to two external oscillator pins,
which can then be used for digital I/O. Two distinct
configurations are available:

In INTIO1 mode, the OSC2 pin outputs FOSC/4,
while OSC1 functions as RA7 for digital input and
output.
In INTIO2 mode, OSC1 functions as RA7 and
OSC2 functions as RA6, both for digital input and
output


Why do you need two different Xtal clock sources, how will the 8MHz be used?
E
 

Papabravo

Joined Feb 24, 2006
21,258
The information is in the datasheet, but as we know they can be intimidating to assimilate. Refer to datasheet DS39616D-page 34 §3.7 Clock Sources and Oscillator Switching for the rundown. If you still don't get it, then post again and we'll take a walkthrough. The relevant paragraph(s) is

The secondary oscillators are those external sources not connected to the OSC1 or OSC2 pins. These sources may continue to operate even after the controller is placed in a power-managed mode.
...
Most often, a 32.768 kHz watch crystal is connected between the RC0/T1OSO/T1CKI and RC1/T1OSI/ CCP2/FLTA pins. Like the LP Oscillator mode circuit, loading capacitors are also connected from each pin to ground.
Pretty hard to miss IMHO.
 
Last edited:

nsaspook

Joined Aug 27, 2009
13,418
Hi,
My project is working using a 32mHz Crystal, and one of the timers I want to use uses PRE and POST scale to achieve the correct timing, that uses an 8mHz INT osc.
Can both internal and external run at the same time.
Camerart
For most PIC18 devices, yes. There are options to select or have failover for FOSC and usually options to select either with most module (like timers) clocks.
1710613507480.png
 

BobTPH

Joined Jun 5, 2013
9,124
Hi,
My project is working using a 32mHz Crystal, and one of the timers I want to use uses PRE and POST scale to achieve the correct timing, that uses an 8mHz INT osc.
Can both internal and external run at the same time.
Camerart
Are you asking can you use one to clock the processor and one to clock the timer, the answer is no, but you can use a separate (secondary) external oscillator to clock the timer, while the processor is clocked by either the internal or the primary external oscillator.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,731
Hi C,
This clip from the 18F4431 d/s suggests that it cannot be used for an external Xtal.
2.6.1 INTIO MODES
Using the internal oscillator as the clock source can
eliminate the need for up to two external oscillator pins,
which can then be used for digital I/O. Two distinct
configurations are available:

In INTIO1 mode, the OSC2 pin outputs FOSC/4,
while OSC1 functions as RA7 for digital input and
output.
In INTIO2 mode, OSC1 functions as RA7 and
OSC2 functions as RA6, both for digital input and
output


Why do you need two different Xtal clock sources, how will the 8MHz be used?
E
Hi E,
It is complicated to read, but I've been running this on an 8mHz Crystal x4 PLL, successfully.

What I'm trying to do is output 5x Channel PWM, and have spent a long time on different forums, trying to figure it out. I decided on adding a SHIFT REGISTER to the PCB, and using it's output. This is working, so no problem there.

My mate asked me why I don't simply use the PWM output pins, but after the above, decided not to, but he wants to try, so were working on that method as a comparison.
With his method he needs a PRESCALE and a POSTSCALE setting to achieve a 1mS INTERRUPT.
There are so many choices of timer and set-ups, that I thought I'd ask here.
C.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,731
For most PIC18 devices, yes. There are options to select or have failover for FOSC and usually options to select either with most module (like timers) clocks.
View attachment 317779
Hi N,
The main program runs at 32mHz Crystal, after setting it up for years.
My mate wants PRE and POSTSCALE, and I don't see it in Crystal.
(I have difficulty in taking all of the D/S in)
C
 

Thread Starter

camerart

Joined Feb 25, 2013
3,731
Are you asking can you use one to clock the processor and one to clock the timer, the answer is no, but you can use a separate (secondary) external oscillator to clock the timer, while the processor is clocked by either the internal or the primary external oscillator.
Hi B,
I'm afraid that the way you have phrased you reply, is confusing to me!
I'm using an externat Crystal X4PLL=32mHz and want to know if an internal OSC can work along side.
C
 

Thread Starter

camerart

Joined Feb 25, 2013
3,731
The information in the datasheet, but as we know they can be intimidating to assimilate. Refer to datasheet DS39616D-page 34 §3.7 Clock Sources and Oscillator Switching for the rundown. If you still don't get it, then post again and we'll take a walkthrough. The relevant paragraph(s) is

The secondary oscillators are those external sources not connected to the OSC1 or OSC2 pins. These sources may continue to operate even after the controller is placed in a power-managed mode.
...
Most often, a 32.768 kHz watch crystal is connected between the RC0/T1OSO/T1CKI and RC1/T1OSI/ CCP2/FLTA pins. Like the LP Oscillator mode circuit, loading capacitors are also connected from each pin to ground.
Pretty hard to miss IMHO.
Hi P,
Pretty hard to miss IMHO.
If there's too much to miss, I'll read it and not remember, but the time I need to use it.
I may take you up on the offer of a 'walkthrough' later on, thanks.
C
 

nsaspook

Joined Aug 27, 2009
13,418
Hi N,
The main program runs at 32mHz Crystal, after setting it up for years.
My mate wants PRE and POSTSCALE, and I don't see it in Crystal.
(I have difficulty in taking all of the D/S in)
C
Exactly what chip and timer are you talking about. For a PIC18 PRE and POSTSCALE are usually timer parameters that some have and others don't. Using the K42 processor series as an example: TMR2 does and TMR3 does NOT.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,731
Exactly what chip and timer are you talking about. For a PIC18 PRE and POSTSCALE are usually timer parameters that some have and others don't. Using the K42 processor series as an example: TMR2 does and TMR3 does NOT.
Hi N,
18F4431.
Looking at earlier answer #7, I think a choice has to be made, so I don't think 2x can be run at the same time.
C
 

Papabravo

Joined Feb 24, 2006
21,258
Hi P,
Pretty hard to miss IMHO.
If there's too much to miss, I'll read it and not remember, but the time I need to use it.
I may take you up on the offer of a 'walkthrough' later on, thanks.
C
Do you have a copy of the datasheet? Mine is revision D from 2010. Document # DS39616D, titled:
PIC18F2331/2431/4331/4431​
Data Sheet​
 
Top