On 07/16/2019 09:39 AM, Knut Stolzenberg via USRP-users wrote:
Hey everyone,
I experience some randomness in the timing of the ouput of my SDR,
when applying a TTL signal to the GPIO. The TTL signal is fed to Pin 2
of the GPIO and has a Voltage of ~3V. It also is of arbitrary length
(~10 microseconds - several seconds). When the trigger is active it
takes between 0.25 - 20 ms until the SDR starts streaming the data
(measured with an oscilloscope, comparing the starting time of the
trigger and streamed data). The data streamed is made of several
hundred buffers and contains a modulation of the carrier frequency.
Is there any way to control the starting time of streaming, when the
trigger was applied?
Below is a part of the code, where the "trigger" is applied. It is
pretty much based on the tx_waveforms example code/./
#define MAN_GPIO_MASK (1 << 2)
#define ATR_MASKS (AMP_GPIO_MASK | MAN_GPIO_MASK)
// set up our values for ATR control: 1 for ATR, 0 for manual
#define ATR_CONTROL (AMP_GPIO_MASK & ~MAN_GPIO_MASK)
// set up the GPIO directions: 1 for output, 0 for input
#define GPIO_DDR (AMP_GPIO_MASK & ~MAN_GPIO_MASK)
.....
Buffer production & stuff
...
uhd::tx_metadata_t md;
md.start_of_burst = true;
md.end_of_burst = true;
md.has_time_spec = false;
usrp->set_gpio_attr("FP0", "CTRL", 0);
usrp->set_gpio_attr("FP0", "DDR", 0);
while (true) {
int readback = 0;
if (stop_signal_called) break;
int initialise = usrp->get_gpio_attr("FP0", "READBACK", 0);
if (readback != initialise) {
readback = initialise;
if (initialise = 1)
{
for (int i = 0; i < line; i++) {
tx_stream->send(
buff_ptrs[i], spb, md
);
}
}
}
boost::this_thread::sleep(boost::posix_time::microseconds(1));
}
You will *NEVER* get predictable latency this way--you're relying on
your host operating system having very-predictable latency, and that's
simply
not possible on a computer running a general-purpose, multi-process,
multi-user operating system.
You might want to look into an FPGA-based implementation, where timing
is predictable.
If the GPIO trigger input is actually just a regularly-timed event, you
might also want to look into timed commands.
_______________________________________________
USRP-users mailing list
[email protected]
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com