This document describes the features and characteristics of the ST7 microcontroller, specifically the accurate timebase application using the internal RC oscillator.
The document addresses timing inaccuracies caused by variations in the internal RC oscillator found in ST7 microcontrollers. It proposes a software-based calibration method that measures the actual frequency against an external reference (such as 50 Hz mains power) to calculate a deviation fraction.
This calculated fraction is then applied to correct parameters for peripherals such as Timer A PWM and SCI baud rate generators. The note details two algorithms: a basic version taking approximately 30ms and an advanced averaging/glitch filtering version taking about 325ms, providing improved accuracy for low-cost applications.
The basic software routine takes less than 30ms to find the fraction and deviation of the real RC frequency.
The calibration provides a frequency accuracy of approximately 1.05% for a 5 KHz generation.
The calibration provides a baud rate accuracy of approximately 3.84% for a 9600 baud setting.