# Unable to coerce endpoint

**URL:** <https://www.ruby-forum.com/t/unable-to-coerce-endpoint/203339>\
**Category:** GNU Radio\
**Created:** [February 18, 2011, 1:07am UTC](https://www.ruby-forum.com/t/unable-to-coerce-endpoint/203339 "2011-02-18T01:07:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 18, 2011, 1:07am UTC](https://www.ruby-forum.com/t/unable-to-coerce-endpoint/203339/1 "2011-02-18T01:07:52Z")

</div>

Dear all,

I’m trying to feed the received signal from USRP to a low-pass filter  
and sink the filtered signal into a data file.

The received signal is in complex format. The receiver is built as:

u = usrp.source\_c(0)  
coeffs = gr.firdes.low\_pass(1.0, 500e3, 20e3,.5e3,gr.firdes.WIN\_HAMMING)  
lpf = gr.fir\_filter\_ccf(1,coeffs)  
dst = gr.file\_sink(gr.sizeof\_gr\_complex,rxlpf.dat)  
connect(u, lpf, dst)

I got a ValueError: unable to coerce endpoint

Without the low-pass filter plugged in, if only feed the received signal  
into a data file, the system is running well. By checking the output  
from the USRP is complex signal and data sank into the data file is  
complex, therefore, the input and the output of the low-pass filter are  
both selected as complex type. Why does this ValueError show up? How to  
solve this error to plugged this low-pass filter in? I really appreciate  
any idea related to this.

Wish you a great day!

Yan

---

<div class="post-metadata">

**Author:** ![Yan\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/3e96dc/32.png) [@Yan\_N](https://www.ruby-forum.com/u/Yan_N)\
**Post date:** [February 18, 2011, 5:21pm UTC](https://www.ruby-forum.com/t/unable-to-coerce-endpoint/203339/2 "2011-02-18T17:21:44Z")

</div>

On Thu, Feb 17, 2011 at 7:06 PM, Yan N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> connect(u, lpf, dst)
> 
> I got a ValueError: unable to coerce endpoint
> 
> Without the low-pass filter plugged in, if only feed the received signal into a  
> data file, the system is running well. By checking the output from the USRP is  
> complex signal and data sank into the data file is complex, therefore, the input  
> and the output of the low-pass filter are both selected as complex type. Why does  
> this ValueError show up? How to solve this error to plugged this low-pass filter  
> in? I really appreciate any idea related to this.
> 
> Wish you a great day!
> 
> Yan

Yan, I don’t know. I copied the above script and it works fine for me.  
I’m a bit confused about two aspects of the code, though. First, you  
have the second input to file\_sink as just rxlpf.dat, which looks like  
the name of a file, but it is not quoted. Was this just a  
transcription error?

Also, in your connect statement, you don’t use “self.connect()” or  
“tb.connect()” where ‘tb’ is a top\_block object you have created.  
What’s really going on here?

Have you tried to make this script in the gnuradio companion? It  
should be very simple to put this one together there, and GRC takes  
care of the connections and everything else.

Tom

---

<div class="post-metadata">

**Author:** ![Yan\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/3e96dc/32.png) [@Yan\_N](https://www.ruby-forum.com/u/Yan_N)\
**Post date:** [February 18, 2011, 7:29pm UTC](https://www.ruby-forum.com/t/unable-to-coerce-endpoint/203339/3 "2011-02-18T19:29:00Z")

</div>

Tom, I really appreciate your reply. I got another question, how to  
pause the system for 5 milliseconds? I’m trying to transmit signal then  
suspend the system without any signal transmission for about 5  
milliseconds. The following is the part of code that I use to implement  
this, but it doesn’t really work as what I expected.

payload\_13bit = ‘\x01\x01\x01\x01\x01\x0’  
while(start\_flag == 1)  
msg\_13bit = gr.message\_from\_string(payload\_13bit)  
top\_block.\_ls\_msgq.insert\_tail(msg\_13bit)  
time.sleep(0.005)

Could you please help to see what the problem here? Why it cannot stop  
the transmission for 5 milliseconds.

Really appreciate your help.

Thanks,  
Yan
