[time-nuts] Automatic switching of a µC osc. to external 10MHz reference as clock?

Kevin Rosenberg kevin at rosenberg.net
Wed Sep 12 01:31:42 UTC 2012


On Sep 11, 2012, at 4:42 PM, Peter Krengel <krengeldatec at gmx.de> wrote:
> I'm looking for a possibility to make an automatic switching
> between the internal µC oscillator (Atmel µC) to the 10MHz output
> of my thunderbolt to use it as a precise µC clock. Has anybody an idea how to do best
> without disturbing the accuracy of the ref. signal?

Hi Peter,

I'm likely misinterpreting what you want to do. From my reading your question, the answer is: no, you can't the change the source of an AVR's system clock bus at runtime. You can only change the CLKSEL fuses only during programming. CLKSEL sets your AVR to get its system CLK bus from a number of difference sourceson either its internal oscillator or an external clock or crystal, While modern AVR's can read fuse settings at runtime, the values of those fuses can't be modified. I set the fuses on my AVR timers to use the external clock source and feed CLKIN from whatever reference clock I want to use.
 
However, the new XMEGA's do allow more change of clocks during runtime compared to AVRs. Perhaps they may be able to programmatically change the input of its CLK bus.

To have an AVR automatically switch input clock sources, I'd use a supervisory internal (RC) oscillator as CLKSEL. The supervisor can monitor error signal quality as also query for an error conditions for multiple clocks inputs. That supervisory AVR can then control a switch to route the desired clock into the CLKIN of the timing AVRs. A one-time phase offset can be expected during the switch to the new clock input line.

Kevin





More information about the Time-nuts_lists.febo.com mailing list