Registered User No edit summary |
Registered User mNo edit summary |
||
Line 1: | Line 1: | ||
==Article purpose== | ==Article purpose== | ||
The purpose of this article is to explain how to calibrate the HSI and CSI oscillators in the [[RCC internal peripheral|RCC]], by using the [[TIM_internal_peripheral#Overview|TIM internal peripheral]] '''TIM12''' and/or '''TIM15''' assigned to the secure monitor ([[TF-A overview|TF-A]] or [[OP-TEE overview|OP-TEE]]). | The purpose of this article is to explain how to calibrate the HSI and CSI oscillators in the [[RCC internal peripheral|RCC]], by using the [[TIM_internal_peripheral#Overview|TIM internal peripheral]] '''TIM12''' and/or '''TIM15''' assigned to the secure monitor ([[TF-A overview|TF-A]] or [[OP-TEE overview|OP-TEE]]). | ||
Line 61: | Line 52: | ||
===Enabling and configuring the calibration service=== | ===Enabling and configuring the calibration service=== | ||
This can be done by enabling options inside the [[Clock_device_tree_configuration_-_Bootloader_specific# | This can be done by enabling options inside the [[Clock_device_tree_configuration_-_Bootloader_specific#HSI_and_CSI_clocks_calibration|clock device tree section]] | ||
<noinclude> | |||
{{PublicationRequestId | 10487 | 2019-02-04 | AnneJ}} | |||
[[Category:How to run use cases]] | |||
</noinclude> |
Latest revision as of 14:47, 3 October 2019
1. Article purpose[edit source]
The purpose of this article is to explain how to calibrate the HSI and CSI oscillators in the RCC, by using the TIM internal peripheral TIM12 and/or TIM15 assigned to the secure monitor (TF-A or OP-TEE).
These clocks are internal oscillators whose frequency can be affected by temperature and voltage variations. To achieve a good clock accuracy, it is important to provide a mechanism to compensate the effects of these variations.
The clock calibration algorithm is based on the comparison of a timer (fed by HSI or CSI) and a clock is derived from the HSE clock that is considered as always accurate.
TIM12 input 1 is connected to hsi_cal_ck
TIM12 input 2 is connected to csi_cal_ck
TIM15 input 7 is connected to hsi_cal_ck
TIM15 input 8 is connected to csi_cal_ck
Refer to STM32MP15 reference manuals for detailed information on the timers.
The algorithm is implemented in the secure monitor. It compares both clocks and programs a correction factor in the RCC peripheral. There are various ways to trigger this service:
- periodically by the secure monitor itself
- upon kernel request through a dedicated SMC
- upon Arm® Cortex®-M4 request through a SEV
2. How to activate the calibration[edit source]
This is done in the secure monitor device tree, in the stm32mp157c-<board>.dts file.
2.1. Configuring the timers[edit source]
The timers used for calibration must be dedicated in the secure context. It cannot be used at the same time by the non-secure world.
Example: timer12-input1 is used for HSI and timer12-input2 for CSI
&timers12 {
secure-status = "okay";
st,hsi-cal-input = <1>;
st,csi_cal-input = <2>;
};
&timers15 {
secure-status = "disabled";
st,hsi-cal-input = <7>;
st,csi_cal-input = <8>;
};
2.2. Enabling and configuring the calibration service[edit source]
This can be done by enabling options inside the clock device tree section