# Serial port source/sink

**URL:** <https://www.ruby-forum.com/t/serial-port-source-sink/232797>\
**Category:** GNU Radio\
**Created:** [October 28, 2014, 7:36pm UTC](https://www.ruby-forum.com/t/serial-port-source-sink/232797 "2014-10-28T19:36:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [October 28, 2014, 7:36pm UTC](https://www.ruby-forum.com/t/serial-port-source-sink/232797/1 "2014-10-28T19:36:32Z")

</div>

Hey there! i’m working on a proyect of comunications and i need to get  
my  
serial data stream into gnuradio companion, so i’m looking for a block  
(2  
actually) that can make this work, i tried to install pyserial and  
gr-pyserial but repository is down, so i’m looking for alternatives,  
that  
make me skip programming it myself (becoues of my low programing skills  
),  
so i though serial port is pretty comun, some one else had to build it  
before, if you know some blocks which could help me i would be very  
thankfull

---

<div class="post-metadata">

**Author:** ![JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/839c29/32.png) [@JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/u/JuliSSn_AndrSSs_Que)\
**Post date:** [October 28, 2014, 7:42pm UTC](https://www.ruby-forum.com/t/serial-port-source-sink/232797/2 "2014-10-28T19:42:30Z")

</div>

I can look into my repos. Those blocks were meant for a customer who  
specifically had to interact with a GR app through serial, due to legacy  
interfaces/software. This allow them the interface to a GNU Radio app  
through virtual serial connections (ie. SOCAT), just as if they were  
connected to an 90’s vintage radio.

Is there a specific reason you want to do this through serial? Can you  
explain your architecture?

-John

On Tue, Oct 28, 2014 at 11:35 AM, Julián Andrés Quenardelle \<

---

<div class="post-metadata">

**Author:** ![JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/839c29/32.png) [@JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/u/JuliSSn_AndrSSs_Que)\
**Post date:** [October 28, 2014, 7:44pm UTC](https://www.ruby-forum.com/t/serial-port-source-sink/232797/3 "2014-10-28T19:44:17Z")

</div>

Also, I just checked. The repo works fine through https but not ssh…  
:shrugs:

On Tue, Oct 28, 2014 at 11:41 AM, John M. \<

---

<div class="post-metadata">

**Author:** ![JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/839c29/32.png) [@JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/u/JuliSSn_AndrSSs_Que)\
**Post date:** [October 28, 2014, 11:35pm UTC](https://www.ruby-forum.com/t/serial-port-source-sink/232797/4 "2014-10-28T23:35:57Z")

</div>

Hi Julian,  
this really depends on how your serial data gets into your PC, but  
assuming you’re on linux and have the data coming in over a properly  
configured character device (ie. something that appears as /dev/ttyS\* or  
the like), you could just use the file source and open that device.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/839c29/32.png) [@JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/u/JuliSSn_AndrSSs_Que)\
**Post date:** [October 29, 2014, 12:58am UTC](https://www.ruby-forum.com/t/serial-port-source-sink/232797/5 "2014-10-29T00:58:50Z")

</div>

Agreed, but as soon as device setup is through with your device (thus  
the “properly configured character device”) and your reading program  
behaves nicely (which I’d expect GR’s file\_sink to do), just reading  
from a character device should work, if I’m not mistaken.

However, this brings us to a new question: “serial” doesn’t really say  
what kind of interface we’re talking about; there’s a whole lot of bytes  
that you can not send over a 1980’s style UART as used for the RS-232  
peripheral on PCs, and thus the data that comes in over that has to be  
decoded first; you could write a block that converts these bytes to  
bytes, or, and this is more likely, you already have software that does  
that, and writes the result to a file, or prints it on standard output.  
You could then connect the output of that to GNU Radio, e.g. using a  
named pipe.

---

<div class="post-metadata">

**Author:** ![JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/839c29/32.png) [@JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/u/JuliSSn_AndrSSs_Que)\
**Post date:** [October 29, 2014, 12:23am UTC](https://www.ruby-forum.com/t/serial-port-source-sink/232797/6 "2014-10-29T00:23:04Z")

</div>

On 10/28/2014 06:34 PM, Marcus M. wrote:

> Hi Julian,  
> this really depends on how your serial data gets into your PC, but  
> assuming you’re on linux and have the data coming in over a properly  
> configured character device (ie. something that appears as /dev/ttyS\*  
> or the like), you could just use the file source and open that device.
> 
> Greetings,  
> Marcus  
> TTY I/O on Unix is a bit weird. You’d have to open it, and configure it  
> (into RAW mode for one).

---

<div class="post-metadata">

**Author:** ![JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/839c29/32.png) [@JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/u/JuliSSn_AndrSSs_Que)\
**Post date:** [October 29, 2014, 3:44pm UTC](https://www.ruby-forum.com/t/serial-port-source-sink/232797/7 "2014-10-29T15:44:56Z")

</div>

Hey there! I’m gonna explain a bit of what i’m doing. I’m trying to  
conect  
a laptop with a ground control station software to an uavdevboard  
(UDB4). I  
want to get data stream through gnuradio, i want to make it serial  
because  
of previous work. I can set up the baudrate of transmision at my  
software  
(running on windows bdw) and my devboard too, i don’t know if that would  
affect the TTY I/O on Unix (that was a good idea btw, gonna work over  
that). However, my inteface is an USB/Serial cable if thats what you’re  
asking, i didnt use the RS232 standard, just needed TxRx pins from the  
devboard.

2014-10-28 20:57 GMT-03:00 Marcus Müller [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/839c29/32.png) [@JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/u/JuliSSn_AndrSSs_Que)\
**Post date:** [November 4, 2014, 12:16pm UTC](https://www.ruby-forum.com/t/serial-port-source-sink/232797/8 "2014-11-04T12:16:14Z")

</div>

Hey there, i succeed (think i do) installing gr\_pyserial block, i wanted  
to  
test it making a loopback but when i compile muy gnuradio block i get  
this

Generating: “/home/iua/Documentos/ComSerialGnu/top\_block.py”

> > > Warning: This flow graph may not have flow control: no audio or usrp  
> > > blocks found. Add a Misc-\>Throttle block to your flow graph to avoid CPU  
> > > congestion.

Executing: “/home/iua/Documentos/ComSerialGnu/top\_block.py”

linux; GNU C++ version 4.6.3; Boost\_104601;  
UHD\_003.004.003-175-g09de3c07

Traceback (most recent call last):  
File “/home/iua/Documentos/ComSerialGnu/top\_block.py”, line 48, in  
  
tb = top\_block()  
File “/home/iua/Documentos/ComSerialGnu/top\_block.py”, line 32, in  
**init**  
self.serial\_port\_0 =  
grpyserial.serial\_port(“/dev/ttyS0”,0,9600,0,1,False)  
File  
“/usr/local/lib/python2.7/dist-packages/grpyserial/serial\_port.py”,  
line 62, in **init**  
num\_msg\_outputs = 1,  
TypeError: **init** () got an unexpected keyword argument  
‘num\_msg\_inputs’

and i have no idea what this means or what’s happened i’m totally lost,  
so  
i beg you help me with this fellas, thanks a lot for your time.

---

<div class="post-metadata">

**Author:** ![JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/839c29/32.png) [@JuliSSn\_AndrSSs\_Que](https://www.ruby-forum.com/u/JuliSSn_AndrSSs_Que)\
**Post date:** [October 30, 2014, 11:25am UTC](https://www.ruby-forum.com/t/serial-port-source-sink/232797/9 "2014-10-30T11:25:08Z")

</div>

Hi Juli?n,

interesting!  
I think I might be misunderstanding what’s happening here, so I think we  
should make a sketch of what I think you’re doing:

“data” --\> Ground control station --\> TX Antenna --\> Air --\> RX Antenna  
UAVdevboard

Is that correct?

Greetings,  
Marcus
