# PDOA average trim per pphm

Hi,

I’m running PDOA algorithm on our own custom board.

I wonder where is the Macro AVG_TRIM_PER_PPHM which is defined in tag.c line 95 came from ? Labortary? Is there a way that I could measure it?

Thanks,
Regards.

1 Like

Hi

For reference, the AVG_TRIM_PER_PPHM value means “the amount of frequency shift in Parts Per Honderd Million for a single unit change of the FS_XTAL crystal trim register”.

This value depends on the hardware, mainly the 38.4MHz crystal and crystal load capacitors.

See example 02f, “RX with crystal trim”, in the DW1000 API examples for more information on how it is used to automatically trim the crystal offset.

You can find this value for your product by:

• Finding the trim range in ppm. This can be done by:
• Setting FS_XTAL to 0x00.
• Having the DW1000 produce a continuous wave.
• Measuring the frequency of the RF port using a spectrum analyzer (or frequency counter).
• Setting FS_XTAL to the max value, 0x1F for DW1000 (0x7F for DW3000).
• Measuring the frequency again.
• Calculating the frequency range, which is the first frequency - second frequency. Divide the frequency range by the target frequency (3993.6 MHz for channel 2, 6489.6 MHz for channel 5, 7987.2MHz for channel 9, …) to get a value in PPM.
• Calculating the frequncy shift in PPM or HPPM:
• AVG_TRIM_PER_PPM = MAX_FS_XTAL / frequency range in PPM
• AVG_TRIM_PER_PPHM = AVG_TRIM_PER_PPM / 100

Note that this value is an average. The actual change of the center frequency based relative to the trim capacitance is not 100% linear. The linearity also depends on the chosen crystal and load capacitance. On our modules we chose the load capacitors to have a trimming range suitable for the entire working temperature range and to have “good enough” linearity.