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)
|
#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)
|
* @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 */
|
/* wait for master clock to be ready */
|
||||||
while (!(PMC->PMC_SR & PMC_SR_MCKRDY));
|
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 */
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
stdio_init();
|
stdio_init();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user