#include "sam.h"
#include "variant.h"
#include <stdio.h>
◆ GENERIC_CLOCK_GENERATOR_MAIN
#define GENERIC_CLOCK_GENERATOR_MAIN (0u) |
SystemInit() configures the needed clocks and according Flash Read Wait States. At reset:
- OSC8M clock source is enabled with a divider by 8 (1MHz).
- Generic Clock Generator 0 (GCLKMAIN) is using OSC8M as source. We need to: 1) Enable XOSC32K clock (External on-board 32.768Hz oscillator), will be used as DFLL48M reference. 2) Put XOSC32K as source of Generic Clock Generator 1 3) Put Generic Clock Generator 1 as source for Generic Clock Multiplexer 0 (DFLL48M reference) 4) Enable DFLL48M clock 5) Switch Generic Clock Generator 0 to DFLL48M. CPU will run at 48MHz. 6) Modify PRESCaler value of OSCM to have 8MHz 7) Put OSC8M as source for Generic Clock Generator 3
◆ GENERIC_CLOCK_GENERATOR_OSC32K
#define GENERIC_CLOCK_GENERATOR_OSC32K (1u) |
◆ GENERIC_CLOCK_GENERATOR_OSC8M
#define GENERIC_CLOCK_GENERATOR_OSC8M (3u) |
◆ GENERIC_CLOCK_GENERATOR_OSCULP32K
#define GENERIC_CLOCK_GENERATOR_OSCULP32K (2u) /* Initialized at reset for WDT */ |
◆ GENERIC_CLOCK_GENERATOR_XOSC32K
#define GENERIC_CLOCK_GENERATOR_XOSC32K (1u) |
◆ GENERIC_CLOCK_MULTIPLEXER_DFLL48M
#define GENERIC_CLOCK_MULTIPLEXER_DFLL48M (0u) |
◆ SystemInit()