The following 4 clock sources are available for the master clock:
- 1-24mhz High-speed external crystal oscillator (HSE)
- Maximum 24MHz high speed external clock signal (HSE user-ext)
- 16MHz high-speed internal RC oscillator (HSI)
- 128KHz low-speed internal RC (LSI)
Individual clock sources can be turned on or off individually to optimize power consumption.
A The HSE high-speed external clock signal can be generated by the following two clock sources:
- HSE external crystal/ceramic resonators
- HSE user external Active clock
(Figure 14:STM8 HSE clock Source)
To minimize output distortion and reduce the settling time of startup, the resonator and load capacitance should be as close to the oscillator pin as possible. The load capacitance value should be adjusted according to the selected oscillator.
Two The HSI HSI signal is generated by the internal 16MHz RC oscillator and a programmable divider (divide factor from 1 to 8). The divider factor is determined by the register CLK_CKDIVR.
Note: At startup, the main clock source defaults to 8 of the HSI RC clock, i.e. the FHSI/8 HSI RC can provide a low-cost 16MHz clock source (no external device required) with a duty ratio of 50%. HSI starts faster than a HSE crystal oscillator, but its accuracy is still lower than that of an external crystal oscillator or ceramic resonator even after calibration. The flag bit hsirdy in the internal clock register Clk_ickr is used to indicate whether the HSI RC is stable. At startup, the HSI clock signal will not take effect until this flag bit is set by the hardware. HSI RC can be turned on or off by setting the hsien bit in the internal clock register Clk_ickr.
- Backup clock Source when the HSE crystal oscillator fails, the HSI/8 can be used as a backup clock source (auxiliary clock source). See 8.6 Clock security System (CSS).
- Quick Start feature if the FHWU bit in the register Clk_ickr is set to 1, then the MCU wakes up from the shutdown (Halt) mode or active stop (active Halt) mode and the HSI is automatically provisioned as the primary clock source.
- Calibration of each product is already St calibrated at the factory. After resetting, the factory calibration values are automatically loaded into the internal calibration register. If the voltage or temperature deviation in the actual application is large, the speed of the RC oscillator will be affected. The HSI Clock Calibration register (CLK_HSITRIMR) can be used to correct the clock frequency of HSI. There are 3 or 4 bits in this register to hold an additional correction value and add the value of the internal HSI calibration register to correct the clock.
Three LSI 128KHz's LSI RC clock is a low-power, low-cost, optional master clock source, and a low-power clock source that maintains independent watchdog and automatic wake-up units (AWU) in shutdown (Halt) mode. LSI can be turned on or off by setting the Lsien bit in the internal clock register Clk_ickr. The flag bit lsirdy in the internal clock register Clk_ickr is used to indicate whether the LSI is stable. At startup, the LSI clock signal will not take effect until this flag bit is set by the hardware. As with his, LSI is factory calibrated. However, no further calibration can be performed. Note: When the independent watchdog uses LSI as the clock source, in order to ensure that the CPU does not use the same clock as the independent watchdog when the system is faulted, the lsi_en byte bit is 0 o'clock and LSI cannot be the primary clock. See the section on option bytes in the STM8 data sheet.
STM8 Clock Source