comparison doc/RF-cal/VCXO-notes @ 190:2d9b1d69862d

doc: RF calibration documents/notes moved into RF-cal subdir
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 23 Apr 2017 16:47:50 +0000
parents doc/VCXO_calibration@9968717eedd7
children
comparison
equal deleted inserted replaced
189:425f16556e69 190:2d9b1d69862d
1 How to calibrate the VCXO on your FreeCalypso development board
2 ===============================================================
3
4 The process of calibrating the VCXO on a Calypso+Iota+Rita GSM MS consists of
5 the following fundamental parts:
6
7 * The antenna needs to be disconnected and the FreeCalypso device's RF output
8 (SMA on the FCDEV3B) needs to be connected to an RF test station such as an
9 R&S CMU200.
10
11 * The DUT is commanded to transmit semi-continuously as if it were transmitting
12 on TCH: Tx in one timeslot out of 8, but with the DUT running its own notion
13 of the TDMA frame not synchronized to anything, and keep transmitting
14 endlessly in 1/8 out of every 4.615 ms.
15
16 * The RF test station connected to the DUT is used in the RF analyzer mode to
17 measure the frequency offset of the DUT's signal, relative to the ideal uplink
18 frequency corresponding to the selected ARFCN.
19
20 * The above frequency offset measurement is performed with the AFC DAC on the
21 Calypso device set to different values, the results of the initial
22 measurements are used to guide some additional measurements, some computations
23 are made from these results, and the computed values are written into the
24 FreeCalypso device's FFS.
25
26 This procedure is meant to be automated by way of a program that talks both to
27 the FreeCalypso DUT and to the RF test station and orchestrates all of the
28 measurement and computation steps, but until this program gets written (we
29 weren't able to get a hold of TI's original, hence we have to develop our own),
30 use the following instructions to perform the VCXO calibration procedure
31 manually. You still need a CMU200 or equivalent, though - it is not possible
32 to do any kind of calibration on a Calypso device by itself, without connecting
33 it to some appropriate RF test equipment.
34
35 Reference documentation
36 =======================
37
38 We have the following two TI documents which describe some of the RF calibration
39 procedures including the one for the VCXO:
40
41 ftp://ftp.freecalypso.org/pub/GSM/Calypso/rf_calibration.pdf
42
43 https://www.freecalypso.org/LoCosto-docs/Production%20test%20and%20calibration/i_sample_rf_test_and_calibration_13_03_04_01991%20-%20v026.pdf
44
45 Unfortunately neither of them corresponds to the exact evolutionary time point
46 of interest to us: the first one corresponds to some chipset much earlier than
47 the one we are working with, and to firmware versions much earlier than ours,
48 whereas the second one is for TI's later LoCosto chipset.
49
50 Commanding the DUT to transmit semi-continuously
51 ================================================
52
53 There is only one VCXO calibration that is subsequently used for all bands in
54 normal MS operation. Both of the calibration instruction documents above
55 instruct the operator to run the Tx in GSM900 mode on ARFCN 40, hence we shall
56 do likewise until and unless we find some good reason to do differently.
57
58 Issue the following commands through fc-tmsh to start the semi-continuous Tx:
59
60 tms 1 # enter RF Test Mode
61 rfpw 7 6 0 # select GSM 900+1800 band pair, GSM900 band within the pair
62 rfpw 2 40 # set ARFCN to 40
63 rfpw 8 0 # disable AFC algorithm, i.e., control the AFC DAC manually
64 txpw 1 12 # Tx power level
65 rfe 3 # start Rx & Tx without network sync
66
67 WARNING: Before issuing the above commands, ensure that the antenna is
68 disconnected and that the RF output will be going into your test equipment,
69 not on the air! Do not EVER issue these commands with a real antenna connected,
70 unless your intent is to operate a rogue transmitter or jammer.
71
72 At this point your CMU200 or equivalent should detect the uplink signal
73 generated by the DUT (on the CMU200 one needs to set TSC to 5, dunno about
74 other test equipment), and you should see some frequency offset.
75
76 The actual calibration procedure
77 ================================
78
79 1. Set the AFC DAC to -2048:
80
81 rfpw 9 -2048
82
83 and measure the frequency offset. Note it down.
84
85 2. Set the AFC DAC to +2048:
86
87 rfpw 9 2048
88
89 and again measure the frequency offset. Note it down.
90
91 Now you need to create an ASCII text file with your frequency offset
92 measurements. Each line represents one measurement and consists of two fields:
93 the first field is the DAC value and the second field is the measured frequency
94 offset in Hz. On my FCDEV3B S/N 001 the first two measurements were:
95
96 -2048 -30008
97 +2048 +21394
98
99 Next you need to apply a linear model to the VCXO frequency offset as a function
100 of the DAC input: if x is the DAC value and F is the resulting frequency offset,
101 then the linear model is F = ax + b, where a and b need to be determined from
102 two measured points (x1, F1) and (x2, F2). Then once you have a and b, find the
103 x value that should produce F = 0. The fc-vcxo-linear utility will do this math
104 for you: run it with the name of your text file with measurements as its only
105 argument.
106
107 With my measurements, the DAC_CENTER value computed by fc-vcxo-linear is 343.
108 However, the linear model is not perfect, thus when you write this computed
109 value into the DAC with the rfpw 9 command, the resulting frequency offset on
110 the CMU200 screen may be quite far from 0.
111
112 TI's instructions in the LoCosto document direct the calibration operator to do
113 two more measurements at DAC_CENTER-100 and DAC_CENTER+100, where DAC_CENTER is
114 the value we just computed by applying the linear model to the first two
115 measurements. However, in my case the frequency offset at DAC=343 (DAC_CENTER)
116 was so negative that at DAC=443 (DAC_CENTER+100) it was still negative - and I
117 assume that TI's intent was to capture a close range around the zero crossing.
118
119 Therefore, when I get to writing the automated calibration program, I intend to
120 change this part of the algorithm as follows: instead of adding or subtracting
121 100 right now, first do an rfpw 9 with the DAC_CENTER value as computed from
122 the linear model, make a frequency offset measurement, and see if it is negative
123 or positive. Then step the DAC value in the appropriate direction by some
124 reasonable increment (e.g., 100) until the frequency offset changes sign. Then
125 take the two DAC values closest to the output frequency offset sign change.
126
127 After doing the above, my measurement notes file became:
128
129 -2048 -30008
130 +2048 +21394
131 443 -669
132 543 634
133
134 This file needs to contain all four measurements, with the first two being at
135 the extreme DAC values and with the second two hugging the empirically located
136 zero crossing, when you feed it to the next step:
137
138 fc-vcxo-param myvcxo.meas
139
140 The fc-vcxo-param utility will compute the final math steps to produce the
141 actual calibration values which will need to be uploaded to the FreeCalypso
142 device and stored in its FFS. With my measurements above, I got the following
143 output:
144
145 rf_table afcparams
146
147 3434 # Psi_sta_inv
148 15 # Psi_st
149 1000341 # Psi_st_32
150 4293 # Psi_st_inv
151
152 3954 # DAC_INIT * 8
153 -5860 # DAC_MIN * 8
154 11351 # DAC_MAX * 8
155 2560 # snr_thr
156
157 # DAC_INIT: rfpw 10 494
158
159 The output from fc-vcxo-param is in the rf_table format which our implementation
160 of the rftw command takes as input, and the latter is the fc-tmsh command which
161 you will need to issue in order to send this table to the FreeCalypso firmware
162 in the DUT.
163
164 Explanation of the numbers:
165
166 * The Psi constants are computed from the slope of the VCXO, and are
167 subsequently used for the steering: when the DSP reports a particular
168 frequency offset (in the form of an angle in radians), by how much should the
169 DAC value be adjusted? The slope I use for computing these Psi constants is
170 the one from the first two measurements at the extreme DAC values, as the
171 LoCosto document seems to indicate.
172
173 * DAC_INIT is the DAC value at which the resulting frequency offset should be 0;
174 it is computed per the linear model from the second pair of measurements.
175
176 * DAC_MIN and DAC_MAX are the DAC values which should produce frequency offsets
177 of -15 and +15 ppm, respectively, according to the LoCosto document. I
178 compute them per the linear model from the first pair of measurements (the
179 extreme DAC ones), as that is what the LoCosto document says.
180
181 * The SNR threshold is a constant that never needs to change.
182
183 The 3 dac_* values in the afcparams structure are stored in the times 8 form.
184 Examination of the afcparams values read out of several Openmoko-made GTA02
185 units shows that the low 3 bits aren't necessarily zeros, indicating that TI's
186 calibration program probably multiplied by 8 before converting from floating
187 point to integer; I do likewise in fc-vcxo-param.
188
189 Examination of the same afcparams values read out of Openmoko-made units also
190 shows that the center, min and max DAC values do vary quite a bit from one unit
191 to the next, whereas the Psi constants change very little. The Psi constants
192 which my program computed from my manual measurements on FCDEV3B S/N 001 are in
193 the same range as those read out of Openmoko-made units, which is definitely a
194 reassuring sign.
195
196 Writing your VCXO calibration into FFS
197 ======================================
198
199 Save the fc-vcxo-param output in a file, e.g.:
200
201 fc-vcxo-param myvcxo.meas myvcxo.param
202
203 Upload the generated afcparams table to your FreeCalypso device:
204
205 rftw 9 myvcxo.param
206
207 There is one more variable in the firmware, outside of the afcparams structure,
208 which also holds the DAC_INIT value. Set it with an rfpw 10 command as
209 instructed in the last comment line emitted by fc-vcxo-param; in my case it was:
210
211 rfpw 10 494
212
213 Now save all of these values in the non-volatile flash file system:
214
215 me 102
216 me 103
217
218 Cleaning up
219 ===========
220
221 To shut off the transmitter you started earlier, issue this command:
222
223 rfe 0
224
225 Now power off your FreeCalypso device, disconnect the RF test setup, connect the
226 antenna back, insert a SIM, do a fresh boot and see if you can connect to a real
227 live GSM network with your VCXO calibration!