数据搜索系统,热门电子元器件搜索
  Chinese  ▼
ALLDATASHEETCN.COM

X  

AN2822 数据表(PDF) 7 Page - STMicroelectronics

部件名 AN2822
功能描述  STM8S and STM8A high speed internal oscillator calibration
PDF  19 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
制造商  STMICROELECTRONICS [STMicroelectronics]
网页  http://www.st.com
标志 STMICROELECTRONICS - STMicroelectronics

AN2822 数据表(HTML) 7 Page - STMicroelectronics

Back Button AN2822 Datasheet HTML 3Page - STMicroelectronics AN2822 Datasheet HTML 4Page - STMicroelectronics AN2822 Datasheet HTML 5Page - STMicroelectronics AN2822 Datasheet HTML 6Page - STMicroelectronics AN2822 Datasheet HTML 7Page - STMicroelectronics AN2822 Datasheet HTML 8Page - STMicroelectronics AN2822 Datasheet HTML 9Page - STMicroelectronics AN2822 Datasheet HTML 10Page - STMicroelectronics AN2822 Datasheet HTML 11Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 7 / 19 page
background image
AN2822
High speed internal oscillator trimming
Doc ID 14983 Rev 2
7/19
The HSI frequency is evaluated from the number of pulses counted by timer TIM3 during
certain calibration signal periods. For noisy mains, where positive and negative half-periods
are not necessarily symmetrical, it is better to measure the whole period and not only the
time difference between the rising and falling edge of the calibration signal.
It is better to measure the number of HSI pulses for several sequential periods to reduce the
uncertainty of the measurement. This is also recommended when using a noisy mains as
the calibration signal. The input capture prescaler can be used for this purpose. It allows
every 1st, 2nd, 4th, or 8th rising edge of the calibration signal to be selected which is then
used to define the time interval for counting HSI pulses. In this way TIM3 is able to store
information about the number of HSI pulses in the capture register at the beginning and at
the end of a measurement.
If required (for example, for validation purposes), the frequency of the HSI oscillator can be
observed on the configurable clock output (CCO) pin.
See Section 2 for an example of a simple post-processing circuit which adapts a mains
signal to a square signal and converts the mains voltage to 5 V power supply voltage.
1.3
Calibration routine
The calibration routine is written in ANSI C. It takes advantage of the STM8S and STM8A
firmware library which is available from www.st.com. It can be simplified and optimized if
needed.
The software compares the number of HSI clock pulses during the certain number L of
calibration period, Tcal (20 ms), with the ideal value (see equation below).
Using this equation, the calibration routine software compares the ideal HSI clock pulse
value (IdealCountedValue) with the nominal oscillator frequency, fHSInominal, during a
defined calibration period, Tcal (20 ms), for a known number of calibration signal periods (L).
Note:
For example, if the nominal HSI frequency is 16 MHz, the defined calibration period, Tcal, is
20 ms (if the mains has a frequency of 50 Hz), and the known number of calibration signal
periods, L, is 8 then the ideal value captured by the timer is 2 560 000 (0x271000)
The calibration algorithm is described in Figure 3.
Calibration starts with initialization of TIM3. The lowest frequency is set by writing
MAX_TRIM_VAL to the CLK_HSITRIMR register. In this way, the trimming value is
decreased in the program loop. The difference between the number of counted HSI pulses
and the ideal value is compared with the previous difference, until either the current
difference becomes greater than the preceding difference, or, until the minimum value
MIN_TRIM_VAL is reached.
If the new difference is greater than the preceding difference, the trimming value is
incremented to the previous value, resulting in the optimum value for calibration.
IdealCountedValue
f
HSI nominal
T
cal
×
L
×
=



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19


数据表 下载

Go To PDF Page


链接网址



ALLDATASHEET是否为您带来帮助?  [ DONATE ] 

关于 Alldatasheet   |   广告服务   |   联系我们   |   隐私政策   |   数据表链接    |   链接交换   |   制造商名单
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com