This example shows how to switch between various system clock sources and prescalers at run time.
All SAM4L devices can be used.
The clock system is reconfigured every time the user presses a button (NEXT_BUTTON) to use the next clock source and prescaler settings shown in the state diagram below.
The Systick is used to generate periodic interrupts based on its CPU clock. With each interrupt, a LED (LED_EXAMPLE_OUTPUT) is toggled, thus giving a visual indication of the system clock frequency.
This software was written for the GNU GCC and IAR for SAM. Other compilers may or may not work.
For further information, visit Microchip.