This page describes the legacy mk1/mk2 disting. For the current product, please see here.
If in doubt, ask.


Here you will find details of
  • How a disting is calibrated.
  • How to use the calibration data in your own code.

Calibration Procedure

Calibration is achieved by providing the board with various inputs and pressing the push button mounted on the board itself.

When the board is awaiting a button press, LED ‘1’ flashes quickly.

Calibration requires a 3V voltage reference. Any stable and accurate voltage source can be used. It's a good idea to let the whole system warm up for 5 minutes before calibrating to stabilise any temperature-dependent factors.

The procedure is as follows:

  1. With the board powered up and with nothing connected to it, press the button.
  2. Wait a few seconds for LED ‘1’ to flash rapidly.
  3. Using patch cables (as short as possible), connect output A to input X, and output B to input Y.
  4. Press the button.
  5. After a short delay, all four jack sockets should light up red. After another short delay, LED ‘1’ will flash rapidly.
  6. Remove the patch cables. Connect the 3V voltage reference to input X.
  7. Verify the reference voltage, and press the button.
  8. Wait a few seconds for LED ‘1’ to flash rapidly.
  9. Connect the 3V voltage reference to input Y.
  10. Verify the reference voltage, and press the button.
  11. After a short pause, the board will reboot, at which point the reference can be removed.

Calibration Data

The disting's calibration data is stored in eight 32 bit words from address 0xBD01FE00 (disting mk1) or 0xBD03FE00 (disting mk2). The first four refer to the left channel (input X/output A); the second four refer to the right channel (input Y/output B).

Each value is a sample of the relevant input under certain conditions. These conditions are

  1. Input disconnected (and therefore grounded)
  2. Input connected to output, output outputting a nominal zero level
  3. Input connected to output, output outputting a nominal half full range level
  4. Input connected to known 3V reference
From these we can derive constants A, Br, D, Er so that conversion between codec codes and actual voltages can be handled simply in the code as follows:
int vL = ( ( inL - A[0] ) * Br[0] ) >> 24;
int vR = ( ( inR - A[1] ) * Br[1] ) >> 24;

int cL = ( ( vOutL - D[0] ) * Er[0] ) >> 24;
int cR = ( ( vOutR - D[1] ) * Er[1] ) >> 24;
where inL/inR are the values read directly from the audio codec, cL/cR are the codes written directly to the audio codec, and vL/vR/vOutL/vOutR are .19 format voltages.

The derivation of A, Br, D, Er is as follows:

Let the four input samples be zeroIn, zeroOut, halfOut, threeVolt.
A = zeroIn
B = ( threeVolt - zeroIn )/3
Br = 0x80000000000LL / B
D = ( zeroOut - zeroIn )/B
E = ( halfOut - zeroOut )/( B * 0x400000 )
Er = 0x80000000000LL / E
The above is pseudo-code - a real C implementation is left as an exercise for the reader.

We use cookies and other tracking technologies to improve your experience on this site. We also link to content on external websites which may also gather information about you when you visit them. This is all perfectly normal. You can find out more about cookies (including how to turn them off) here and you can read our Privacy Policy here.