[USRP-users] Keep One in N

Zhihong Luo zhluo at umich.edu
Thu Mar 31 22:55:12 EDT 2016


Jonathon,

Yes, it works! Thanks a lot!

Can you explain why I am stuck in the middle of a packet? I thought it is
simple counter, and it should work no matter what... Please point out my
mistake so that I can avoid this kind of problems when designing my custom
block.

Thanks,
Zhihong

On Thu, Mar 31, 2016 at 8:24 PM, Jonathon Pendlum <
jonathon.pendlum at ettus.com> wrote:

> Hi Zhihong,
>
> You are likely stuck in the middle of a packet since you block consumes
> multiple input packets per output packet. Try ORing the reset on the
> keep_one_in_n_vec block with clear_tx_seqnum and see if that helps.
>
>
>
> Jonathon
>
> On Thu, Mar 31, 2016 at 12:56 PM, Zhihong Luo <zhluo at umich.edu> wrote:
>
>> If I tried more than 3 times, it will run into an error:
>>
>> Error: EnvironmentError: IOError: Radio ctrl (A) no response packet -
>> AssertionError: bool(buff)
>>   in uint64_t radio_ctrl_core_3000_impl::wait_for_ack(bool)
>>   at /home/zhluo/uhd/host/lib/usrp/cores/radio_ctrl_core_3000.cpp:203
>>
>> It seems to be some streaming issues? I try clearing the block after it
>> is created, it didn't help too much.
>>
>> Zhihong
>>
>> On Thu, Mar 31, 2016 at 2:35 PM, Zhihong Luo <zhluo at umich.edu> wrote:
>>
>>> Hi Jonathon,
>>>
>>> I found that the modified block has a problem. Previously, I removed the
>>> tlast on the if of the keep-one-in-n-vec.v, and used the block to keep on
>>> in n samples instead of packets. I tried it and it worked, but I just find
>>> that it only works on the first time after power on. After the first time,
>>> I'll receive 0 bytes. So I have to power cycle it every time...
>>>
>>> Do you have any idea what may be the problem? Thanks a lot.
>>>
>>> Zhihong
>>>
>>> On Tue, Mar 29, 2016 at 6:07 PM, Jonathon Pendlum <
>>> jonathon.pendlum at ettus.com> wrote:
>>>
>>>> Hi Zhihong,
>>>>
>>>> Removing tlast is not the approach you want. To make a block that keeps
>>>> one sample in n would require some thought depending on what you want to
>>>> accomplish. If you just want to decimate after a filter, the easiest
>>>> approach would be to use a counter to "sample" the filter's output stream
>>>> every n words.
>>>>
>>>>
>>>> Jonathon
>>>>
>>>> On Tue, Mar 29, 2016 at 2:52 PM, Zhihong Luo <zhluo at umich.edu> wrote:
>>>>
>>>>> Hi Jonathon,
>>>>>
>>>>> I realized the reason after noticing the i_tlast on the if condition,
>>>>> thanks for pointing it out.
>>>>>
>>>>> But I may need sample based keep one in n. Can I do it by simply
>>>>> removing the i_tlast? Is there some potential issues that I overlook?
>>>>>
>>>>> Thanks,
>>>>> Zhihong
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Mar 28, 2016 at 12:45 PM, Jonathon Pendlum <
>>>>> jonathon.pendlum at ettus.com> wrote:
>>>>>
>>>>>> Hi Zhihong,
>>>>>>
>>>>>> The keep one in n block drops packets and not individual samples. So
>>>>>> in other words, if N=2 it will drop every other packet, not every other
>>>>>> sample.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Jonathon
>>>>>>
>>>>>> On Sat, Mar 26, 2016 at 10:44 PM, Zhihong Luo via USRP-users <
>>>>>> usrp-users at lists.ettus.com> wrote:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I tried to use the RFNoC FIR filter and Keep One in N blocks to
>>>>>>> decimate my received signal. The FIR filter worked fine, but the Keep One
>>>>>>> in N block did not work as I expected. When capturing a square signal, with
>>>>>>> and without the Keep One in N block, the received sample number of the high
>>>>>>> period remained unchanged. I wonder whether I made a mistake in my code:
>>>>>>>
>>>>>>>  uhd::rfnoc::block_id_t fir_ctrl_id(0, "FIR", 0);
>>>>>>>  uhd::rfnoc::block_id_t keep_n_id(0,"KeepOneInN",0);
>>>>>>>
>>>>>>>  uhd::rfnoc::fir_block_ctrl::sptr fir_ctrl =
>>>>>>> usrp->get_device3()->find_block_ctrl<uhd::rfnoc::fir_block_ctrl>(fir_ctrl_id);
>>>>>>>
>>>>>>> uhd::rfnoc::block_ctrl_base::sptr
>>>>>>> keep_n_ctrl=usrp->get_device3()->find_block_ctrl(keep_n_id);
>>>>>>>
>>>>>>>  fir_ctrl->set_args(uhd::device_addr_t(streamargs)); //streamargs is
>>>>>>> an empty string
>>>>>>>
>>>>>>>  usrp->get_device3()->get_block_ctrl(radio_ctrl_id)->set_args(streamargs);
>>>>>>>  keep_n_ctrl->set_args(uhd::device_addr_t(streamargs));
>>>>>>>
>>>>>>>  fir_ctrl->set_taps(taps);
>>>>>>>  keep_n_ctrl->sr_write("SR_N", 16); // downsampling by 16 times
>>>>>>>
>>>>>>> usrp->connect(radio_ctrl_id, fir_ctrl->get_block_id());
>>>>>>> usrp->connect(fir_ctrl->get_block_id(),
>>>>>>> keep_n_ctrl->get_block_id());
>>>>>>>
>>>>>>> usrp->set_rx_channel(keep_n_ctrl->get_block_id());
>>>>>>>
>>>>>>> Thanks in advance for providing any help :)
>>>>>>>
>>>>>>> Zhihong
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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/20160331/48a14ed8/attachment-0002.html>


More information about the USRP-users mailing list