I reported a similar problem some time ago, but never got an answer which made it work
The device is a SAMD21G21A in a Sparkfun breakout board
GCLK2 GENDIV and GENCTRL is set up and enabled, but no peripherals have been changed from the default settings yet
The code is:
GCLK_CLKCTRL_Type gclk_clkctrl; gclk_clkctrl.bit.ID = GCLK_CLKCTRL_ID_TCC0_TCC1_Val; gclk_clkctrl.bit.CLKEN = 1; gclk_clkctrl.bit.GEN = GCLK_CLKCTRL_GEN_GCLK2_Val; GCLK->CLKCTRL.reg = gclk_clkctrl.reg; // 16-bit write */
After execution GCLK->CLKCTRL.CLKEN is not set.
A surprising finding:
If I change the generic clock ID from GCLK_CLKCTRL_ID_TCC0_TCC1_Val to GCLK_CLKCTRL_ID_TCC2_TC3_Val then CLKEN is set!
There's nothing in the Errata document about this
It works OK for SERCOM0 and SERCOM4 as well