ST STM32L4x6 Reference Manual page 194

Table of Contents

Advertisement

Reset and clock control (RCC)
The input capture channel of the Timer 17 can be a GPIO line or an internal clock of the
MCU. This selection is performed through the TI1_RMP[1:0] bits in the TIM17_OR register.
The possibilities are the following ones:
TIM17 Channel1 is connected to the GPIO. Refer to the alternate function mapping in
the device datasheets.
TIM17 Channel1 is connected to the MSI Clock.
TIM17 Channel1 is connected to the HSE/32 Clock.
TIM17 Channel1 is connected to the microcontroller clock output (MCO), this selection
is controlled by the MCO[2:0] bits of the Clock configuration register (RCC_CFGR).
Calibration of the HSI16 and the MSI
For TIM15 and TIM16, the primary purpose of connecting the LSE to the channel 1 input
capture is to be able to precisely measure the HSI16 and MSI system clocks (for this, either
the HSI16 or MSI should be used as the system clock source). The number of HSI16 (MSI,
respectively) clock counts between consecutive edges of the LSE signal provides a
measure of the internal clock period. Taking advantage of the high precision of LSE crystals
(typically a few tens of ppm's), it is possible to determine the internal clock frequency with
the same resolution, and trim the source to compensate for manufacturing-process- and/or
temperature- and voltage-related frequency deviations.
The MSI and HSI16 oscillator both have dedicated user-accessible calibration bits for this
purpose.
The basic concept consists in providing a relative measurement (e.g. the HSI16/LSE ratio):
the precision is therefore closely related to the ratio between the two clock sources. The
higher the ratio is, the better the measurement will be.
If LSE is not available, HSE/32 will be the better option in order to reach the most precise
calibration possible.
It is however not possible to have a good enough resolution when the MSI clock is low
(typically below 1 MHz). In this case, it is advised to:
accumulate the results of several captures in a row
use the timer's input capture prescaler (up to 1 capture every 8 periods)
use the RTC wakeup interrupt signal (when the RTC is clocked by the LSE) as the
input for the channel1 input capture. This improves the measurement precision. For
this purpose the RTC wakeup interrupt must be enable.
Calibration of the LSI
The calibration of the LSI will follow the same pattern that for the HSI16, but changing the
reference clock. It will be necessary to connect LSI clock to the channel 1 input capture of
the TIM16. Then define the HSE as system clock source, the number of his clock counts
between consecutive edges of the LSI signal provides a measure of the internal low speed
clock period.
The basic concept consists in providing a relative measurement (e.g. the HSE/LSI ratio): the
precision is therefore closely related to the ratio between the two clock sources. The higher
the ratio is, the better the measurement will be.
194/1693
DocID024597 Rev 3
RM0351

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32L4x6 and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF