English
Language : 

C8051F340 Datasheet, PDF (143/282 Pages) List of Unclassifed Manufacturers – Full Speed USB Flash MCU Family
C8051F340/1/2/3/4/5/6/7
14.5. System and USB Clock Selection
The internal oscillator requires little start-up time and may be selected as the system or USB clock immedi-
ately following the OSCICN write that enables the internal oscillator. External crystals and ceramic resona-
tors typically require a start-up time before they are settled and ready for use. The Crystal Valid Flag
(XTLVLD in register OSCXCN) is set to ‘1’ by hardware when the external oscillator is settled. To avoid
reading a false XTLVLD, in crystal mode software should delay at least 1 ms between enabling the
external oscillator and checking XTLVLD. RC and C modes typically require no startup time.
14.5.1. System Clock Selection
The CLKSL[1:0] bits in register CLKSEL select which oscillator source is used as the system clock.
CLKSL[1:0] must be set to 01b for the system clock to run from the external oscillator; however the exter-
nal oscillator may still clock certain peripherals (timers, PCA, USB) when the internal oscillator is selected
as the system clock. The system clock may be switched on-the-fly between the internal oscillator, external
oscillator, and 4x Clock Multiplier so long as the selected oscillator is enabled and has settled.
14.5.2. USB Clock Selection
The USBCLK[2:0] bits in register CLKSEL select which oscillator source is used as the USB clock. The
USB clock may be derived from the 4x Clock Multiplier output, a divided version of the internal oscillator, or
a divided version of the external oscillator. Note that the USB clock must be 48 MHz when operating USB0
as a Full Speed Function; the USB clock must be 6 MHz when operating USB0 as a Low Speed Function.
See SFR Definition 14.6 for USB clock selection options.
Some example USB clock configurations for Full and Low Speed mode are given below:
Clock Signal
USB Clock
Clock Multiplier Input
Internal Oscillator
Input Source Selection
Clock Multiplier
Internal Oscillator*
Register Bit Settings
USBCLK = 000b
MULSEL = 00b
Internal Oscillator
Divide by 1
IFCN = 11b
External Oscillator
Clock Signal
Input Source Selection Register Bit Settings
USB Clock
Clock Multiplier
USBCLK = 000b
Clock Multiplier Input
External Oscillator
MULSEL = 01b
External Oscillator
Crystal Oscillator Mode
12 MHz Crystal
XOSCMD = 110b
XFCN = 111b
*Note: Clock Recovery must be enabled for this configuration.
Clock Signal
USB Clock
Internal Oscillator
Clock Signal
USB Clock
External Oscillator
Internal Oscillator
Input Source Selection
Internal Oscillator / 2
Divide by 1
External Oscillator
Input Source Selection
External Oscillator / 4
Crystal Oscillator Mode
24 MHz Crystal
Register Bit Settings
USBCLK = 001b
IFCN = 11b
Register Bit Settings
USBCLK = 101b
XOSCMD = 110b
XFCN = 111b
Rev. 0.5
143