In my circuit I have a separate clock generator, which I plan to use as CPU core clock. The problem is that by default my generator outputs 1MHz clock, which I would like to change to 10MHz by AVR program. So my AVR will be initially clocked at 1MHz, and later at 10MHz. Is such a rapid change possible? Can it influence the processor operation?
CPU core clock change
which I would like to change to 10MHz by AVR program
Most of the spec sheets warn about limiting the rate of change of clock frequency.
Jim
As Jim mentined, some data sheets limit the rate of change of the clock when the clock is provided by an external clock.
The Mega164/324/644/128 series, for example, states:
When applying an external clock, it is required to avoid sudden changes in the applied clock frequency to ensure stable operation of the MCU. A variation in frequency of more than 2% from one clock cycle to the next can lead to unpredictable behavior. If changes of more than 2% is required, ensure that the MCU is kept in Reset during the changes.
Note, however, that the Xmega series can switch easily from 1 to 10 MHz, and back again, without worries.
JC
I use RFM22 radio module, which can output selectable clock. But by default it outputs 1MHz clock, which is to slow for me, but later I can switch it to 10MHz. Do you think that watch dog can help me? For example I can enable WD, switch the frequency, WD can reset a CPU if something goes wrong, and from this moment microcontroller will be operating at 10 MHz.
Are you building one for a non-critical system?
Why not just put a crystal on the uC and run at whatever speed you want the entire time?
JC
Yes, I will put a crystal. Just RFM22 has its own crystal, so I was thinking that it will be easy to use it.