|
1 | 1 | /* |
| 2 | + Copyright (c) 2017 Scott Price. All right reserved. |
| 3 | + Copyright (c) 2017 MattairTech LLC. All right reserved. |
2 | 4 | Copyright (c) 2015 Arduino LLC. All right reserved. |
3 | 5 |
|
4 | 6 | This library is free software; you can redistribute it and/or |
@@ -49,7 +51,7 @@ void SystemInit( void ) |
49 | 51 | #if SAMC_SERIES |
50 | 52 |
|
51 | 53 |
|
52 | | - /* Set 1 Flash Wait State for 48MHz (2 for the L21 and C21), cf tables 20.9 and 35.27 in SAMD21 Datasheet */ |
| 54 | + /* Set 2 Flash Wait States for the C21, cf table 45-34 in SAMC21 Datasheet */ |
53 | 55 | NVMCTRL->CTRLB.reg |= NVMCTRL_CTRLB_RWS_DUAL ; // two wait states |
54 | 56 |
|
55 | 57 | /* Turn on the digital interface clock */ |
@@ -161,20 +163,11 @@ void SystemInit( void ) |
161 | 163 | GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_MAIN].reg = ( GCLK_GENCTRL_DIV(2) | GCLK_GENCTRL_SRC_DPLL96M | GCLK_GENCTRL_IDC | GCLK_GENCTRL_GENEN ); |
162 | 164 | while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_MASK ); |
163 | 165 |
|
164 | | -#elif (defined(CLOCKCONFIG_INTERNAL) || defined(CLOCKCONFIG_INTERNAL_USB)) |
165 | | - /* ---------------------------------------------------------------------------------------------- |
166 | | - * Enable DFLL48M clock (D21/L21) or RC oscillator (C21) |
167 | | - */ |
168 | | - #if defined(CLOCKCONFIG_INTERNAL_USB) |
169 | | - #error "startup.c: CLOCKCONFIG_INTERNAL_USB setting invalid for C21 chips as they lack USB." |
170 | | - #endif |
171 | | - |
| 166 | +#else // Internal Clock |
172 | 167 | /* Change OSC48M divider to /1. CPU will run at 48MHz */ |
173 | 168 | OSCCTRL->OSC48MDIV.reg = OSCCTRL_OSC48MDIV_DIV(0); |
174 | 169 | while ( OSCCTRL->OSC48MSYNCBUSY.reg & OSCCTRL_OSC48MSYNCBUSY_OSC48MDIV ); |
175 | 170 |
|
176 | | -#else |
177 | | - #error "startup.c: Clock source must be selected in the boards.txt file" |
178 | 171 | #endif |
179 | 172 |
|
180 | 173 |
|
|
0 commit comments