I have tried a simple LED blink 1s on and 1s off with the settings from page 25 of “DS70216C - Section 39. Oscillator for dsPIC33F/PIC24H”:
http://ww1.microchip.com/downloads/en/D ... 70216C.pdf
It does not work properly. It blinks too fast.
That means improper settings for oscillator registers.
MCLR has 10K attached to it and Watchdog Timer disabled.
The VDD is 3.2Vdc. VCAP is 10uF ceramic multilayer. Decoupling is 100nF. I use the 28pin PDIP package.
FC7 is v 7.2.1. Below it is the simple code used.
Could you help with the proper internal oscillator settings?
dsPIC33FJ128GP802 internal oscillator settings
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: dsPIC33FJ128GP802 internal oscillator settings
Hello,
We have code like this to configure the internal oscillator when using USB on the 16-bit PICs.
Maybe you need something like this in a C icon at the start of the program.
LED flashing too fast means the chip is running faster then you have specified in the project options.
We have code like this to configure the internal oscillator when using USB on the 16-bit PICs.
Maybe you need something like this in a C icon at the start of the program.
Code: Select all
MX_UINT16 pll_startup_counter = 600;
CLKDIVbits.PLLEN = 1;
while(pll_startup_counter--);
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 190
- Joined: Mon Jul 07, 2014 9:38 am
- Has thanked: 30 times
- Been thanked: 77 times
- Contact:
Re: dsPIC33FJ128GP802 internal oscillator settings
dsPIC33FJ128GP802 Datasheet page 147 shows CLKDIV:
http://ww1.microchip.com/downloads/en/D ... 70292G.pdf
There is no PLLEN bit.
http://ww1.microchip.com/downloads/en/D ... 70292G.pdf
There is no PLLEN bit.
-
- Posts: 190
- Joined: Mon Jul 07, 2014 9:38 am
- Has thanked: 30 times
- Been thanked: 77 times
- Contact:
Re: dsPIC33FJ128GP802 internal oscillator settings
Here is the C code with the settings that makes the dsPIC33FJ128GP802 run at (close to) 80MHz with internal oscillator:
Below is the LED blink test code.
Code: Select all
CLKDIVbits.PLLPRE=0; // PLLPRE (N2) 0=/2
PLLFBD=41; // pll multiplier (M) = +2
CLKDIVbits.PLLPOST=0; // PLLPOST (N1) 0=/2
//OSCCON=0x11A0;
//OSCTUN = 0;
while(!OSCCONbits.LOCK); // wait for PLL ready