comparison autocal/vcxomain.c @ 24:0b6881281d86

fc-rfcal-vcxo ready for first test
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 22 May 2017 22:00:36 +0000
parents 9a9fd9ebe799
children a2e4da9d85cc
comparison
equal deleted inserted replaced
23:9a9fd9ebe799 24:0b6881281d86
9 #include "stdband.h" 9 #include "stdband.h"
10 10
11 #define VCXOCAL_BAND 900 11 #define VCXOCAL_BAND 900
12 #define VCXOCAL_BAND_RFPW RFPW_STD_BAND(6, 0) 12 #define VCXOCAL_BAND_RFPW RFPW_STD_BAND(6, 0)
13 #define VCXOCAL_ARFCN 40 13 #define VCXOCAL_ARFCN 40
14
15 extern float vcxo_freq_meas();
16
17 static float freq_max_neg, freq_max_pos;
18 static float lin_a, lin_b, lin_a2, lin_b2;
19 static int center_search_start;
14 20
15 prepare_rf_test_system() 21 prepare_rf_test_system()
16 { 22 {
17 char cmd[80]; 23 char cmd[80];
18 24
37 do_rfpw(AFC_ENA_FLAG, 0); 43 do_rfpw(AFC_ENA_FLAG, 0);
38 do_txpw(TX_PWR_LEVEL, 12); 44 do_txpw(TX_PWR_LEVEL, 12);
39 printf("Starting RF Tx on the DUT\n"); 45 printf("Starting RF Tx on the DUT\n");
40 do_rfe(RX_TX_TCH); 46 do_rfe(RX_TX_TCH);
41 47
48 /* initial measurements at the DAC extremes */
49 freq_max_neg = vcxo_freq_meas(-2048, "max-neg");
50 freq_max_pos = vcxo_freq_meas(2048, "max-pos");
51 lin_a = (freq_max_pos - freq_max_neg) / 4096.0f;
52 lin_b = freq_max_pos - lin_a * 2048.0f;
53 center_search_start = -lin_b / lin_a;
54 printf("Center search start DAC value: %d\n", center_search_start);
55 vcxo_freq_meas(center_search_start, "center");
56 vcxo_freq_meas(center_search_start - 100, "center-delta");
57 vcxo_freq_meas(center_search_start + 100, "center+delta");
42 58
59 printf("Stopping RF Tx on the DUT\n");
60 do_rfe(STOP_ALL);
61 exit(0);
43 } 62 }