[USRP-users] Time of arrival of first sample in a 2 Rx setup

Rob Kossler rkossler at nd.edu
Wed Apr 29 15:57:01 EDT 2015


Siva, Marcus,
I have two comments:
1) In addition to the code below, you will need to call
"set_time_unknown_pps" or similar to make sure the timing is the same for
both channels.
2) The B210 seems to have an issue with obtaining consistent timing between
TX and RX (
http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/2015-April/013541.html).
There shouldn't be any issue, however, with the Rx channel to channel
timing so this should work fine for DOA.

Rob


On Fri, Apr 24, 2015 at 2:58 AM, Marcus Müller <usrp-users at lists.ettus.com>
wrote:

>  Hi Siva,
>
> ok, so you actually have one B210; that makes things easier, because that
> is inherently in sync with itself :)
> So what you'd have to do is (not tested, not complete):
>
> stream_cmd_t start_cmd(STREAM_MODE_START_CONTINUOUS);
> start_cmd.stream_now = false;
> start_cmd.timespec = my_usrp->get_time_now() + time_spec_t(0.5); //start
> in 0.5 seconds
>
> stream_args_t str_args;
> str_args.channels = boost::assign::list_of(0)(1);
>
> rx_streamer::sptr rx = my_usrp->get_rx_streamer(str_args);
> tx_streamer::sptr rx = my_usrp->get_tx_streamer(str_args);
>
> rx->issue_stream_cmd(start_cmd);
> tx->issue_stream_cmd(start_cmd);
> //spawn two threads, or intermittently rx->recv() and tx->send()
> //the first call to recv() and/or send() will possibly block until their
> time has come.
>
> Now you'll *know a priori* that the timestamp of the first received
> samples is what is in start_cmd.timespec. Since there is analog and DSP
> delay in the B210, you will have to calibrate once for each sampling rate /
> analog bandwidth / frequency combination you want to use.
>
> Two things to notice:
> 1. you need a two-channel TX, because the AD9361 wants it that way; you
> can't have 2xRX 1xTX, it needs to be 2xRX 2xTX or 1xRX 1xTX. Just set zero
> gain for the channel you're not using, and send 0s.
> 2. both RX are running of the same LO, but a different oscillator than TX;
> so you'll have to calibrate phase after every tune, because you can't know
> which phase the TX LO has relative to the RX LO after a tune. A clever way
> of doing this might be connecting an antenna at the "unused" port, placing
> it in the middle between your two RX antennas, and transmitting a short
> known sequence on it, detecting it with your RX and estimating the phase
> offset between RX and TX with that -- you'd also have a way of knowing the
> pure loopback delay in your current configuration like this.
>
> Best regards,
> Marcus
>
>
> On 04/24/2015 07:45 AM, siva sankar wrote:
>
> Hey Marcus,
>
>  I am attaching the picture of the set up. The two receivers(Receiver 1
> and Receiver 2)  shown in the picture are on one USRP B210. We are trying
> to calculate the angle of arrival using the TDOA.
> These are the equations being used:
>    Sin θ= S/L;
>    S = (TDOA)*Speed of light(C);
>    θ=arcsin(((TDOA)*C)/L);
>
>
> On Thu, Apr 23, 2015 at 7:38 PM, LOUF Laurent <
> laurent.louf at thalesgroup.com> wrote:
>
>>  Hi,
>>
>>
>>
>> If you just want the time difference, you may want to compute the
>> correlation between the two signals for different offsets (unit : samples)
>> and find the offset that gives you the maximum of correlation (and then
>> translate the number of samples into a time difference with the sampling
>> frequency). If receivers are not too far away one from the other, I guess
>> that could be a solution (to be investigated).
>>
>>
>>
>> Regards,
>>
>> Laurent.
>>
>>
>>
>>
>>
>> *De :* USRP-users [mailto:usrp-users-bounces at lists.ettus.com] *De la
>> part de* siva sankar via USRP-users
>> *Envoyé :* jeudi 23 avril 2015 14:54
>> *À :* Marcus Müller
>> *Cc :* usrp-users at lists.ettus.com
>> *Objet :* Re: [USRP-users] Time of arrival of first sample in a 2 Rx
>> setup
>>
>>
>>
>> Hey Marcus,
>>
>> Thanks for the reply.
>> The receivers here are at different distances from the transmitter and we
>> are looking for the time difference of arrival of the samples at the
>> receive buffers.
>>
>> How do we proceed with this ?
>>
>> Regards
>> Siva
>>
>> Hello Siva,
>> recv() will do an aligned reception, i.e. the first samples of both
>> streams were received at the same time.
>>
>> Often, you don't want to *know* *afterwards* the time of reception, you
>> want to *define* it beforehand. You can do that by using a stream_cmd
>> with a stream_now = false and a timespec to allow you to define when the
>> reception is going to take place.
>>
>> Greetings,
>> Marcus
>>
>>  On 04/23/2015 12:28 PM, siva sankar via USRP-users wrote:
>>
>>  Hello List,
>>
>>
>>
>> I am using USRP B210 and the UHD version is 003.008.000. We are
>> transmitting on one channel and receiving simultaneously on both the
>> channels and what we want is the time of arrival of the first sample in
>> both the receive buffers.
>>
>>
>>
>> We have used the "time_spec_t" to get the time of the first sample but we
>> don't know if the time that we are getting is for both the channels or for
>> one of the receiver buffers.
>>
>>
>>
>> We have tried using two "recv" commands one for each buffer hoping we
>> could calculate the time from each metadata parameter passed to the "recv"
>> command in one thread  but it throws "multi channel alignment" error and
>> stops running.
>>
>>
>>
>> We also tried to create individual threads for both the rx channels and
>> pass different metadata parameters and hence know the time of first sample
>> for each buffer. However, this throws segmentation fault.
>>
>>
>>
>> Any help on how to calculate the time of first sample for each receive
>> buffer will be appreciated.
>>
>>
>>
>> Thanks
>>
>> Siva.
>>
>>
>>
>> _______________________________________________
>>
>> USRP-users mailing list
>>
>> USRP-users at lists.ettus.com
>>
>> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
>>
>>
>>
>>
>> _______________________________________________
>> USRP-users mailing list
>> USRP-users at lists.ettus.com
>> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
>>
>
>
>
>  --
>  Thanks and regards
> Siva Sankar.
>
>
>
> _______________________________________________
> USRP-users mailing list
> USRP-users at lists.ettus.com
> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20150429/b2bd24f2/attachment-0002.html>


More information about the USRP-users mailing list