Configuration for 120MHz CPU clock

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

I'm using Atmel Start to configure a 120Mhz clock for the CPU using the digital phase locked loop DPLL0. My board features an Atmel ATSAMD51J19 with a 32Khz external crystal oscillator that I've specified in the clock configuration to be the source for DPLL0. The following figure describes my clock configuration:

 

This is my DFLL0 configuration:

 

 

(I selected Lock Bypass and Wake Up Fast features per the recommendation in the datasheet errata.) According to the data sheet, the following formula is used to calculate the Loop Divider Ratio (LDR):

 

 

So, if fCLK_DPLL0 = 120Mhz, fCKR = 32KHz, and LDRFRAC = 0, the value that I should enter for LDR to get a 120MHz output is

(125,829,120 / 32,768) - 1 = 3,839

However, Atmel Start indicates the resulting clock is 125.829MHz. What am I doing wrong?

 

This topic has a solution.

Servant

Last Edited: Sun. Nov 24, 2019 - 03:43 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Servant wrote:

So, if fCLK_DPLL0 = 120Mhz, fCKR = 32KHz, and LDRFRAC = 0, the value that I should enter for LDR to get a 120MHz output is

(125,829,120 / 32,768) - 1 = 3,839

However, Atmel Start indicates the resulting clock is 125.829MHz. What am I doing wrong?

 

 

Seems like you got what you asked for. Surely the divisor should be 3662-1?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, Kartman. I was thinking like a software engineer that frequency is specified in binary multiples, but of course it's not. However, the documentation is wrong. While fCLK_DPLLn is specified in hertz (120,000,000), fCKR is a binary multiplier, not a frequency as indicated. Maybe people who work with DPLLs know this, but I'm new to the practice. So,

 

If fCLK_DPLL0 = 120Mhz, fCKR = 32,768, and LDRFRAC = 0, the value that I should enter for LDR to get a 120MHz output is  (120,000,000 / 32,768) - 1 = 3,661. That yields a clock of 119.996 MHz. (Not sure if there's an alternative that yields exactly 120MHz.)

Servant

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fckr is the reference frequency. In this instance is 32768Hz. LDR is the divisor (or multiplier - depends on which way you look at it). You might be able to tweek the frequency a little using the LDRFRAC register.
Your current error is 4000/120000000 or 4/12000 or 1/3000 which is about 0.3%. I’d be happy with that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can't rely on precision clocks.  Each of my devices needs to be calibrated, or literally tuned, coming off the assembly line.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How long do you expect your devices to stay ‘tuned’?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

troy2323 wrote:

I can't rely on precision clocks.  Each of my devices needs to be calibrated, or literally tuned, coming off the assembly line.

 

What is teh ppm of your reference 32khz crystal over temperature?  Your 120Mhz off the assembly line surely wont be exactly that at all times.

 

troy2323 wrote:
I can't rely on precision clocks. 

Yet you want precisely 120Mhz?

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, the tuning is to account for slight variations in the PPM of the crystal.  I know my 120Mhz is not precise, so we have a compensation in the code that relies on a tuning step on the assembly line.  This is for a music synthesizer.  

 

We are just compensating for built-in PPM variation of the crystal, not variation with temp, etc.  So, it stays in tune forever.

 

 

Last Edited: Sun. Dec 1, 2019 - 09:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to divide Crystal clock by 2 wich results in 16.384 kHz. Than LDR = 7323. LDRFRAC = 7. Results in 120 MHz spot on.  Right?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

troy2323 wrote:

We are just compensating for built-in PPM variation of the crystal, not variation with temp, etc.  So, it stays in tune forever.

 

 

How does it stay in tune when it drifts with temperature and ageing?

 

Being a parent, I'd suggest the blipblox would silently disappear into a cupboard never to be found again! All the weird noises would drive me insane unless there was some Devo or Kraftwerk playing!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

troy2323 wrote:
This is for a music synthesizer.  

 

Never heard of a music synthesizer needing THAT level of precision, but hey I still use tube amplifiers in my listening room.  The digital audio stuff I have done never needed the precision you are looking for but then again I know nothing about your gizmo so go forth and prosper :)

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user