mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/sam3: add opt to use external 32khz oscillator
This commit is contained in:
parent
008faef16a
commit
e5d940fce8
@ -30,6 +30,11 @@
|
||||
#define MORKEY (0x37)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Key for writing the SUPC control register
|
||||
*/
|
||||
#define SUPCKEY (0xa5)
|
||||
|
||||
/**
|
||||
* @brief Start-up time for external crystal (will be multiplied by 8)
|
||||
*/
|
||||
@ -91,6 +96,13 @@ void cpu_init(void)
|
||||
/* wait for master clock to be ready */
|
||||
while (!(PMC->PMC_SR & PMC_SR_MCKRDY));
|
||||
|
||||
/* setup the SCLK: switch to external oscillator if applicable */
|
||||
#if CLOCK_SCLK_XTAL
|
||||
/* enable external oscillator */
|
||||
SUPC->SUPC_CR = (SUPC_CR_KEY(SUPCKEY) | SUPC_CR_XTALSEL);
|
||||
while (!(SUPC->SUPC_SR & SUPC_SR_OSCSEL_CRYST)) {}
|
||||
#endif
|
||||
|
||||
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||
stdio_init();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user