Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
resources:eval:user-guides:ad-fmcomms2-ebz:hardware:tuning [04 Apr 2017 01:29] – [Oscillators] Robin Getzresources:eval:user-guides:ad-fmcomms2-ebz:hardware:tuning [22 Feb 2023 15:15] (current) – An error in some calculations David Lacasse
Line 17: Line 17:
 When discussing parts per million (or ppm) stability issues - the size of the actual impact is sometimes is lost. When discussing parts per million (or ppm) stability issues - the size of the actual impact is sometimes is lost.
  
-The 40MHz crystal on the FMCOMMS2/3/4 is an Epson special for Analog Devices (it's a [[http://www5.epsondevice.com/en/products/mhz_range/tsx3225.html|TSX-3225]], with reduced jitter, which in this applications is more important than absolute accuracy [[https://ez.analog.com/thread/50934|datasheet]]). It has a spec of initial frequency tolerance of ±10.0 ppm, frequency stability (temp co) of ±15.0 ppm max, and an aging spec of ±2.0 ppm. This works out to an RMS average (including aging) of ±18.1 ppm. (we do an RMS, since it's statistically unlikely that all deviations would be the max at the same time).+The 40MHz crystal on the FMCOMMS2/3/4 is an Epson special for Analog Devices (it's a [[http://www5.epsondevice.com/en/products/mhz_range/tsx3225.html|TSX-3225]], with reduced jitter, which in this applications is more important than absolute accuracy [[ez>thread/50934|datasheet]]). It has a spec of initial frequency tolerance of ±10.0 ppm, frequency stability (temp co) of ±15.0 ppm max, and an aging spec of ±2.0 ppm. This works out to an RMS average (including aging) of ±18.1 ppm. (we do an RMS, since it's statistically unlikely that all deviations would be the max at the same time).
  
 This ppm specification indicates how much the crystal frequency may deviate from the nominal value. ±10 ppm is ±0.001%, 18.1ppm is 0.00181%. For a 40.000000 MHz crystal, that means 39.99928 to 40.00072 MHz. When this is multiplied up in the baseband PLL and then decimated down this can mean rather than a nominal output data rate of 30.72 MSamples per second, it can be anywhere between 30.72055296 and 30.71944704 MSamples per second, and a 2.400000000 GHz nominal center frequency might be anywhere between 2.4000432 and 2.3999568 GHz. That's a frequency offset of ± 43.2 kHz. This ppm specification indicates how much the crystal frequency may deviate from the nominal value. ±10 ppm is ±0.001%, 18.1ppm is 0.00181%. For a 40.000000 MHz crystal, that means 39.99928 to 40.00072 MHz. When this is multiplied up in the baseband PLL and then decimated down this can mean rather than a nominal output data rate of 30.72 MSamples per second, it can be anywhere between 30.72055296 and 30.71944704 MSamples per second, and a 2.400000000 GHz nominal center frequency might be anywhere between 2.4000432 and 2.3999568 GHz. That's a frequency offset of ± 43.2 kHz.
Line 132: Line 132:
   * F<sub>OSC</sub> = 40.000000 * 1.00001 = 40.0004 MHz   * F<sub>OSC</sub> = 40.000000 * 1.00001 = 40.0004 MHz
   * F<sub>LO</sub> = 40.0004 MHz * 60 = 2400.024 MHz   * F<sub>LO</sub> = 40.0004 MHz * 60 = 2400.024 MHz
-  * F<sub>S</sub> = 40.0004 MHz * 0.192 = 7.680768 MSPS+  * F<sub>S</sub> = 40.0004 MHz * 0.192 = 7.680768 MSPS   <fc #ff0000>"Should be 7.6800768, all others results should be corrected according to this correction"</fc>
   * FFT bin size (for 16384 samples) = 7.680768 MHz / 16384 = 468.796875 Hz/bin   * FFT bin size (for 16384 samples) = 7.680768 MHz / 16384 = 468.796875 Hz/bin
  
Line 160: Line 160:
  
 since everything is a known, but PPM, it can be solved by simple substitution. You can also see from that that lots of bins are good, and things that are away from the LO (have a large bin number) will provide more detail to work on. The actual frequency shouldn't really matter than much, and tuning things at 500MHz, should be similar to tuning things at an LO of 3500 MHz. since everything is a known, but PPM, it can be solved by simple substitution. You can also see from that that lots of bins are good, and things that are away from the LO (have a large bin number) will provide more detail to work on. The actual frequency shouldn't really matter than much, and tuning things at 500MHz, should be similar to tuning things at an LO of 3500 MHz.
 +
 +In this example, we :
 +  * send 2401.0000 MHz tone,
 +  * think we have a 40.000 MHz oscillator (which we know is wrong)
 +  * set the LO to 2400 MHz, (have a <m>MULT_LO</m> of 60)
 +  * set the sample rate to 7.68 MSPS (have a <m>MULT_FS</m> of 0.192)
 +  * do a 16384 point FFT, 
 +  * read the peak of the FFT at bin number 2210.166486
  
 <m>PPM = {2401.0000000 MHz * 16384}/{{40.0000000 MHz} * (0.192 * 2210.166486 + 60 * 16384)}</m> <m>PPM = {2401.0000000 MHz * 16384}/{{40.0000000 MHz} * (0.192 * 2210.166486 + 60 * 16384)}</m>
Line 167: Line 175:
 The more accurate the bin number, the more accurate the ppm offset result will be. You may think a bin number of ''2210.166486'' is contrived - however, it is very easy to actually measure that using [[https://ccrma.stanford.edu/~jos/sasp/Quadratic_Interpolation_Spectral_Peaks.html|Quadratic Interpolation of Spectral Peaks]] to find the actual peak and where it is expected to be in the fractional part of the bin. The three closest peaks fit a parabola (which is a good approximation for narrow CW Tones which have had their energy spread into adjacent bins by a FFT window function), and the actual peak is found. The more accurate the bin number, the more accurate the ppm offset result will be. You may think a bin number of ''2210.166486'' is contrived - however, it is very easy to actually measure that using [[https://ccrma.stanford.edu/~jos/sasp/Quadratic_Interpolation_Spectral_Peaks.html|Quadratic Interpolation of Spectral Peaks]] to find the actual peak and where it is expected to be in the fractional part of the bin. The three closest peaks fit a parabola (which is a good approximation for narrow CW Tones which have had their energy spread into adjacent bins by a FFT window function), and the actual peak is found.
  
-Once we find the offset in terms of ppm, it is a quick matter of programming the system with the correct oscillator value. In the case of -15ppm offset, that would be 39.999400 MHz, or a value of 39,999,400 Hz to be used to set the value in sysfs.+Once we find the offset in terms of ppm, it is a quick matter of programming the system with the correct oscillator value. In the case of -15ppm offset, that would be 39.999400 MHz, or a value of 39,999,400 Hz to be used to set the value in [[/resources/tools-software/linux-drivers/iio-transceiver/ad9361#xo_correction|sysfs]]. 
 + 
 +<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> 
 +<xterm> 
 +C:\Users\rgetz>iio_attr -a -d * xo_correction 
 +Using auto-detected IIO context at URI "usb:1.6.5" 
 +dev 'ad9361-phy', attr 'xo_correction', value :'40000000' 
 +</xterm></WRAP> 
 + 
 +==== Pluto SDR ==== 
 + 
 +To make this easier for ADALM-PLUTO users, the [[https://github.com/analogdevicesinc/plutosdr_scripts/blob/master/cal_ad9361.c|cal_ad9361]] application was created, which is found on your PlutoSDR. All you need to do is find a strong tone (like an ATSC pilot tone), and use that to tune the radio. 
 + 
 +<WRAP box bggreen><wrap info>This specifies any shell prompt running on the PlutoSDR</wrap> 
 +<xterm> 
 +login as: **root** 
 +root@192.168.2.1's password: **analog** 
 +Welcome to: 
 +%%______ _              _________________ 
 +| ___ \ |     | |      /  ___|  _  \ ___ \ 
 +| |_/ / |_   _| |_ ___ \ `--.| | | | |_/ / 
 +|  __/| | | | | __/ _ \ `--. \ | | |    / 
 +| |   | | |_| | || (_) /\__/ / |/ /| |\ \ 
 +\_|   |_|\__,_|\__\___/\____/|___/ \_| \_| 
 +%% 
 +v0.31-dirty 
 +http:%%//%%wiki.analog.com/university/tools/pluto 
 +# **cal_ad9361** 
 + 
 +</xterm></WRAP> 
 + 
 + 
 + 
 +===== Practical considerations ===== 
 + 
 +In the above examples, if you do not account for ADC sample rate offset, you will never be able to get an exact reading. but it might be close enough. For example, if we take the previous example: 
 + 
 +In this example, we : 
 +  * send 2401.0000 MHz tone, 
 +  * think we have a 40.000 MHz oscillator (which we know is wrong) 
 +  * set the LO to 2400 MHz, (have a <m>MULT_LO</m> of 60) 
 +  * set the sample rate to 7.68 MSPS (have a <m>MULT_FS</m> of 0.192) 
 +  * do a 16384 point FFT,  
 +  * read the peak of the FFT at bin number 2210.166486 
 + 
 +And only worry about LO offset, we think the FFT is at 1036015.54 Hz offset from the LO (since we don't correct for 7.68MHz being wrong), and that the actual LO is 36015.54031 Hz off (which gives us a simple -15.0064751302 ppm); and we set the XO correction to 39999399 (which is a small error, but still wrong).  
 + 
 +In most practical examples, it would be fine to ignore this when the sampling rate to RF LO frequency is high (in this case 2400:7.68 or 312.5:1). When LOs are low, and sample rates increase, it creates a larger impact, and can't be ignored.
  
  
  
  
resources/eval/user-guides/ad-fmcomms2-ebz/hardware/tuning.1491262161.txt.gz · Last modified: 04 Apr 2017 01:29 by Robin Getz