Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

dspic33 internal oscillator frequency

Status
Not open for further replies.

--BawA--

Advanced Member level 1
Joined
Nov 28, 2012
Messages
479
Helped
43
Reputation
86
Reaction score
42
Trophy points
1,318
Location
Noida, INDIA
Activity points
4,926
how to set internal oscillator frequency of 20mhz in dspic33 series MCU? i dont want to use an external crystal oscillator.
 

You can generate a processor clock in this range by using the PLL.
 
It is possible that you cannot. You need to carefully read the oscillator section if the processor manual. The PLL has a limited range of input frequency. The internal high speed oscillator has a fixed frequency and can only be divided by integer multiples. You can probably do lower or higher than 20MHz but not necessarily 20MHz from the internal oscillator.

Keith
 
bigdogguru said:
What is the specific model of dsPIC33 to which you are referring?
I am using DSPIC33FJ32MC202

@ FvM , @keith1200rs
If i use internal FRC whose nominal frequency is 7.37mhz range .and gives its output to onchip PLL (VCO range is 0.8 to 8mhz) followed by a prescaler and postscaler ,will it be possible to achieve a Fcy of 20mhz??
 
Last edited:

Yes, it will be possible. Look at figure 8.2 in the datasheet and choose appropriate divider and PLL multiplier. The chip has a more flexible PLL than the ones found on some other PICs.

Keith
 
If i use internal FRC whose nominal frequency is 7.37mhz range .and gives its output to onchip PLL (VCO range is 0.8 to 8mhz) followed by a prescaler and postscaler ,will it be possible to achieve a Fcy of 20mhz??

Not exactly 20 MHz, but e.g. 19.9 MHz. I presume you have a pocket calculator.

P.S.: 7.37/7*19 gives 20 MHz rather exactly
 
Last edited:
if in case i have to use external crystal oscillator of 20mhz , do i have to set any register bit for that, or simply just connect the oscillator to the MCU ,it will automatic switch to external oscillator rather than using internal one.?
 

how to set internal oscillator frequency of 20mhz in dspic33 series MCU?

I believe it should be pointed out you initially requested an internal oscillator frequency of 20MHz, otherwise referred to as the System Oscillator/Clock (Fosc).

If i use internal FRC whose nominal frequency is 7.37mhz range .and gives its output to onchip PLL (VCO range is 0.8 to 8mhz) followed by a prescaler and postscaler ,will it be possible to achieve a Fcy of 20mhz??

In your second reply you then requested an Instruction Clock (Fcy) frequency of 20MHz.

While two parameters are related, they do NOT refer to the same parameter.

In the case of the dsPIC33F series:

Fcy = Fosc/2

Therefore, to achieve a Fcy of 20MHz, a Fosc of 40MHz must be generated.


BigDog
 

If i use internal FRC whose nominal frequency is 7.37mhz range .and gives its output to onchip PLL (VCO range is 0.8 to 8mhz) followed by a prescaler and postscaler ,will it be possible to achieve a Fcy of 20mhz??
Sorry by mistake i have written Fcy ,,it should be Fosc only.
also please reply to post #8?
 

if in case i have to use external crystal oscillator of 20mhz , do i have to set any register bit for that, or simply just connect the oscillator to the MCU ,it will automatic switch to external oscillator rather than using internal one.?

No the device will not automatically switch from one oscillator configuration to another.

And while there is a default configuration, it is a better policy to always explicitly configure the oscillator.

The DSPIC33FJ32MC202 can operate reliably with a Fosc of 80MHz and a Fcy of 40MHz offering a performance of 40MIPS.

Can I inquire as to the reasons for operating the device at a lower Fosc?


BigDog
 
actually i want to generate a UNIPOLAR SPWM of carrier frequency 20KHz and fundamental 50Hz, i am new to microcontrollers , i just learned it and started working on DSPIC.
For programming i am using "mikroC pro for DSPIC" and for simulations i am using "proteus".
i dont have any valid reasons for operating it on 20MHz,,
at the same time i dont have any problem in using it @ Fosc of 80MHz, but i am confused ,whether to use external oscillator or internal one and how to configure both?
 

You should be able to configure the device to utilize either the internal oscillator or external crystal as the primary clock source.

If you are in need of an example of utilizing an external crystal:

Reference: dsPIC33FJ32MC202/204 and dsPIC33FJ16MC304 Datasheet, Section: 8.1.3 PLL CONFIGURATION, Pages: 102 and 103
For example, suppose a 10 MHz crystal is being used
with the selected oscillator mode of XT with PLL.

Fosc = Fin*(M/(N1*N2))

• If PLLPRE<4:0> = 0, then N1 = 2. This yields a
VCO input of 10/2 = 5 MHz, which is within the
acceptable range of 0.8-8 MHz.

• If PLLDIV<8:0> = 0x1E, then
M = 32. This yields a VCO output of 5 x 32 = 160
MHz, which is within the 100-200 MHz ranged
needed.

• If PLLPOST<1:0> = 0, then N2 = 2. This provides
a Fosc of 160/2 = 80 MHz. The resultant device
operating speed is 80/2 = 40 MIPS.

Fosc = 80MHz = 10MHz * (32/(2*2))

The example details how to utilize a 10MHz crystal to achieve a Fosc of 80MHz and Fcy of 40MHz, stepping you through the required register configurations and their purpose.

You should be able to modify the example to utilize other crystal values or the internal oscillator (FRC).


By the way, are you breadboarding this design?



BigDog
 

thanx Bigdogguru i will make a code to configure the internal oscillator and will show u soon.

bigdogguru said:
are you breadboarding this design?

i am not breadboarding , after completing the code ,i'll use EAGLE to make a PCB layout ,,

also plz take a look on my other post too, https://www.edaboard.com/threads/305547/#post1307611
 


Will do.

You might also download and examine the following:

dsPIC33F/PIC24H Family Reference Manual - Section 7. Oscillator

There are numerous code examples available on the device product page of the Microchip website, the following maybe of particular interest:

CE104 - Dynamic Clock Switching for Low Power Operation

CE108 - Oscillator Failure Traps and Failsafe Clock Monitoring

To test your oscillator configuration, I would recommend toggling an I/O pin high/low and utilizing a oscilloscope, logic analyzer or frequency counter to determine Fcy which can then be used to determine Fosc.

One of the above code examples provides and example of toggling an I/O pin for just such a purpose.


BigDog
 
hi bigdogguru , i have set the oscillator to internal FRC with PLL in order to get a Fcy of 39.4MHz. but when i simulate the circuit in PROTEUS it does not take oscillator frequency of 78.8MHz.
but if i manually change the processor clock frequency (by double clicking on the MCU in proteus) to 78.8MHz .it works perfectly ....so where is the problem ,,why its not configuring in proteus automatically by hex file?
 

It has been some time since I have used Proteus for any simulations, as I typically opt for direct hardware development rather than simulations.

However, if I remember correctly the situation you describe is one of many of Proteus shortfalls.

I believe you must manual set the system clock of microcontroller, as you've described, for it to perform as expected in simulation.

I would suggest breadboarding the dsPIC, loading your oscillator configuration code along with a I/O pin toggle to verify it in actual hardware.

Doing so would also act as a confidence builder and to know you are on the right track.


BigDog
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top