Asynchronous Sample Rate Conversion (drift compensation)


This program implements an interpolator used for the compensation of frequency drifts. The technique is based on a first-order recursive filter. There is one input parameter to set the amount of drift to be compensated for. The amount of drift is usually in the range of few percent down to few ppm.

The code is written in fixed-point C using 16×16=32bits arithmetics. When ported on CortexM4 (LPC54x from NXP running at 12MHz without memory wait-states) the code is processing one sample every 18 cycles. This number is obtained without the need to optimize the critical loops in assembly language.

The demonstration files and executable (BATCH_DRIFT.BAT) are located here.

Signal processing performances

The plots below are computed with the Matlab  tool “THDN”. From left to right the output files from the demonstrator are analyzed. The output signal distortion is  95dB, 60dB, 44dB respectively using 100ppm, 1000ppm and 1% drift compensation parameters.

« THDN » description is located here.

100ppm drift compensation

1000ppm drift compensation

10000ppm (1%) drift compensation