How to set up clocks in an efficient way for ATSAMD51?

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

Hi,

 

for my ATSAMD51G18 I need exactly two things: a 120 MHz clock for the CPU core and 90 MHz for peripherals, both from an internal clock source. When I try to get this via Atmel START, the solution is really weird and incredibly complicated:

 

32 kHz OSCULP23K -> 32 kHz GCG3 -> 48 MHz DFLL48M -> 3.2 MHz GCG1 -> 120 MHz DPLL0 -> 120 Mhz GCG0 -> 120 Mhz CPU
                                                                  ->  90 MHz DPLL1 ->  90 Mhz GCG4 -> 90 MHz for peripherals

 

So...isn't there a more simple way to get these two clocks? May be with some non-START-code?

 

This topic has a solution.
Last Edited: Wed. Jul 29, 2020 - 06:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sure - you can write your own code.

 

You will need to study the datasheet, understand how all the clock sources, GCLKs, etc work, work out a scheme that gives the clocks you require from the sources you require - and code that!

 

You might look at the Product Page to see if there's any App Notes or examples:

 

https://www.avrfreaks.net/commen...

 

https://www.avrfreaks.net/commen...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

You will need to study the datasheet, understand how all the clock sources, GCLKs, etc work, work out a scheme that gives the clocks you require from the sources you require - and code that!

 

That's a replay...but sorry to say, it is completely useless :-/

 

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

Elmi79 wrote:
That's a replay

No - it's a reply!

 

cheeky

 

 it is completely useless 

Sorry, but if you don't want to use the automated tools - that is the way that you will have to do it.

 

That is the way that we had to do it in "the good old days" (sic?) - before all these fancy tools came along.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, you could look at the Adafruit code:  https://github.com/adafruit/Ardu...

It seems to go through a similar processes, though, with the exception that they go from 48MHz DFLL clock to 1MHz GCG.

(Not "start-based", though.)

 

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

awneil wrote:

Elmi79 wrote:
That's a replay

No - it's a reply!

 

Wow...so you found a typo - what a hero you are! But still: nothing useful added to my question. Is it possible to block people here in this forum?

 

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

In another thread, fearless_fool wrote:
The code generated by Harmony is much cleaner and closer to the processor. 

 

https://community.atmel.com/comm...

 

In #2, I wrote:
You might look at the Product Page to see if there's any App Notes or examples

Doing that, I see:

 

Clock System Configuration and Usage on SAM E5x (Cortex M4) Devices

 

and that uses Harmony.

 

So perhaps that'd be worth a look ... ?

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Perhaps this will help?

 

Steve

Maverick Embedded Technologies Ltd. Home of wAVR and Maven.

wAVR: WiFi AVR ISP/PDI/uPDI Programmer.

Maven: WiFi ARM Cortex-M Debugger/Programmer

https://www.maverick-embedded.co...

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

I have used code that uses an external clock --> a GCLK --> both PLLs.  One PLL at 120MHz for core clock and the other changed on the fly to scale a DDS waveform and the sample rate of an ADC.  Sorry the code belongs to a client.

 

You can configure it in start but there are erratta and you will need to make hand edits.

jeff