|
|
View previous topic :: View next topic |
Author |
Message |
mizzard
Joined: 26 Apr 2009 Posts: 11
|
Crystal oscillator in dsPic33fj256gp710 |
Posted: Fri Sep 16, 2011 8:29 am |
|
|
Hello everybody, We are developing a simple project using the dsPic33fj256gp710 I/PF, but we found a lot of problems when we want to work with a 10MHz Crystal Oscillator. We are developing it with CCS compiler and we need to work 40 MIPS.
Do you know how to configure it or wich register we need to modify?
I hope your answer, thank you very much! |
|
|
drolleman
Joined: 03 Feb 2011 Posts: 116
|
|
Posted: Fri Sep 16, 2011 12:29 pm |
|
|
Look at the setup_oscillator() function. |
|
|
mizzard
Joined: 26 Apr 2009 Posts: 11
|
|
Posted: Fri Sep 16, 2011 5:28 pm |
|
|
We use a XT configuration mode, with a crystal and a couple of 22pF capacitor with parallel resistor. We looked for information in dsPIC datasheet and we configure all registers like this:
Code: |
#WORD CLKDIV = 0x0744 //PLLPOST(6,7) - PLLPRE(0,1,2,3,4)
#BIT PLLPOST_1 = CLKDIV.6
#BIT PLLPOST_2 = CLKDIV.7
#BIT PLLPRE_1 = CLKDIV.0
#BIT PLLPRE_2 = CLKDIV.1
#BIT PLLPRE_3 = CLKDIV.2
#BIT PLLPRE_4 = CLKDIV.3
#BIT PLLPRE_5 = CLKDIV.4
#WORD PLLFBD = 0x0746 //PLLDIV(0,1,2,3,4,5,6,7,8)
#BIT PLLDIV_1 = PLLFBD.0
#BIT PLLDIV_2 = PLLFBD.1
#BIT PLLDIV_3 = PLLFBD.2
#BIT PLLDIV_4 = PLLFBD.3
#BIT PLLDIV_5 = PLLFBD.4
#BIT PLLDIV_6 = PLLFBD.5
#BIT PLLDIV_7 = PLLFBD.6
#BIT PLLDIV_8 = PLLFBD.7
#BIT PLLDIV_9 = PLLFBD.8
#WORD OSCCON = 0x0742 // OSWEN(1) - NOSC(9,10,11)
#BIT OSWEN_1 = OSCCON.0
#BIT NOSC_1 = OSCCON.8
#BIT NOSC_2 = OSCCON.9
#BIT NOSC_3 = OSCCON.10
#WORD OSCCONbits = 0x0742
#BIT LOCK = OSCCONbits.7
#BIT COSC_1 = OSCCONbits.12
#BIT COSC_2 = OSCCONbits.13
#BIT COSC_3 = OSCCONbits.14
#use delay(clock=80000000)
OSWEN_1 = 1;
NOSC_1 = 1;
NOSC_2 = 1;
NOSC_3 = 0;
// PLLPRE=0 Luego N1=2
PLLPRE_1 = 0;
PLLPRE_2 = 0;
PLLPRE_3 = 0;
PLLPRE_4 = 0;
PLLPRE_5 = 0;
// PLLPOST=0 Luego N2=2
PLLPOST_1 = 0;
PLLPOST_2 = 0;
// PLLDIV=30 Luego M=32
PLLDIV_1 = 0;
PLLDIV_2 = 1;
PLLDIV_3 = 1;
PLLDIV_4 = 1;
PLLDIV_5 = 1;
PLLDIV_6 = 0;
PLLDIV_7 = 0;
PLLDIV_8 = 0;
PLLDIV_9 = 0;
|
|
|
|
victorcastro89
Joined: 31 Oct 2011 Posts: 11
|
|
Posted: Tue Feb 07, 2012 4:50 pm |
|
|
And it works?
can you post you complete code to help me? |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|