- Last edited 6 months ago ago
How to activate HSI and CSI oscillators calibration
1 Article purpose
The purpose of this article is to explain how to calibrate the HSI and CSI oscillators in the RCC, by using the OP-TEE Calibration PTA. The Linux client application, periodically called by a systemd service. This systemd service is linked to a systemd timer, which defines when to call the application.
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 that is derived from the HSE clock that is considered as always accurate.
2 Linux Daemon
The Linux calibration client relies on the fact that STM32MPU boards supports the systemd suite that starts the system. This suite handles daemons execution with a huge quantity of settings.
Regarding clock calibration: a service, responsible for executing the client calibration binary is linked to a timer.
You can change the timer settings by editing the Timer section in the stm32mp-calibration.timer file. By default, the timer trigger is set to 1 minute with an accuracy of 5 seconds, using the systemd timer OnCalendar and AccuracySec settings:
[Timer] Unit=stm32mp-calibration.service OnBootSec=1min OnCalendar=*-*-* *:*:00 AccuracySec=5sec
The Unit setting is used to specify which service should be called when the timer is triggered. The OnBootSec setting specifies the time after boot at which the timer should start.
3 OP-TEE PTA
The calibration binary is a Client Application (CA) connected to the OP-TEE Calibration PTA.