I'm a little confused about how the clock connection to the peripherals works on a SAMC (atmel/microchip). I don't know if the same sort of system is used on other ARM based MCU's.
There are registers in the MAIN CLOCK that have bits to enable the clock to peripherals, this seems to me to be more about the peripherals register/bus interface rather than the actual bulk of the peripheral.
Then there are registers in the GCLK controller that select the clock generator for each peripheral.
So are these two one and the same thing? do I enable them together? Or is the GLCK only needed when I enable the peripheral?
OK so I am writing the ADC setup code, I can set the prescaler without the peripheral clock channel enabled, but the CTRLC register never synchronises without the clock. As I run the ADC from 48MHz but the converter itself must run from at most 16MHz I need to set the prescaler, does this need setting before anything else will work ? At the moment i set the prescaler then enable the peripheral clock channel, it seems to work.