discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Using the UHD API for Python Programming


From: Josh Blum
Subject: Re: [Discuss-gnuradio] Using the UHD API for Python Programming
Date: Fri, 22 Jun 2012 12:24:24 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1


On 06/22/2012 12:19 PM, Alexander Olihovik wrote:
> So to tune two USRP N210s connected by a MIMO cable, I should set the
> command time to be some time spec, and then re-tune both channels to the
> same frequency, thus giving them the same phase offset?
> 
> i.e. My code is looking more like:

make sure you you tell the board to get its reference of clock and time
source from the mimo cable

> self.cmd_time = self.uhd_usrp_source_0.uhd.time_spec_t(.1)

careful, make sure that cmd time is a time in the future

> self.uhd_usrp_source_0.set_command_time(self.cmd_time)
> self.uhd_usrp_source_0.set_center_freq(freq, 0)
> self.uhd_usrp_source_0.set_center_freq(freq, 1)
> self.uhd_usrp_source_0.clear_command_time()
> 
> 
> The phases are still off... Is my method incorrect?
> 

Synchronization of device time is separate from synchronizing the phase
of the RF frontend. This may be helpful, with code examples for both:

http://files.ettus.com/uhd_docs/manual/html/sync.html

-Josh

> On Fri, Jun 22, 2012 at 1:36 PM, Josh Blum <address@hidden> wrote:
> 
>>
>>
>> On 06/22/2012 10:18 AM, Alexander Olihovik wrote:
>>> For get_time_now(), would I need to swig multi_usrp.hpp?
>>
>> Everything you see in these headers should be available in python:
>> http://gnuradio.org/cgit/gnuradio.git/tree/gr-uhd/include
>>
>> -josh
>>
>>>
>>> On Fri, Jun 22, 2012 at 12:19 PM, Josh Blum <address@hidden> wrote:
>>>
>>>>
>>>>
>>>> On 06/22/2012 07:33 AM, Alexander Olihovik wrote:
>>>>> Hi all,
>>>>> I'm having some trouble using the C++ UHD API for writing Python code.
>>>>> I understand that the code has been SWIG'd from C++ to Python.
>>>>>
>>>>>
>>>>> Specifically, the C++ code I want to convert to Python is:
>>>>> ---------------------------------------
>>>>> uhd::stream_cmd_t
>>>>> stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
>>>>> stream_cmd.num_samps = samps_to_recv;
>>>>> stream_cmd.stream_now = false;
>>>>> stream_cmd.time_spec = time_to_recv;
>>>>> usrp->issue_stream_cmd(stream_cmd);
>>>>>
>>>>
>>>> Stream command is not swigged because the control of streaming is part
>>>> of gnuradio's scheduler. So start() and stop() get automatically called
>>>> by the scheduler. For convenience this is a set_command_time() to
>>>> control stream_cmd.time_spec.
>>>>
>>>> Basically, gnuradio is handling the streaming for you. Think block-based
>>>> streaming model.
>>>>
>>>>> uhd::time_spec_t cmd_time = usrp->get_time_now() +
>> uhd::time_spec_t(0.1);
>>>>> usrp->set_command_time(cmd_time);
>>>>> usrp->set_rx_freq(1.03e9, 0/*ch0*/);
>>>>> usrp->set_rx_freq(1.03e9, 1/*ch1*/);
>>>>> usrp->set_clear_time();
>>>>
>>>> This part is swigged.
>>>>
>>>> -josh
>>>>
>>>> _______________________________________________
>>>> Discuss-gnuradio mailing list
>>>> address@hidden
>>>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>>
>>>
>>>
>>>
>>
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]