36
7734Q–AVR–02/12
AT90PWM81/161
Figure 5-5.
Fuses substitution and clock source selection.
When ‘Enable/Disable Clock Source’, ‘Request for Clock Availability’ or ‘Clock Source Switching’
command is entered, the selected configuration provided by the CLKSELR register is latched for
each targeted clock source.
‘Recover System Clock Source’ command enables the code recovering of clock source used to
drive the system clock. The CKSEL field of CLKSELR register is then updated with this code.
There is no information on the SUT used or status on CKOUT.
Because the selected configuration is latched at clock source level, it is possible to enable many
clock sources at a given time (ex: the internal RC oscillator for system clock + an oscillator with
external crystal). The user’s software has the responsibility of this management.
‘Request for Clock Availability’ command returns the working order of the clock source
addressed. The status is set in the CLKRDY bit of CLKCSR register.
5.3.4
Enable/Disable Clock Source
‘Enable Clock Source’ command selects and enables the clock source provided by the setting of
CLKSELR register (CSEL3..0 and CSUT1:0). CSEL field will select the clock source and CSUT
field will select the start-up time (as CKSEL and SUT fuse bits do it). To be sure that a clock
source has been enabled, it will be better to perform a ‘Request for Clock Availability’ command
after the ‘Enable Clock Source’ command.
‘Disable Clock Source’ command disables the clock source provided by the setting of CLKSELR
register (only CSEL3..0). If the clock source is the one that is used to drive the system clock, the
command is not taken into account.
5.3.5
Clock Availability
‘Request for Clock Availability’ command enables an oscillation-counting of the selected source
clock, CSEL3..0. The count is provided by CSUT1..0. The clock is declared ready (CLKRDY = 1)
when the count is finished. This flag remains unchanged up to a new count. The CLKRDY flag is
reset when the count starts. To perform this checking, the CKSEL and CSUT fields should not
change all long the operation is running.
Two usages are possible:
CLKSEL[3..0]
SUT[1..0]
CKOUT
Register:
CLKSELR
Fuse:
Fuse Low Byte
CSEL[3..0]
CSUT[1..0]
COUT
Default
R/W
Reg.
SEL
Decodeur
SEL-1
SEL-0
SEL-2
SEL-n
CKSEL[3..0]
SUT[1..0]
SEL
Encodeur
EN-1
EN-0
EN-2
EN-n
CKOUT
Reset
SCLKRq
(*)
SCLKRq
(*): Command of Clock Control & Status Register
Internal
Data
Bus
Selected
Configuration
Clock
Switch
Current
Configuration