Difference between revisions of "OP-TEE Calibration PTA overview"

[quality revision] [pending revision]
m
m (Keep systemd)
 

This article gives information about the OP-TEE OS Calibration PTA.

1 PTA Calibration purpose[edit]

The purpose of this article is to explain how to access to the HSI and CSI oscillators calibration service.

These internal oscillators are initially calibrated at chip production level. ButHowever, they can be affected by temperature and voltage variations and it . It is important to provide a mechanism to compensate the effects of these variations to achieve a good frequency accuracy.

The service provides a way to calibrate the oscillator based on timer comparison between an oscillator and a refence clock derived from the HSE clock that is considered always accurate.

Refer to STM32MP13 reference manuals or STM32MP15 reference manuals for detailed information on the timer channels that can be used for HSI or CSI calibration input.

2 System overview[edit]

Calibration overview

2.1 Components description[edit]

Non secure world:

  • Calibration Timer (User Space): User space service (systemd based) that calls the calibration binary at every chosen timer expiration. See How to activate HSI and CSI oscillators calibration to manage the service.
  • Calibration (User Space): User space client application that connects to the calibration PTA over a session to request the calibration execution.

Find these calibration features at : stm32mp-calibration/

  • TEE Core API Lib (User Space): Library called by the client application to access to the kernel space.
  • OP-TEE driver (Kernel Space): Generic driver that send the message to the OP-TEE OS.

Secure Worldworld:

  • Calibration PTA (OP-TEE core): Interface that exposes the calibration specific services.
  • Calibration driver (OP-TEE core): Specific calibration driver that control controls and calculate calculates the calibration values.
  • TIM driver (OP-TEE core): Timer driver using the OP-TEE counter framework.
  • STM32 peripherals (Hardware): Access to hardware specific peripherals (RCC, TIM) under firewall access control.

2.2 API description[edit]

The calibration PTA offers a single interface to request a calibration. The calibration is started on HSI and/or CSI depending the calibration driver initialization defined using the Calibration_device_tree_configuration.

3 Configuration[edit]

3.1 OP-TEE_OS configuration[edit]

Activate Calibration PTA in OP-TEE configuration core/arch/arm/plat-stm32mp1/conf.mk :

CFG_STM32_CLKCALIB ?=y

3.2 Device tree configuration[edit]

Detailed DT configuration for STM32 internal peripherals:

4 How to use the framework[edit]

A default calibration application is released in the OpenSTLinux ecosystem to give a reference implementation for the calibration service.

5 References[edit]




This article gives information about the OP-TEE OS Calibration PTA.
==PTA Calibration purpose==
The purpose of this article is to explain how to access to the HSI and CSI oscillators calibration service.

These internal oscillators are initially calibrated at chip production level. ButHowever, they can be affected by temperature and voltage variations and it . It is important to provide a mechanism to compensate the effects of these variations to achieve a good frequency accuracy.

The service provides a way to calibrate the oscillator based on [[TIM_internal_peripheral|timer]] comparison between an oscillator and a refence clock derived from the HSE clock that is considered always accurate.

Refer to [[STM32MP13 resources#Reference manuals|STM32MP13 reference manuals]] or [[STM32MP15 resources#Reference manuals|STM32MP15 reference manuals]] for detailed information on the timer channels that can be used for HSI or CSI calibration input.

==System overview==
[[File:OP-TEE_Calibration.png |thumb|center|upright=3|Calibration overview]]

===Components description===
Non secure world:
* '''Calibration Timer''' (User Space): User space service (systemd based) that calls the calibration binary at every chosen timer expiration. See [[How_to_activate_HSI_and_CSI_oscillators_calibration| How to activate HSI and CSI oscillators calibration]] to manage the service.
* '''Calibration''' (User Space): User space client application that connects to the calibration PTA over a session to request the calibration execution.
Find these calibration features at : {{CodeSource | optee-stm32mp-addons | stm32mp-calibration/}}<br>

* '''TEE Core API Lib''' (User Space): Library called by the client application to access to the kernel space.
* '''OP-TEE driver''' (Kernel Space): Generic driver that send the message to the OP-TEE OS.
Secure Worldworld:
* '''Calibration PTA''' (OP-TEE core): Interface that exposes the calibration specific services.
* '''Calibration driver''' (OP-TEE core): Specific calibration driver that controlcontrols and calculatecalculates the calibration values.
* '''TIM driver''' (OP-TEE core): Timer driver using the OP-TEE counter framework.
* '''STM32 peripherals''' (Hardware): Access to hardware specific peripherals ([[RCC_internal_peripheral|RCC]], [[TIM_internal_peripheral|TIM]]) under firewall access control.

===API description===
The calibration PTA offers a single interface to request a calibration. The calibration is started on HSI and/or CSI depending the calibration driver initialization defined using the [[Calibration_device_tree_configuration]].

==Configuration==
===OP-TEE_OS configuration===
Activate '''Calibration PTA''' in OP-TEE configuration {{CodeSource | OP-TEE_OS | core/arch/arm/plat-stm32mp1/conf.mk}}:

 CFG_STM32_CLKCALIB ?=y

===Device tree configuration===
Detailed DT configuration for STM32 internal peripherals:
* [[TIM device tree configuration]]
* [[Calibration device tree configuration]]

==How to use the framework==
A default calibration application is released in the OpenSTLinux ecosystem to give a reference implementation for the calibration service.

==References==<references />

<noinclude>

{{ArticleBasedOnModel | Framework overview article model}}
{{PublicationRequestId | 24113 | 2022-07-27 | }}
[[Category:OP-TEE_Clock]]</noinclude>
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
This article gives information about the OP-TEE OS Calibration PTA.
 
This article gives information about the OP-TEE OS Calibration PTA.
 
 
==PTA Calibration purpose==
 
==PTA Calibration purpose==
The purpose of this article is to explain to access to the HSI and CSI oscillators calibration service.
+
The purpose of this article is to explain how to access the HSI and CSI oscillators calibration service.
   
These internal oscillators are initially calibrated at chip production level. But, they can be affected by temperature and voltage variations and it is important to provide a mechanism to compensate the effects of these variations to achieve a good frequency accuracy.
+
These internal oscillators are initially calibrated at chip production level. However, they can be affected by temperature and voltage variations. It is important to provide a mechanism to compensate the effects of these variations to achieve a good frequency accuracy.
   
 
The service provides a way to calibrate the oscillator based on [[TIM_internal_peripheral|timer]] comparison between an oscillator and a refence clock derived from the HSE clock that is considered always accurate.
 
The service provides a way to calibrate the oscillator based on [[TIM_internal_peripheral|timer]] comparison between an oscillator and a refence clock derived from the HSE clock that is considered always accurate.
Line 21: Line 20:
 
* '''TEE Core API Lib''' (User Space): Library called by the client application to access to the kernel space.
 
* '''TEE Core API Lib''' (User Space): Library called by the client application to access to the kernel space.
 
* '''OP-TEE driver''' (Kernel Space): Generic driver that send the message to the OP-TEE OS.
 
* '''OP-TEE driver''' (Kernel Space): Generic driver that send the message to the OP-TEE OS.
Secure World:
+
Secure world:
 
* '''Calibration PTA''' (OP-TEE core): Interface that exposes the calibration specific services.
 
* '''Calibration PTA''' (OP-TEE core): Interface that exposes the calibration specific services.
* '''Calibration driver''' (OP-TEE core): Specific calibration driver that control and calculate the calibration values.
+
* '''Calibration driver''' (OP-TEE core): Specific calibration driver that controls and calculates the calibration values.
 
* '''TIM driver''' (OP-TEE core): Timer driver using the OP-TEE counter framework.
 
* '''TIM driver''' (OP-TEE core): Timer driver using the OP-TEE counter framework.
 
* '''STM32 peripherals''' (Hardware): Access to hardware specific peripherals ([[RCC_internal_peripheral|RCC]], [[TIM_internal_peripheral|TIM]]) under firewall access control.
 
* '''STM32 peripherals''' (Hardware): Access to hardware specific peripherals ([[RCC_internal_peripheral|RCC]], [[TIM_internal_peripheral|TIM]]) under firewall access control.
Line 49: Line 48:
 
<noinclude>
 
<noinclude>
 
{{ArticleBasedOnModel | Framework overview article model}}
 
{{ArticleBasedOnModel | Framework overview article model}}
  +
{{PublicationRequestId | 24113 | 2022-07-27 | }}
   
 
[[Category:OP-TEE_Clock]]
 
[[Category:OP-TEE_Clock]]
 
</noinclude>
 
</noinclude>