discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] gr-uhd timed command messages


From: Nigel Steed
Subject: Re: [Discuss-gnuradio] gr-uhd timed command messages
Date: Fri, 4 Mar 2016 12:59:53 +0000

Hi Marcus/Martin,

I have got it stable now. Though I don't think the timed commands are doing 
what I think.

I have re-built gr-uhd just to print out the fract and full secs from the time 
command which as you say is 2 seconds - which is ok for testing now.

If I send a time command, does the gr-uhd get the current time and add the 2 
seconds. As I am sending a command message to the UHD Source for both mother 
boards (I have two N210 on one UHD Source) in separate messages and not sure 
how that will work.

Also, I do not see a delay of data for 2 seconds from the UHD Source, when 
perfomed in python it seems to block until the time has been reached.

Does my code below look reasonable ?

Thanks,

Nigel

        // Send a receiver timed command - motherboard 0
             d_rxCommand = pmt::make_dict();
             d_rxCommand = pmt::dict_add(d_rxCommand, pmt::mp("mboard"), 
pmt::mp(0));
             pmt::pmt_t timeStamp = pmt::cons(pmt::from_long(1), 
pmt::from_double(1));
             d_rxCommand = pmt::dict_add(d_rxCommand, pmt::mp("time"), 
timeStamp);
             message_port_pub(pmt::mp("rx_freq_msg"), d_rxCommand );

             // Send a receiver timed command - motherboard 1
             d_rxCommand = pmt::make_dict();
             d_rxCommand = pmt::dict_add(d_rxCommand, pmt::mp("mboard"), 
pmt::mp(1));
             d_rxCommand = pmt::dict_add(d_rxCommand, pmt::mp("time"), 
timeStamp);
             message_port_pub(pmt::mp("rx_freq_msg"), d_rxCommand );

             // Tune receiver channel 0
             d_rxCommand = pmt::make_dict();
             d_rxCommand = pmt::dict_add(d_rxCommand, pmt::mp("freq"), 
pmt::mp(d_txFrequency));
             d_rxCommand = pmt::dict_add(d_rxCommand, pmt::mp("chan"), 
pmt::mp(0));
             message_port_pub(pmt::mp("rx_freq_msg"), d_rxCommand );

             // Tune receiver channel 1
             d_rxCommand = pmt::make_dict();
             d_rxCommand = pmt::dict_add(d_rxCommand, pmt::mp("freq"), 
pmt::mp(d_txFrequency));
             d_rxCommand = pmt::dict_add(d_rxCommand, pmt::mp("chan"), 
pmt::mp(1));
             message_port_pub(pmt::mp("rx_freq_msg"), d_rxCommand );

             // Tune transmitter
             d_txCommand = pmt::make_dict();
             d_txCommand = pmt::dict_add(d_txCommand, pmt::mp("freq"), 
pmt::mp(d_txFrequency));
             d_txCommand = pmt::dict_add(d_txCommand, pmt::mp("chan"), 
pmt::mp(0));
             message_port_pub(pmt::mp("tx_freq_msg"), d_txCommand );

             // Clear the receiver command time - motherboard 0
             d_rxCommand = pmt::make_dict();
             d_rxCommand = pmt::dict_add(d_rxCommand, pmt::mp("mboard"), 
pmt::mp(0));
             d_rxCommand = pmt::dict_add(d_rxCommand, pmt::mp("time"), 
pmt::PMT_NIL);
             message_port_pub(pmt::mp("rx_freq_msg"), d_rxCommand );

             // Clear the receiver command time - motherboard 0
             d_rxCommand = pmt::make_dict();
             d_rxCommand = pmt::dict_add(d_rxCommand, pmt::mp("mboard"), 
pmt::mp(1));
             d_rxCommand = pmt::dict_add(d_rxCommand, pmt::mp("time"), 
pmt::PMT_NIL);
             message_port_pub(pmt::mp("rx_freq_msg"), d_rxCommand );





-----Original Message-----
From: Marcus Müller [mailto:address@hidden 
Sent: 04 March 2016 10:44
To: Nigel Steed <address@hidden>; address@hidden
Subject: Re: [Discuss-gnuradio] gr-uhd timed command messages

Hi Nigel,

from_long(1), from_double(1)
implies that your timestamp is at 1 [full second] + 1 [fraction of second] = 
2s; usually you'd do from_long(2), from_double(0) for that :)

> Do you think it maybe better for me to modify UHD Source and implement the 
> timed command in the set_center_freq function in the usrp_source_impl.cc (UHD 
> Source Block) ? As I am successfully stepping the UHD Source using the 
> message port successfully and I just need to add a timed command so both 
> channels re-tune together.
Not quite sure. As far as I can tell, the usrp_source does exactly the timed 
command tuning when you issue these commands; however, I've to admit I haven't 
read up on your discussion with Martin, so there might be a bug and it doesn't?

Best regards,
Marcus


On 04.03.2016 11:35, Nigel Steed wrote:
> Thanks Marcus,
>
> The UHD Source finally understand the following:
>
> pmt::pmt_t timeStamp = pmt::cons(pmt::from_long(1), 
> pmt::from_double(1)); d_rxCommand = pmt::dict_add(d_rxCommand, 
> pmt::mp("time"), timeStamp);
>
> Although UHD Source reports processing the message, I eventually get a packet 
> loss error and the N210 disconnects (no control response error).
>
> Do you think it maybe better for me to modify UHD Source and implement the 
> timed command in the set_center_freq function in the usrp_source_impl.cc (UHD 
> Source Block) ? As I am successfully stepping the UHD Source using the 
> message port successfully and I just need to add a timed command so both 
> channels re-tune together.
>
> Thanks,
>
> Nigel
> -----Original Message-----
> From: address@hidden 
> [mailto:address@hidden On 
> Behalf Of Marcus Müller
> Sent: 04 March 2016 08:35
> To: address@hidden
> Subject: Re: [Discuss-gnuradio] gr-uhd timed command messages
>
> Hi Nigel,
>
>>             d_rxCommand = pmt::dict_add(d_rxCommand, pmt::mp("time"), 
>> pmt::mp(0.5));
> Timestamps aren't just doubles for UHD; they ought to be [1]
>
>> timestamp: A pair composed of (long full_secs, double frac_secs).
> Similar to uhd::time_spec_t.
>
> So your timestamp needs to be a pair of long, double
>
> pmt_t timestamp = pmt::make_pair(pmt::from_long(0), 
> pmt::from_double(0.5)); d_rxCommand = pmt::dict_add(d_rxCommand, 
> pmt::mp("time"), timestamp);
>
> if I'm not mistaken.
>
> Best regards,
> Marcus
>
> [1] 
> https://gnuradio.org/doc/doxygen/page_uhd.html#uhd_command_syntax_cmds
> On 04.03.2016 01:39, Nigel Steed wrote:
>> Hi Martin,
>>
>> I have put the following code into my block.
>>
>>
>>      d_rxCommand = pmt::make_dict();
>>              d_rxCommand = pmt::dict_add(d_rxCommand, pmt::mp("time"), 
>> pmt::mp(0.5));
>>              message_port_pub(pmt::mp("rx_freq_msg"), d_rxCommand );
>>
>> It sends the message to the UHD Sink. But I get this error at run time:
>>
>>      thread[thread-per-block[5]: <block gr uhd usrp source (1)>]: pmt_cdr: 
>> wrong_type : 1
>>
>> Any ideas ? I am trying to auto step the frequencies, and currently have my 
>> own block to generate frequency messages which works fine. I am now trying 
>> to implement the time commands. Is there any other way to do it ?
>>
>> Thanks,
>>
>> Nigel
>>
>>
>>
>> -----Original Message-----
>> From: address@hidden
>> [mailto:address@hidden On 
>> Behalf Of Martin Braun
>> Sent: Wednesday, March 2, 2016 9:24 PM
>> To: address@hidden
>> Subject: Re: [Discuss-gnuradio] gr-uhd timed command messages
>>
>> When using messages, simply add a 'time' key to the command dictionary, and 
>> it will be set for the command you're calling. The time stamp value, is a 
>> long/double pair, for full and fractional time. Example:
>>
>> {'freq': 1e9, 'time': (100, 0.1)}
>>
>> If this is your message, it will set the frequency to 1 GHz at time 100.1.
>>
>> Cheers,
>> Martin
>>
>>
>>
>> On 03/02/2016 05:46 AM, Nigel Steed wrote:
>>> Hi,
>>>
>>>  
>>>
>>> Anyone know or managed to implement the time command using a message 
>>> port to the UHD Source Block ?
>>>
>>>  
>>>
>>> I believe time commands are not implemented in the latest GNURadio 
>>> gr-uhd ? Is that correct ?
>>>
>>>  
>>>
>>> Thanks,
>>>
>>>  
>>>
>>> Nigel
>>>
>>>
>>>
>>> _______________________________________________
>>> Discuss-gnuradio mailing list
>>> address@hidden
>>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>
>> _______________________________________________
>> Discuss-gnuradio mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>> _______________________________________________
>> Discuss-gnuradio mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
> _______________________________________________
> 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]