CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to run a DSPIC33FJ128GP706 at 40MIPS from 12MHz xtal?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
wpd
Guest







How to run a DSPIC33FJ128GP706 at 40MIPS from 12MHz xtal?
PostPosted: Thu May 21, 2009 8:08 pm     Reply with quote

Hello,
I am a newbie to the dsPIC and to CCS. I have the CCS DSP Analog board which has a DSPIC33FJ128GP706 device on it and a 12MHz crystal. I would like to run the cpu at 40 MIPS. From what I've learned, I think there are two possible ways to do this:

1) use the #fuses and #use delay directive to configure the device at boot time:

Code:
#fuses HS, NOWDT, NOCOE, NODEBUG, PR_PLL
#use delay(clock=80M, oscillator=12M)


2) But, the data sheet for the device (70286C) seems to indicate that the device will not power up correctly if the external crystal is not within the range 4MHz < Fin < 8 MHz (section 2.7, page 22 in the PDF). It indicates that I should configure the device in FRC mode and then perform a clock switch to the Oscillator + PLL source. So I tried

Code:
#fuses FRC, NOWDT, NOCOE, NODEBUG
#use delay(clock=7370000)

...
Code:
main()
{
  setup_oscillator(OSC_CRYSTAL, 80000000, 12000000);
#use delay(clock=80000000)
...
}


Neither of these two options seem to work for me. Can anybody point me at some reference that will show how to configure the device to run at 40 MIPS from an external crystal?

Thanks.

--wpd
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu May 21, 2009 11:06 pm     Reply with quote

The datasheet seems to be clear in this regard. You can't clock the PLL from a 12 MHz crystal. PLL input frequency range is 0.8 to 8 MHz. You can run it from the internal oscillator (FRC_PLLxx modes), but then you don't get a crystal accurate frequency.
wpd



Joined: 21 May 2009
Posts: 2

View user's profile Send private message

Datasheet confusion
PostPosted: Fri May 22, 2009 6:15 am     Reply with quote

Now I'm really confused, because section 9.1.3 of the same data sheet goes on to say that "Fin must be chosen to be in the range of 1.6 MHz to 16
MHz", implying that my 12MHz oscillator should be fine.

Regardless, I cannot figure out how to use the PLL to run the CPU at 40MIPs. Can anybody recommend a source for learning how to do this?

Thanks.

--wpd
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri May 22, 2009 9:28 am     Reply with quote

Yes, you are right. I didn't read the datasheet thorougly.

The 8 MHz limitation applies for PLL startup through crystal oscillator only (see datasheet 2.7). You can use a 12 MHz crystal, but then startup must be performed from FRC and the oscillater switched over to crystal afterwards.

For 40 MIPS respectively 80 MHz Fosc, N1 = 3 and M = 20 can be selected. 12/3*20 = 80

Because I don't have a dsPIC33 at hand to check the settings and also thecorrect handling in PCD, I can't give detailed suggestions how to setup the oscillator.
wpd



Joined: 21 May 2009
Posts: 2

View user's profile Send private message

PostPosted: Fri May 22, 2009 8:24 pm     Reply with quote

Is there some example code that shows how to start up in FRC mode and then switch to the crystal afterwards? Nothing I've tried seems to work.

--wpd
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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