STM8L15x Standard Peripherals Drivers
|
Low Speed Internal Clock(LSI) Calibration functions. More...
Functions | |
void | BEEP_LSClockToTIMConnectCmd (FunctionalState NewState) |
Enable or disable the LS clock source connection to TIM for measurement. | |
void | BEEP_LSICalibrationConfig (uint32_t LSIFreqHz) |
Update CSR register with the measured LSI frequency. |
Detailed Description
Low Speed Internal Clock(LSI) Calibration functions.
=============================================================================== Low Speed Internal Clock(LSI) Calibration functions =============================================================================== This section provides functions allowing to measure and calibrate the internal low speed clock source to ensure better BEEPER output frequency . A typical configuration for LSI calibration is done following these steps : 1. Disable the Beeper to avoid any unwanted interrupt using BEEP_Cmd() function 2. Measure the LSI clock frequency by connecting it internally to TIM2 input capture using BEEP_LSClockToTIMConnectCmd() function. 3. Calibrate the beeper frequency with the measured LSI clock frequency using BEEP_LSICalibrationConfig() function.
Function Documentation
void BEEP_LSClockToTIMConnectCmd | ( | FunctionalState | NewState | ) |
Enable or disable the LS clock source connection to TIM for measurement.
Definition at line 172 of file stm8l15x_beep.c.
References BEEP, BEEP_CSR1_MSR, DISABLE, and IS_FUNCTIONAL_STATE.
void BEEP_LSICalibrationConfig | ( | uint32_t | LSIFreqHz | ) |
Update CSR register with the measured LSI frequency.
- Note:
- BEEP must be disabled to avoid unwanted interrupts.
- Prescaler calculation: A is the integer part of LSIFreqkHz/4 and x the decimal part. x <= A/(1+2A) is equivalent to A >= x(1+2A) and also to 4A >= 4x(1+2A) [F1] but we know that A + x = LSIFreqkHz/4 ==> 4x = LSIFreqkHz-4A so [F1] can be written : 4A >= (LSIFreqkHz-4A)(1+2A)
Definition at line 201 of file stm8l15x_beep.c.
References BEEP, BEEP_CSR2_BEEPDIV, and IS_LSI_FREQUENCY.