Hey Knut,

Reading a GPIO line requires that the GPIO state be sent back to the host,
processed, and then acted upon (in your case, sending a stream command to
the radio). There is going to be a good amount of latency and jitter built
into this.

The alternative, which I would strongly recommend, would be to have the
USRP source the trigger. This can be set up really easily with ATR - an
FPGA functionality that coordinates GPIO states with radio TX/RX states.
I'd expect your TX start and GPIO state change to be coincident on the
order of nanoseconds. Checkout the gpio.cpp shipping example for more info:

https://github.com/EttusResearch/uhd/blob/UHD-3.15.LTS/host/examples/gpio.cpp

If you need to differ the time between TX beginning and GPIO changing
state, you can use timed commands on both and force the offset.

Sam

On Thu, Mar 5, 2020 at 9:02 AM Knut Stolzenberg via USRP-users <
[email protected]> wrote:

> Hello,
>
> I have set up a trigger for my X310 using the Pin 2 of the GPIO Front
> Panel. The Trigger is a TTL signal fed to the Pin. But we experience a
> jitter of ~100µs between the Trigger and the SDR starting to send
> data.Is it possible to reduce this latency/ jittering to <10µs. If not
> is it possible to use e.g. Pin 6 as a trigger output, which signalises
> when the SDR starts to send data? How would I implement this in the
> code? This would be interesting to me, since I could then synchronise my
> experiment to the SDR and not vice versa.
>
> The code we use for setting up the trigger is pretty similar to what is
> on the ettus knowledge base. The important bits are these:
>
> ...
>
> ...
>
> ...
>
> //Declarate Pin 2 as Trigger Input -> this is used for the triggered mode
> #define MAN_GPIO_MASK (1 << 2)
> #define AMP_GPIO_MASK (1 << 6)
> #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)
> ....
>
> ....
>
> ....
>
> usrp->set_gpio_attr("FP0", "CTRL", 0, ATR_MASKS);
>          usrp->set_gpio_attr("FP0", "DDR", 0, ATR_MASKS);
>
>          while (true)
>                  if (0 != usrp->get_gpio_attr("FP0", "READBACK", 0)) {
>                      /*here should be Pin 6 or "output trigger" high*/
>                      for (int i = 0; i < line; i++) { /*send data to the
> SDR*/
>                          tx_stream->send(
>                              buff_ptrs[i], spb, md
>                          );
>                      }
>                     /*here should be Pin 6 or "output trigger" low
>              }
>          }
>
>
> Sincerely,
>
> Knut
>
>
> _______________________________________________
> USRP-users mailing list
> [email protected]
> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
>
_______________________________________________
USRP-users mailing list
[email protected]
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com

Reply via email to