Clock management AN2752
12/40 AN2752 Rev 6
4 Clock management
4.1 Clock management overview
STM8S and STM8AF devices offer a flexible way of selecting the core and peripheral clocks
(ADC, memory, digital peripherals). As shown in
Figure 5, these devices have internal and
external clock source inputs and one output clock (CCO).
Figure 5. System clock distribution internal clock
4.2 Internal clock
The RC oscillator has an internal capacitor (C) and an internal resistor ladder (R). STM8S
and STM8AF devices have two kinds of internal clock: a high speed internal clock (HSI)
running at 16 MHz and a low speed internal clock (LSI) running at 128 kHz.
After reset, the CPU starts with the internal RC (HSI clock signal) divided by 8, i.e. 2 MHz.
4.3 External clock
STM8S and STM8AF devices can connect to an external crystal or an external oscillator.
Note: When no external clock is used, OSCIN and OSCOUT can be used as general purpose
I/Os.
Figure 6 describes the external clock connections.
1 to 24 MHz
crystal
and external
clock
16 MHz/128 kHz
internal RC
Prescaler
External clock
OSC
OUT
OSC
IN
CCO pin
lnternal clock
Clock distribution
WDG/AWU
Timer
Clock unit
For more details refer to the section on clock management in the datasheet