Project

General

Profile

RTC Calibration Process

Critical Link is happy to discuss the methods and procedures documented here in more detail with any customer. Please contact your Critical Link representative to arrange a call with us.

At this time the Linux kernel driver does not support any specific calibration modes so manual I2C writes are necessary.

The AB18XX application manual discusses how to utilize the varied calibration modes in section 5.9. By default the device is configured with an OSEL of '0' since the XT oscillator/crystal input is present to the device.

Why the need for calibration?

The AB1805 RTC device utilized on the MitySOM module is a VERY low power RTC device that itself is designed to draw less than 330nA of current when powered by a battery. However it was found that the device is ideally designed to drive tuning fork crystals of a 6pF capacitance or lower and even at a 6pF capacitance the drift is still in the 100ppm range and thus must still be calibrated. Note that the RTC stability is not an issue, just the rate at which the RTC can drive the crystal.

Without calibration the RTC will typically drift about 10s/day (about 110ppm) from "real-time" but varies.

With calibration that can be reduced to 1s/day (about 10ppm or less) depending on temperature conditions.

UBoot Calibration and Automatic Usage Method

Critical Link has developed an update to the UBoot software used to boot the MitySOM-5CSx modules. In this update we have added the ability to access a new block in our factory configuration information that can store a calibration value in the EEPROM on the module. This value can then be utilized by UBoot to set the appropriate calibration registers in the AB1805-T3 RTC device based on the value read from the factory configuration EEPROM.

With this software update UBoot automatically loads whatever value is stored in the "RTC Cal Value" field of the factoryconfig EEPROM into a UBoot environment variable called "rtccal". Note that by default this value is "0" which will result in no calibration registers being set by UBoot in the AB1805-T3 RTC device. There is no need to access the calibrations reigsters from Linux with this method and any AB1805-T3 calibration register changes would be overwritten on the next boot cycle by UBoot.

(!) NOTE: Any module with a pre-programmed RTC calibration value will be labeled with a -CAL at the end of the model number, i.e. 5CSX-H6-42A-RC-CAL. In this case customers should NOT alter or re-calibrate the RTC value used. All pre-calibrated, -CAL, modules are calibrated at a temperature of ~25C.

The commit in our GIT repository that added this feature can be seen here (https://support.criticallink.com/gitweb/?p=u-boot-socfpga.git;a=commit;h=918b0bc7c43de19286aba281f08348ece9eed44b). Initial commit comment is below:

This commit adds the support for setting a calibration value to an AB1805 RTC on startup. The calibration will be stored in the factoryconfig as a generic block.The calibration value stored as an integer of PPM * 10. On startup it will be read from factoryconfig and stored as an environment variable (rtccal).

The command set in UBoot for this added feature is as follows:

ab1805 cs calibration_value - write the calibration value to the rtc
ab1805 cal_mode 0|1 - put the rtc into calibration mode

ab1805 cs calibration_value

This command should be added to the "preboot" environment variable in UBoot to ensure that each time the module is powered on and UBoot is executed that the calibration value from the EEPROM is loaded into the RTC. The "calibration_value" field should reference the "rtccal" environment variable that UBoot automatically loaded from the EEPROM, in this example that values is -1800 which equals a PPM adjustment of -180.0ppm:

preboot=run setup_usb; ab1805 cs ${rtccal}

ab1805 cal_mode 0|1

This command, ab1805 cal_mode 1, will enable the square wave output feature of the RTC on the RTC_PSW signal (Pin 256 of the MitySOM and TP12 of the Critical Link dev kit baseboard) at a frequency of 16Hz. After completing a calibration this feature should be turned off, ab1805 cal_mode 0.

The frequency measured/counted is then used to determine the PPM drift. For example if a frequency is counted as 16.00288Hz = a drift of -180.0PPM. This would be saved by Critical Link during factory test into the EEPROM to be used by UBoot as a value of -1800 (PPM * 10).

To compute the PPM:
  • Take the difference from 16.000000Hz compared to your measured value ( 16.00000Hz - 16.00288Hz = -0.00288Hz )
  • Divide by 16 (-0.00288Hz / 16 = -0.000180Hz)
  • This value of -0.000180Hz is the PPM value (i.e. -180.0PPM)
  • The value written to the factoryconfig EEPROM would be -1800 (-180.0 * 10 = -1800) which is then used to determine the calibration register values by UBoot if the value is provided to the "cs" command.

Manual Calibration and Usage Method

Drift Value Determination

The most accurate calibration method is to measure the frequency output from the AB1805 RTC device from either the "CLKOUT" signal (Pin 8 of the AB1805 part) or the RTC_PSW signal (Pin 256 of the MitySOM). Since the CLKOUT signal can only be measured on the bottom side of the module it is preferred to measure the RTC_PSW signal which is available at the edge connector (Pin 256) and TP12 of the Critical Link baseboard. This value is then used to determine the actual calibration value that is entered into the RTC calibration registers.

Using a frequency counter (capable of 6 digits, i.e. 2.123456Hz) you can measure the clock output from the RTC_PSW signal (RTC Pin 4) from the RTC device as a square wave output that directly represents that frequency used by the RTC.

Note that since the RTC_PSW signal is an open-drain signal a pull-up resistor of 1.1k ohms to 3.3V is needed.

The AB1805 must be configured to output a 2Hz square wave on the RTC_PSW signal, this is not the default mode of operation for the signal:

Linux Commands to Enabled PSW Clock Output at 2Hz

i2cset -f -y 0 0x69 0x13 0x8e Enable Square Wave output at 2Hz
i2cset -f -y 0 0x69 0x11 0x24 Enable PSW Square Wave Output

or

UBoot Commands to Enable PSW Clock Output at 2Hz

i2c mw 0x69 13 8e
i2c md 0x69 13 1
i2c mw 0x69 11 24
i2c md 0x69 11 1

The frequency measured/counted is then used to determine the PPM drift. For example is a frequency is counted as 2.000360Hz = a drift of 180PPM.

Take the difference from 2.000000Hz compared to your measured value ( 2.000360Hz - 2.000000Hz = -0.000360Hz ) and divide by 2 (-0.000360Hz / 2 = -0.000180Hz).

This value of -0.000180Hz is the PPM value (i.e. -180.0PPM) which is then used to determine the calibration register values.

Determining Calibration Register Values

Page 45 of the AB1805 Application Manual (http://www.abracon.com/Support/AppsManuals/Precisiontiming/AB18XX-Application-Manual.pdf) discusses converting the PPM value (i.e. 180PPM) to the calibration values starting at step #6.

Writing Calibration Values to the RTC

TBD

Go to top
Add picture from clipboard (Maximum size: 1 GB)