fix tx/rx calibration for Lime

master
Andre Puschmann 7 years ago
parent da55c6a71c
commit b8391d20a4

@ -311,6 +311,10 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
// init Rx rate to lowest LTE rate // init Rx rate to lowest LTE rate
rf_soapy_set_rx_srate(handler, 1.92e6); rf_soapy_set_rx_srate(handler, 1.92e6);
// set default tx gain and leave some time to calibrate tx
rf_soapy_set_tx_gain(handler, 35);
usleep(10000);
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
@ -342,8 +346,12 @@ int rf_soapy_close(void *h)
void rf_soapy_set_master_clock_rate(void *h, double rate) void rf_soapy_set_master_clock_rate(void *h, double rate)
{ {
// Allow the soapy to automatically set the appropriate clock rate rf_soapy_handler_t *handler = (rf_soapy_handler_t*) h;
if (SoapySDRDevice_setMasterClockRate(handler->device, rate) != 0) {
printf("rf_soapy_set_master_clock_rate Rx fail: %s\n", SoapySDRDevice_lastError());
}
printf("Set master clock rate to %.2f MHz\n", SoapySDRDevice_getMasterClockRate(handler->device)/1e6);
} }
@ -456,7 +464,7 @@ double rf_soapy_set_rx_freq(void *h, double freq)
printf("setFrequency fail: %s\n", SoapySDRDevice_lastError()); printf("setFrequency fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
printf("Tuning receiver to %.2f MHz\n", SoapySDRDevice_getFrequency(handler->device, SOAPY_SDR_RX, 0)/1e6); printf("Tuned Rx to %.2f MHz\n", SoapySDRDevice_getFrequency(handler->device, SOAPY_SDR_RX, 0)/1e6);
// wait until LO is locked // wait until LO is locked
rf_soapy_rx_wait_lo_locked(handler); rf_soapy_rx_wait_lo_locked(handler);
@ -473,6 +481,8 @@ double rf_soapy_set_tx_freq(void *h, double freq)
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
printf("Tuned Tx to %.2f MHz\n", SoapySDRDevice_getFrequency(handler->device, SOAPY_SDR_TX, 0)/1e6);
return SoapySDRDevice_getFrequency(handler->device, SOAPY_SDR_TX, 0); return SoapySDRDevice_getFrequency(handler->device, SOAPY_SDR_TX, 0);
} }
@ -582,7 +592,7 @@ int rf_soapy_send_timed_multi(void *h,
{ {
rf_soapy_handler_t *handler = (rf_soapy_handler_t *) h; rf_soapy_handler_t *handler = (rf_soapy_handler_t *) h;
int flags = 0; int flags = 0;
const long timeoutUs = 2000; // arbitrarily chosen const long timeoutUs = 5000; // arbitrarily chosen
long long timeNs = 0; long long timeNs = 0;
int trials = 0; int trials = 0;
int ret = 0; int ret = 0;

Loading…
Cancel
Save