FreeCalypso > hg > fc-rfcal-tools
diff 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 |
line wrap: on
line diff
--- a/autocal/vcxomain.c Mon May 22 21:19:33 2017 +0000 +++ b/autocal/vcxomain.c Mon May 22 22:00:36 2017 +0000 @@ -12,6 +12,12 @@ #define VCXOCAL_BAND_RFPW RFPW_STD_BAND(6, 0) #define VCXOCAL_ARFCN 40 +extern float vcxo_freq_meas(); + +static float freq_max_neg, freq_max_pos; +static float lin_a, lin_b, lin_a2, lin_b2; +static int center_search_start; + prepare_rf_test_system() { char cmd[80]; @@ -39,5 +45,18 @@ printf("Starting RF Tx on the DUT\n"); do_rfe(RX_TX_TCH); + /* initial measurements at the DAC extremes */ + freq_max_neg = vcxo_freq_meas(-2048, "max-neg"); + freq_max_pos = vcxo_freq_meas(2048, "max-pos"); + lin_a = (freq_max_pos - freq_max_neg) / 4096.0f; + lin_b = freq_max_pos - lin_a * 2048.0f; + center_search_start = -lin_b / lin_a; + printf("Center search start DAC value: %d\n", center_search_start); + vcxo_freq_meas(center_search_start, "center"); + vcxo_freq_meas(center_search_start - 100, "center-delta"); + vcxo_freq_meas(center_search_start + 100, "center+delta"); + printf("Stopping RF Tx on the DUT\n"); + do_rfe(STOP_ALL); + exit(0); }