# PSK File transfer

**URL:** <https://www.ruby-forum.com/t/psk-file-transfer/240068>\
**Category:** GNU Radio\
**Created:** [March 26, 2014, 8:33am UTC](https://www.ruby-forum.com/t/psk-file-transfer/240068 "2014-03-26T08:33:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [March 26, 2014, 8:33am UTC](https://www.ruby-forum.com/t/psk-file-transfer/240068/1 "2014-03-26T08:33:46Z")

</div>

Hello,

I’m trying to do a simple file transfer over PSK, but the text file I  
get  
on the output is garbled. I’ve got:

file source -\> throttle -\> psk(4) mod -\> psk(4) demod -\> pack K (8) bits  
-\>  
file sink

If I put in a file sink before the modulator, I see the message just  
fine.

What am I missing?

Thanks,  
Stephen A.  
Undergraduate, Electrical Engineering  
Missouri University of Science and Technology

---

<div class="post-metadata">

**Author:** ![stephen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@stephen](https://www.ruby-forum.com/u/stephen)\
**Post date:** [March 26, 2014, 10:46am UTC](https://www.ruby-forum.com/t/psk-file-transfer/240068/2 "2014-03-26T10:46:33Z")

</div>

On 03/26/2014 08:32 AM, Stephen A. wrote:

> Hello,
> 
> I’m trying to do a simple file transfer over PSK, but the text file I  
> get on the output is garbled. I’ve got:
> 
> file source → throttle → psk(4) mod → psk(4) demod → pack K (8) bits  
> → file sink
> 
> If I put in a file sink before the modulator, I see the message just fine.

Do you mean if you put a file sink before the modulator, you get the  
correct message in the file sink after the packer?

PSK Demod is a complete demod chain, it estimates freq. offset, timing  
etc. It’s probably not converging immediately, and then your signal is  
bit-shifted.

M

---

<div class="post-metadata">

**Author:** ![stephen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@stephen](https://www.ruby-forum.com/u/stephen)\
**Post date:** [March 26, 2014, 8:45pm UTC](https://www.ruby-forum.com/t/psk-file-transfer/240068/3 "2014-03-26T20:45:23Z")

</div>

Sorry that was unclear. If I put in a file sink before the modulator,  
and  
call that file tx, and the file on the output of the demodulator rx, tx  
looks fine, but rx still looks like gunk.

Also, if I set the original file source to not repeat, my file sinks  
produce no data. Obviously, if one is sending a message, it only needs  
to  
be sent once, not repeated.

Thanks,

Stephen A.  
Undergraduate, Electrical Engineering  
Missouri University of Science and Technology

---

<div class="post-metadata">

**Author:** ![stephen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@stephen](https://www.ruby-forum.com/u/stephen)\
**Post date:** [March 27, 2014, 10:05am UTC](https://www.ruby-forum.com/t/psk-file-transfer/240068/4 "2014-03-27T10:05:28Z")

</div>

On 03/26/2014 08:44 PM, Stephen A. wrote:

> Sorry that was unclear. If I put in a file sink before the modulator,  
> and call that file tx, and the file on the output of the demodulator rx,  
> tx looks fine, but rx still looks like gunk.
> 
> Also, if I set the original file source to not repeat, my file sinks  
> produce no data. Obviously, if one is sending a message, it only needs  
> to be sent once, not repeated.

Wait, you’re saying:

File source → throttle → File sink

produces zero data when repeat is off? What about when removing the  
throttle?

M

---

<div class="post-metadata">

**Author:** ![stephen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@stephen](https://www.ruby-forum.com/u/stephen)\
**Post date:** [March 27, 2014, 10:09am UTC](https://www.ruby-forum.com/t/psk-file-transfer/240068/5 "2014-03-27T10:09:00Z")

</div>

On 03/27/2014 01:42 AM, Stephen A. wrote:

> I did some more searching on the google machine and found:  
> [Re: [Discuss-gnuradio] Problem with USRP PSK modulation](http://lists.gnu.org/archive/html/discuss-gnuradio/2012-04/msg00500.html)
> 
> It’s like my setup, minus the throttle and the pack K bits, with the  
> addition of packets on either side of the modulator/demodulator. Ran the  
> new setup, and it gives me the correct file on the output, but when I  
> turn off “repeat” in the file source, I get no output.
> 
> Why is repeat magical, and why did I have to packetize my file before  
> sending? Shouldn’t it have just sent as a stream of bits without packets?

The packetizer adds a preamble, which helps the demod lock and, more  
importantly, and as pointed out in my earlier response, it helps you  
find the byte boundaries.

Repeat is not magical, but the demod is stateful, and therefore works  
better if rx’ing more data.

TBH, I didn’t try this out, but I’ll call this a very educated guess 🙂  
For packetized data, you always need some kind of preamble.

Martin

---

<div class="post-metadata">

**Author:** ![stephen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@stephen](https://www.ruby-forum.com/u/stephen)\
**Post date:** [March 29, 2014, 3:19am UTC](https://www.ruby-forum.com/t/psk-file-transfer/240068/6 "2014-03-29T03:19:59Z")

</div>

On 03/27/2014 05:15 PM, Stephen A. wrote:

> File source → throttle → file sink
> 
> produces no data if repeat is off, and the sent file is small. If the  
> sent file is large, it will produce some data, but not all of it.  
> Removing the throttle doesn’t seem to have an effect.
> 
> For example, I sent a file of 19758 bytes across, and received 16384  
> bytes on the output. My “small” file was 407 bytes, and I got 0 bytes on  
> the output.

Hm, that’s multiples of pages…  
I see the same thing, though. When I switch off buffering, it’s better,  
although the file doesn’t get propagated entirely. And the flow graph  
doesn’t terminate on it’s own. Hmm…

> Maybe a bug with file sink/source? Is the source for those blocks easy  
> to find?

Sure, in gr-blocks/lib/file\_\*.

> I still maintain that repeat is magical.

OK, you got us. We have a genie written into the code that only comes  
out when repeat is on.

M

---

<div class="post-metadata">

**Author:** ![stephen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@stephen](https://www.ruby-forum.com/u/stephen)\
**Post date:** [March 27, 2014, 1:43am UTC](https://www.ruby-forum.com/t/psk-file-transfer/240068/7 "2014-03-27T01:43:42Z")

</div>

I did some more searching on the google machine and found:  
[http://lists.gnu.org/archive/html/discuss-gnuradio/2012-04/msg00500.html](http://lists.gnu.org/archive/html/discuss-gnuradio/2012-04/msg00500.html)

It’s like my setup, minus the throttle and the pack K bits, with the  
addition of packets on either side of the modulator/demodulator. Ran the  
new setup, and it gives me the correct file on the output, but when I  
turn  
off “repeat” in the file source, I get no output.

Why is repeat magical, and why did I have to packetize my file before  
sending? Shouldn’t it have just sent as a stream of bits without  
packets?

Thanks,

Stephen A.  
Undergraduate, Electrical Engineering  
Missouri University of Science and Technology
