| 数据搜索系统,热门电子元器件搜索 |
|
AN3258 数据表(PDF) 9 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN3258 数据表(HTML) 9 Page - STMicroelectronics |
|
9 / 16 page ![]() AN3258 HSI calibration Doc ID 17825 Rev 1 9/16 1.4 HSI calibration routine The calibration routines are written in C language. They include STM8A/S firmware library functions. The calibration routine starts with the configuration of the HSI clock prescaler value bits, HSIDIV[1:0], in the CLK_CKDIVR register. The value programmed in the software example is HSIDIV[1:0] = 00 which means, fHSIDIV = fHSI/1 = 16 MHz. The HSI trimming bits, HSITRIM[3:0] or HSITRIM[2:0], in the CLK_HSITRIMR register are kept at reset value. The LINUART peripheral is initialized at baud rate 19200 bps, 8 data bits, 1 stop bit and no parity. LINUART is configured in slave mode (LSLV bit =1) with the automatic resynchronization feature enabled (LASE bit = 1) and the LIN divider update method (LDUM) bit = 0. Both LIN header detection(LHDIEN) and LIN receiver (RIEN) interrupts are enabled. The LINEN bit is set to enable the LIN mode. When a valid LIN header is received by the LIN slave, the LIN receive interrupt is generated. Inside the interrupt service routine, if the LIN header detection flag (LHDF) is set, LDIV_MEAS is read from the BRR1 and BRR2 registers (see Figure 4). Using Equation 4, fMEASURED is calculated. The variation of the HSI oscillator frequency (ΔFREQUENCY) is calculated by using Equation 5. Depending on whether the ΔFREQUENCY is positive or negative, the trimming value (as described in Section 1.1: HSI trimming bits) is written to increase or decrease the HSI oscillator frequency by one trimming step. When the next sync frame is received, the procedure is repeated to check and calibrate the HSI oscillator until the trimming value reaches the upper/lower limit or until the measured ΔFREQUENCY is greater than the value measured with the previous trimming value. The maximum number of valid LIN headers required to calibrate the HSI oscillator is four if three trimming bits are used and eight if four trimming bits are used. |
|
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| 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 |