mirror of
https://github.com/fairwaves/openbts-2.8.git
synced 2025-10-25 09:03:38 +00:00
transceiver: workaround for transmit testing with no clock reset
Non-functional clock reset causes huge initial timing offset between expected and received timestamps. Receive an initial packet to 'set' the expected starting timestamp value for both transmit and receive. Signed-off-by: Thomas Tsou <ttsou@vt.edu>
This commit is contained in:
committed by
Alexander Chemeris
parent
77db43f380
commit
1bcd01c7c5
@@ -58,6 +58,8 @@ const double rx_smpl_offset = .00005;
|
|||||||
const double rx_smpl_offset = .0000869;
|
const double rx_smpl_offset = .0000869;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static TIMESTAMP init_rd_ts = 0;
|
||||||
|
|
||||||
/** Timestamp conversion
|
/** Timestamp conversion
|
||||||
@param timestamp a UHD or OpenBTS timestamp
|
@param timestamp a UHD or OpenBTS timestamp
|
||||||
@param rate sample rate
|
@param rate sample rate
|
||||||
@@ -169,8 +171,8 @@ public:
|
|||||||
bool setTxFreq(double wFreq);
|
bool setTxFreq(double wFreq);
|
||||||
bool setRxFreq(double wFreq);
|
bool setRxFreq(double wFreq);
|
||||||
|
|
||||||
inline TIMESTAMP initialWriteTimestamp() { return 0; }
|
inline TIMESTAMP initialWriteTimestamp() { return init_rd_ts; }
|
||||||
inline TIMESTAMP initialReadTimestamp() { return 0; }
|
inline TIMESTAMP initialReadTimestamp() { return init_rd_ts; }
|
||||||
|
|
||||||
inline double fullScaleInputValue() { return 32000 * tx_ampl; }
|
inline double fullScaleInputValue() { return 32000 * tx_ampl; }
|
||||||
inline double fullScaleOutputValue() { return 32000; }
|
inline double fullScaleOutputValue() { return 32000; }
|
||||||
@@ -546,6 +548,17 @@ void uhd_device::restart(uhd::time_spec_t ts)
|
|||||||
cmd = uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS;
|
cmd = uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS;
|
||||||
cmd.stream_now = true;
|
cmd.stream_now = true;
|
||||||
usrp_dev->issue_stream_cmd(cmd);
|
usrp_dev->issue_stream_cmd(cmd);
|
||||||
|
|
||||||
|
uhd::rx_metadata_t md;
|
||||||
|
uint32_t buff[rx_spp];
|
||||||
|
|
||||||
|
usrp_dev->get_device()->recv(buff,
|
||||||
|
rx_spp,
|
||||||
|
md,
|
||||||
|
uhd::io_type_t::COMPLEX_INT16,
|
||||||
|
uhd::device::RECV_MODE_ONE_PACKET);
|
||||||
|
|
||||||
|
init_rd_ts = convert_time(md.time_spec, actual_smpl_rt);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool uhd_device::start()
|
bool uhd_device::start()
|
||||||
@@ -912,7 +925,7 @@ ssize_t smpl_buf::read(void *buf, size_t len, TIMESTAMP timestamp)
|
|||||||
num_smpls = len;
|
num_smpls = len;
|
||||||
|
|
||||||
// Starting index
|
// Starting index
|
||||||
size_t read_start = data_start + (timestamp - time_start);
|
size_t read_start = data_start + (timestamp - time_start) % buf_len;
|
||||||
|
|
||||||
// Read it
|
// Read it
|
||||||
if (read_start + num_smpls < buf_len) {
|
if (read_start + num_smpls < buf_len) {
|
||||||
|
|||||||
@@ -120,9 +120,9 @@ void RadioInterface::start()
|
|||||||
LOG(INFO) << "starting radio interface...";
|
LOG(INFO) << "starting radio interface...";
|
||||||
mAlignRadioServiceLoopThread.start((void * (*)(void*))AlignRadioServiceLoopAdapter,
|
mAlignRadioServiceLoopThread.start((void * (*)(void*))AlignRadioServiceLoopAdapter,
|
||||||
(void*)this);
|
(void*)this);
|
||||||
|
mRadio->start();
|
||||||
writeTimestamp = mRadio->initialWriteTimestamp();
|
writeTimestamp = mRadio->initialWriteTimestamp();
|
||||||
readTimestamp = mRadio->initialReadTimestamp();
|
readTimestamp = mRadio->initialReadTimestamp();
|
||||||
mRadio->start();
|
|
||||||
LOG(DEBUG) << "Radio started";
|
LOG(DEBUG) << "Radio started";
|
||||||
mRadio->updateAlignment(writeTimestamp-10000);
|
mRadio->updateAlignment(writeTimestamp-10000);
|
||||||
mRadio->updateAlignment(writeTimestamp-10000);
|
mRadio->updateAlignment(writeTimestamp-10000);
|
||||||
|
|||||||
Reference in New Issue
Block a user