Advertise here

How to setup DFLL 48MHz For Microchip SAM MCU

Digital Frequency Locked loop DFLL 



If you one of the 5 peoples in this world how are using Atmel Start and looking forward to use the higher Frequency for your project , so this article for you, I will show you a simple way to setup DFLL with 48MHz output and use it to run the CPU.

one benefit for this method is that you can use it across any SAM Board / MCU you have.

this method based on Atmel Start and ASF4 , if you are looking to setup the DFLL without any framework please check this link here.

this article will cover the following Boards :
  1. SAMD21 Xplained pro
  2. SAML21 Xplained pro
  3. SAME54 Xplained pro
  4. SAMD11 Xplained pro
  5. SAMD20 Xplained pro.


Let's start with SAMD21(similar to SAMD20):
  • Go to Atmel start


  • click Create New project 
  • Search for SAMD21 and select the SAMD21 Xplained pro.


  • from Clock Panel enable XOSC32K and check the options as in the image.

  • Connect XOSC32K With generic clock generator 3 and don't forget to enable it.


  • Enable DFLL48M clock and connect it with generic clock generator 3 and setup the DFLL48M as in the image below.


  • Connect generic clock generator 0 with DFLL48M and ensure the frequency ~48MHz.


  • from the CPU clock setting option set NVM Wait status to 1.


  • remember to set PB30 as an output (Onboard LED on SAMD21 Xplained pro).

  • download the code and start a project , I did it with simple blinking LED example every 250m Sec.



and here's a video for the code's output





SAML21 Xplained Pro

it's not different from SAMD21 and the result's would be the same.

  • Go to Atmel start
  • click Create New project 
  • Search for SAML21J18 and select the SAML21 Xplained pro.
  • from Clock Panel enable XOSC32K and check the options as in the image.

  • Connect XOSC32K With generic clock generator 3 and don't forget to enable it.

  • Enable DFLL48M clock and connect it with generic clock generator 3 and setup the DFLL48M as in the image below.

  • Connect generic clock generator 0 with DFLL48M and ensure the frequency ~48MHz.

  • from the CPU clock setting option set NVM Wait status to 1 (You can see also that L2x series has more Low power mode options and capabilities compared to SAMD2x series).

  • remember to set P10 as an output (Onboard LED on SAML21 Xplained pro).



  • download the code and start a project , I did like the previous one with simple blinking LED example every 250m Sec.




SAME54 Xplained pro


will not bother you with a lot of words and leave you with photos for how to setup the DFLL48M which is not different from the aforementioned boards.

Go to my Github and download the code and Atmel start file.






The on board LED for SAME54 isPC18 so you need to setup it as an LED0




SAMD11 Xplained pro

SAMD11 Xplained pro doesn't has onBoard XOSC32K crystal but has an internal one so you can use it instead.

Go to my Github and download the code and Atmel start file.














No comments

Powered by Blogger.