It is my understanding that when the SAMD21 powers up, it's using a 1MHz internal clock. It is then up to the bootloader, not the fuse settings, to configure the internal clocks.
I have found references to the clock settings in the bootloader here:
* Clock system
* --------------------
* CPU clock source (GCLK_GEN_0) - 8MHz internal oscillator (OSC8M)
* SERCOM5 core GCLK source (GCLK_ID_SERCOM5_CORE) - GCLK_GEN_0 (i.e., OSC8M)
* GCLK Generator 1 source (GCLK_GEN_1) - 48MHz DFLL in Clock Recovery mode (DFLL48M)
* USB GCLK source (GCLK_ID_USB) - GCLK_GEN_1 (i.e., DFLL in CRM mode)
void system_init()
{
/* Configure flash wait states */
NVMCTRL->CTRLB.bit.RWS = FLASH_WAIT_STATES;
/* Set OSC8M prescalar to divide by 1 */
SYSCTRL->OSC8M.bit.PRESC = 0;
/* Configure OSC8M as source for GCLK_GEN0 */
GCLK_GENCTRL_Type genctrl={0};
uint32_t temp_genctrl;
GCLK->GENCTRL.bit.ID = 0; /* GENERATOR_ID - GCLK_GEN_0 */
while(GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY);
temp_genctrl = GCLK->GENCTRL.reg;
genctrl.bit.SRC = GCLK_GENCTRL_SRC_OSC8M_Val;
genctrl.bit.GENEN = true;
genctrl.bit.RUNSTDBY = false;
GCLK->GENCTRL.reg = (genctrl.reg | temp_genctrl);
while(GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY);
#if SAM_BA_INTERFACE == SAM_BA_USBCDC_ONLY || SAM_BA_INTERFACE == SAM_BA_BOTH_INTERFACES
SYSCTRL_DFLLCTRL_Type dfllctrl_conf = {0};
SYSCTRL_DFLLVAL_Type dfllval_conf = {0};
uint32_t coarse =( *((uint32_t *)(NVMCTRL_OTP4)
+ (NVM_SW_CALIB_DFLL48M_COARSE_VAL / 32))
>> (NVM_SW_CALIB_DFLL48M_COARSE_VAL % 32))
& ((1 << 6) - 1);
if (coarse == 0x3f) {
coarse = 0x1f;
}
uint32_t fine =( *((uint32_t *)(NVMCTRL_OTP4)
+ (NVM_SW_CALIB_DFLL48M_FINE_VAL / 32))
>> (NVM_SW_CALIB_DFLL48M_FINE_VAL % 32))
& ((1 << 10) - 1);
if (fine == 0x3ff) {
fine = 0x1ff;
}
dfllval_conf.bit.COARSE = coarse;
dfllval_conf.bit.FINE = fine;
dfllctrl_conf.bit.USBCRM = true;
dfllctrl_conf.bit.BPLCKC = false;
dfllctrl_conf.bit.QLDIS = false;
dfllctrl_conf.bit.CCDIS = true;
dfllctrl_conf.bit.ENABLE = true;
SYSCTRL->DFLLCTRL.bit.ONDEMAND = false;
while (!(SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLRDY));
SYSCTRL->DFLLMUL.reg = 48000;
SYSCTRL->DFLLVAL.reg = dfllval_conf.reg;
SYSCTRL->DFLLCTRL.reg = dfllctrl_conf.reg;
GCLK_CLKCTRL_Type clkctrl={0};
uint16_t temp;
GCLK->CLKCTRL.bit.ID = 0; /* GCLK_ID - DFLL48M Reference */
temp = GCLK->CLKCTRL.reg;
clkctrl.bit.CLKEN = true;
clkctrl.bit.WRTLOCK = false;
clkctrl.bit.GEN = GCLK_CLKCTRL_GEN_GCLK0_Val;
GCLK->CLKCTRL.reg = (clkctrl.reg | temp);
/* Configure DFLL48M as source for GCLK_GEN1 */
GCLK->GENCTRL.bit.ID = 1; /* GENERATOR_ID - GCLK_GEN_1 */
while(GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY);
temp_genctrl = GCLK->GENCTRL.reg;
genctrl.bit.SRC = GCLK_GENCTRL_SRC_DFLL48M_Val;
genctrl.bit.GENEN = true;
genctrl.bit.RUNSTDBY = false;
GCLK->GENCTRL.reg = (genctrl.reg | temp_genctrl);
while(GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY);
#endif
}
This seems to indicate that USB is used when available to enhance the clock using "clock recovery mode" as outlined in section 16.6 on page 157 in the datasheet:
http://www.atmel.com/images/atmel-42181-sam-d21_datasheet.pdf
I had assumed that the 32KHz crystal was there to be used with closed-loop mode on the DFLL, but unless I'm missing something that doesn't appear to be the case, and the crystal isn't used for anything at all.
Of course it would still come in handy when you need a more accurate clock and don't have USB available, or you want to keep time more accurately than the internal oscillator for the RTC allows, but it would be nice to know if the crystal is being used and how to set the board up to use it when the USB clock isn't available if you want more accurate time keeping. The datasheet is confusing, but it seems like enabling it may only involve writing a one to Start the closed loop mode by writing a one to the DFLL Mode Selection bit (DFLLCTRL.MODE) in the DFLL Control
register, assuming all the other stuff mentioned on page 155 is configured by the bootloader.