Author Topic: Crystal selection for PIC24F series  (Read 5693 times)

0 Members and 1 Guest are viewing this topic.

Offline osmosis321

  • Regular Contributor
  • *
  • Posts: 64
Crystal selection for PIC24F series
« on: February 08, 2011, 05:54:09 pm »
Wow, the 24F series can run at up to 32MHz, all I need to do is get a crystal that runs at that frequency and Bob will be my uncle.  Or so I thought.

When I scoped it, the signal was only 10.6667MHz, and when I read the fine print on the crystal datasheet, wouldn't you know it, 32MHz is the third harmonic.

I know what that means but I don't know what I need to do to get it to operate at full frequency.  The easiest thing to do would be to get a different crystal, but will it really be that simple..?
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 17097
  • Country: gb
  • 0999
Re: Crystal selection for PIC24F series
« Reply #1 on: February 08, 2011, 08:15:58 pm »
Assuming you're using a 32MHz crystal this is pretty common. Adjusting the loading capacitance or being more careful with the layout might help.
 

Offline tecman

  • Frequent Contributor
  • **
  • Posts: 435
  • Country: us
Re: Crystal selection for PIC24F series
« Reply #2 on: February 09, 2011, 05:16:37 am »
Use an 8 Mhz xtal and the internal PLL to get 32 Mhz.

paul
 

Offline osmosis321

  • Regular Contributor
  • *
  • Posts: 64
Re: Crystal selection for PIC24F series
« Reply #3 on: February 09, 2011, 07:19:40 am »
Use an 8 Mhz xtal and the internal PLL to get 32 Mhz.

It can't be that easy..  but I'll try it anyway.
 

Offline alexh

  • Contributor
  • Posts: 11
  • Country: gb
    • Alex' Page
Re: Crystal selection for PIC24F series
« Reply #4 on: February 09, 2011, 08:19:31 am »
As tecman said you can perfectly use for example an 8 MHz crystal (or for that matter a 4, 12, 20MHz, ...). You just need to adjust the PLLDIV. You could even use the 8MHz internal oscillator block; thanks to the PLL you can generate all the required frequencies from that.

Regards,
Alex
 

Offline cyberfish

  • Regular Contributor
  • *
  • Posts: 240
  • Country: gb
Re: Crystal selection for PIC24F series
« Reply #5 on: February 11, 2011, 11:48:54 pm »
I usually use 4MHz crystal for any frequency.

If you want to do UART, or other things that require accurate timing, you'll need an external crystal. Otherwise internal one may work.
 

Offline red_mamba

  • Contributor
  • Posts: 15
Re: Crystal selection for PIC24F series
« Reply #6 on: February 22, 2011, 01:21:04 pm »
You can use internal oscillator for UART to, you just have to tune it to the right frequency  ;)

You could even do an auto tune on start up  :)
 

Offline metalphreak

  • Frequent Contributor
  • **
  • Posts: 815
  • Country: au
  • http://d.av.id.au
    • D.av.id.AU
Re: Crystal selection for PIC24F series
« Reply #7 on: February 23, 2011, 01:27:10 am »
Yeah there's no need to buy a higher frequency crystal for faster operation. For example, the PIC 18F2550 USB chips I've been using lately can be used with 4/8/12/16/20Mhz crystals. All it does internally is divide the  clock signal to get a 4mhz input. A 4Mhz crystal would have NODIV, while 8mhz would have DIV2 and so on. The 4Mhz signal is then used by the PLL to generate the other required frequencies (48Mhz for USB and so on).

If you have a look at the block diagram in the datasheet for the microchip you are using, you can see how it all works :)

Offline ElektroQuark

  • Supporter
  • ****
  • Posts: 1242
  • Country: es
    • ElektroQuark
Re: Crystal selection for PIC24F series
« Reply #8 on: February 23, 2011, 08:46:57 am »
But from the 4 to 20MHz range, is any xtal recommended? If so, why?

Offline tecman

  • Frequent Contributor
  • **
  • Posts: 435
  • Country: us
Re: Crystal selection for PIC24F series
« Reply #9 on: February 23, 2011, 03:21:34 pm »
But from the 4 to 20MHz range, is any xtal recommended? If so, why?

I am not quite sure of your question. 

The internal oscillator is not as accurate or stable as a crystal.  Using the PLL will not be as stable as a crystal of the same frequency.  If clock accuracy and stability are not issues, you have many options for clocking.  As your clock requirements get more stringent, crystals and PLL settings should be reviewed.

Hope this answered your question.

paul
 

Offline ElektroQuark

  • Supporter
  • ****
  • Posts: 1242
  • Country: es
    • ElektroQuark
Re: Crystal selection for PIC24F series
« Reply #10 on: February 23, 2011, 03:48:33 pm »
Sorry.
I will try again:
Is there a preferred frequency due to a better production factor (or whatever) that makes an specific crystal more precise than others?

Offline tecman

  • Frequent Contributor
  • **
  • Posts: 435
  • Country: us
Re: Crystal selection for PIC24F series
« Reply #11 on: February 23, 2011, 06:16:07 pm »
Sorry.
I will try again:
Is there a preferred frequency due to a better production factor (or whatever) that makes an specific crystal more precise than others?

The clock frequency is a function of required performance, and in some cases a specific frequency requirement.  If you are using any UART functions, the data sheet will give you data on serial clock errors based on various clock/multiplier options.  Certain crystals (3.6864 MHz I believe) will give the most accurate UART frequencies.  If you are doing precise counter/timer frequency or time measurements, you may want a 4 MHz for more precise timing.

If neither of these are a factor, then any frequency would work.  Most common is to use a 4 or 8 MHz and PLL up to a higher value.  These are low cost and easy to find in many different packages.

paul
 

Offline ElektroQuark

  • Supporter
  • ****
  • Posts: 1242
  • Country: es
    • ElektroQuark
Re: Crystal selection for PIC24F series
« Reply #12 on: February 23, 2011, 07:30:08 pm »
Thank you, paul.
I didn't known the UART issue.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf