STM8 Clock Source

Source: Internet
Author: User

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.

    • External Crystal/Ceramic resonators (HSE crystals) external oscillator 1 to 24MHz has the advantage of being able to produce an accurate primary clock signal with a duty ratio of 50%. Hardware connection 14 is shown. See the electrical characteristics section of the data sheet for more details. The output clock signal at the start of the oscillator is not stable, and by default, a delay of 2048 oscillator cycles is inserted before the clock signal is used. The user can shorten the settling time by setting the option byte hsecnt, see the option byte section of the data sheet. The flag bit hserdy in the external clock register CLK_ECKR indicates whether the high-speed external oscillator is stable. At startup, the HSE clock signal will not take effect until this flag bit is set by the hardware. The HSE crystals can be turned on or off by setting the Hseen bit in the external clock register Clk_eckr.
    • External clock Source (HSE user external clock) in this mode, an external clock must be provided by the user, and the maximum frequency of the clock can be 24MHz. The user can select this mode through the programming option bit EXTCLK. See the option byte section of the data sheet for details. At this point, the external clock signal (square wave, sine wave, triangle) of about 50% of the duty ratio is used to drive the oscin pin, while the oscout pin is available as a general-purpose input/output pin. See Figure 13.

      (Figure 13:stm8 Clock tree)

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.