diff --git a/redpitaya/gnuradio_blocks/dds_control.grc b/redpitaya/gnuradio_blocks/dds_control.grc
new file mode 100644
index 0000000..86416cd
--- /dev/null
+++ b/redpitaya/gnuradio_blocks/dds_control.grc
@@ -0,0 +1,441 @@
+
+
+
+ Thu Feb 2 22:54:58 2017
+
+ options
+
+ author
+
+
+
+ window_size
+
+
+
+ category
+ [GRC Hier Blocks]
+
+
+ comment
+
+
+
+ description
+
+
+
+ _enabled
+ True
+
+
+ _coordinate
+ (8, 8)
+
+
+ _rotation
+ 0
+
+
+ generate_options
+ qt_gui
+
+
+ hier_block_src_path
+ .:
+
+
+ id
+ top_block
+
+
+ max_nouts
+ 0
+
+
+ qt_qss_theme
+
+
+
+ realtime_scheduling
+
+
+
+ run_command
+ {python} -u {filename}
+
+
+ run_options
+ prompt
+
+
+ run
+ True
+
+
+ thread_safe_setters
+
+
+
+ title
+
+
+
+
+ variable_qtgui_range
+
+ comment
+
+
+
+ value
+ 0
+
+
+ _enabled
+ True
+
+
+ _coordinate
+ (704, 24)
+
+
+ gui_hint
+ 1, 0
+
+
+ _rotation
+ 0
+
+
+ id
+ a_dds
+
+
+ label
+ DDS amplitude
+
+
+ min_len
+ 200
+
+
+ orient
+ Qt.Horizontal
+
+
+ start
+ 0
+
+
+ step
+ 128
+
+
+ stop
+ 8191
+
+
+ rangeType
+ int
+
+
+ widget
+ counter_slider
+
+
+
+ variable_qtgui_range
+
+ comment
+
+
+
+ value
+ 0
+
+
+ _enabled
+ True
+
+
+ _coordinate
+ (488, 24)
+
+
+ gui_hint
+ 0, 0
+
+
+ _rotation
+ 0
+
+
+ id
+ f_dds
+
+
+ label
+ DDS frequency
+
+
+ min_len
+ 200
+
+
+ orient
+ Qt.Horizontal
+
+
+ start
+ 0
+
+
+ step
+ 100000
+
+
+ stop
+ 60000000
+
+
+ rangeType
+ int
+
+
+ widget
+ counter_slider
+
+
+
+ variable_qtgui_range
+
+ comment
+
+
+
+ value
+ 0
+
+
+ _enabled
+ True
+
+
+ _coordinate
+ (328, 24)
+
+
+ gui_hint
+ 2, 0
+
+
+ _rotation
+ 0
+
+
+ id
+ offset_out1
+
+
+ label
+ Offset DDS
+
+
+ min_len
+ 200
+
+
+ orient
+ Qt.Horizontal
+
+
+ start
+ -8192
+
+
+ step
+ 100
+
+
+ stop
+ 8191
+
+
+ rangeType
+ int
+
+
+ widget
+ counter_slider
+
+
+
+ variable
+
+ comment
+
+
+
+ _enabled
+ True
+
+
+ _coordinate
+ (8, 160)
+
+
+ _rotation
+ 0
+
+
+ id
+ samp_rate
+
+
+ value
+ 32000
+
+
+
+ add_const_set_offset
+
+ addr
+ 192.168.0.201
+
+
+ alias
+
+
+
+ comment
+
+
+
+ const
+ offset_out1
+
+
+ device
+ /dev/dds1_offset
+
+
+ _enabled
+ True
+
+
+ _coordinate
+ (304, 176)
+
+
+ _rotation
+ 0
+
+
+ id
+ add_const_set_offset_0
+
+
+ port
+ 1001
+
+
+
+ add_const_set_offset
+
+ addr
+ 192.168.0.201
+
+
+ alias
+
+
+
+ comment
+
+
+
+ const
+ a_dds
+
+
+ device
+ /dev/dds1_ampl
+
+
+ _enabled
+ True
+
+
+ _coordinate
+ (704, 176)
+
+
+ _rotation
+ 0
+
+
+ id
+ add_const_set_offset_0_0
+
+
+ port
+ 1001
+
+
+
+ nco_counter_send_conf
+
+ acc_size
+ 32
+
+
+ addr
+ 192.168.0.201
+
+
+ alias
+
+
+
+ comment
+
+
+
+ device
+ /dev/dds1_freq
+
+
+ _enabled
+ True
+
+
+ freq_dds
+ f_dds
+
+
+ freq_ref
+ 125000000
+
+
+ _coordinate
+ (488, 176)
+
+
+ _rotation
+ 0
+
+
+ id
+ nco_counter_send_conf_0
+
+
+ offset
+ 0
+
+
+ port
+ 1001
+
+
+
diff --git a/redpitaya/gnuradio_blocks/gr_add_const_set_offset.xml b/redpitaya/gnuradio_blocks/gr_add_const_set_offset.xml
new file mode 100644
index 0000000..26b1a88
--- /dev/null
+++ b/redpitaya/gnuradio_blocks/gr_add_const_set_offset.xml
@@ -0,0 +1,57 @@
+
+
+
+ add_const_set_offset
+ add_const_set_offset
+ Red Pitaya
+ import redpitaya_gnuradio
+ redpitaya_gnuradio.add_const_set_offset(
+ addr=$addr,
+ port=$port,
+ device=$device,
+ const=$const,
+)
+
+ set_const(device=$device, const=$const)
+
+ Address
+ addr
+ 192.168.0.201
+ string
+
+
+ Port
+ port
+ 1001
+ int
+
+
+ Device
+ device
+ /dev/add_const_0
+ string
+
+
+ Constant
+ const
+ 0
+ int
+
+
diff --git a/redpitaya/gnuradio_blocks/gr_nco_counter_send_conf.xml b/redpitaya/gnuradio_blocks/gr_nco_counter_send_conf.xml
new file mode 100644
index 0000000..f7d6d0c
--- /dev/null
+++ b/redpitaya/gnuradio_blocks/gr_nco_counter_send_conf.xml
@@ -0,0 +1,78 @@
+
+
+
+ nco_counter_send_conf
+ nco_counter_send_conf
+ Red Pitaya
+ import redpitaya_gnuradio
+ redpitaya_gnuradio.nco_counter_send_conf(
+ addr=$addr,
+ port=$port,
+ device=$device,
+ freq_ref=$freq_ref,
+ freq_dds=$freq_dds,
+ acc_size=$acc_size,
+ offset=$offset,
+)
+
+ set_nco(device=$device, freq_ref=$freq_ref, freq_dds=$freq_dds, acc_size=$acc_size, offset=$offset)
+
+ Address
+ addr
+ 192.168.0.201
+ string
+
+
+ Port
+ port
+ 1001
+ int
+
+
+ Device
+ device
+ /dev/dds1
+ string
+
+
+ Frequency ref
+ freq_ref
+ 125000000
+ int
+
+
+ Frequency DDS
+ freq_dds
+ 0
+ int
+
+
+ Accumulator size
+ acc_size
+ 28
+ int
+
+
+ Offset
+ offset
+ 0
+ int
+
+
diff --git a/redpitaya/gnuradio_blocks/redpitaya_gnuradio.py b/redpitaya/gnuradio_blocks/redpitaya_gnuradio.py
new file mode 100644
index 0000000..1ce3b3a
--- /dev/null
+++ b/redpitaya/gnuradio_blocks/redpitaya_gnuradio.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+
+# GNU Radio blocks for the Red Pitaya transceiver
+# Copyright (C) 2015 Renzo Davoli
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+import socket
+from gnuradio import gr, blocks
+
+class add_const_set_offset(gr.hier_block2):
+ def __init__(self, addr, port, device, const):
+ self.name = "add_const_set_offset"
+ gr.hier_block2.__init__(
+ self,
+ name = self.name,
+ input_signature = gr.io_signature(0, 0, 0),
+ output_signature = gr.io_signature(0, 0, 0)
+ )
+ self.ctrl_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ self.ctrl_sock.connect((addr, port))
+ self.set_const(device, const)
+
+ def set_const(self, device, const):
+ self.ctrl_sock.send('%s;%s;%i\n'%(self.name, device, const))
+
+
+class nco_counter_send_conf(gr.hier_block2):
+ def __init__(self, addr, port, device, freq_ref, freq_dds, acc_size, offset):
+ self.name = "nco_counter_send_conf"
+ gr.hier_block2.__init__(
+ self,
+ name = self.name,
+ input_signature = gr.io_signature(0, 0, 0),
+ output_signature = gr.io_signature(0, 0, 0)
+ )
+ self.ctrl_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ self.ctrl_sock.connect((addr, port))
+ self.set_nco(device, freq_ref, freq_dds, acc_size, offset)
+
+ def set_nco(self, device, freq_ref, freq_dds, acc_size, offset):
+ self.ctrl_sock.send('%s;%s;%i;%i;%i;%i\n'%(self.name, device, freq_ref, freq_dds, acc_size, offset))
diff --git a/redpitaya/server/liboscimp_fpga.py b/redpitaya/server/liboscimp_fpga.py
new file mode 100644
index 0000000..77a84ce
--- /dev/null
+++ b/redpitaya/server/liboscimp_fpga.py
@@ -0,0 +1,8 @@
+import ctypes
+lib = ctypes.CDLL('/usr/lib/liboscimp_fpga.so')
+
+def add_const_set_offset(device, offset):
+ lib.add_const_set_offset(device, offset)
+
+def nco_counter_send_conf(device, freq_ref, freq_dds, acc_size, offset):
+ lib.nco_counter_send_conf(device, freq_ref, freq_dds, acc_size, offset)
diff --git a/redpitaya/server/server.py b/redpitaya/server/server.py
new file mode 100755
index 0000000..620464f
--- /dev/null
+++ b/redpitaya/server/server.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+import socket
+from thread import start_new_thread
+import liboscimp_fpga
+
+ctrl_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ctrl_sock.bind(('', 1001))
+ctrl_sock.listen(10)
+
+def clientThread(conn, addr):
+ print('Open connection from ' + addr[0] + ':' + str(addr[1]) + '\n')
+ while True:
+ data = ''
+ while '\n' not in data:
+ data += conn.recv(8)
+ if not data:
+ break
+ recv = data.split(';')
+ if recv[0] == "add_const_set_offset":
+ try:
+ liboscimp_fpga.add_const_set_offset(recv[1], int(recv[2]))
+ except:
+ pass
+ if recv[0] == "nco_counter_send_conf":
+ try:
+ liboscimp_fpga.nco_counter_send_conf(recv[1], int(recv[2]), int(recv[3]), int(recv[4]), int(recv[5]))
+ except:
+ pass
+ conn.close()
+
+while 1:
+ conn, addr = ctrl_sock.accept()
+ start_new_thread(clientThread ,(conn, addr,))
+
+ctrl_sock.close()
diff --git a/redpitaya/server/test.py b/redpitaya/server/test.py
new file mode 100644
index 0000000..2ba73ef
--- /dev/null
+++ b/redpitaya/server/test.py
@@ -0,0 +1,6 @@
+import time
+
+with open('/dev/data16_adc12', 'r') as f:
+ for line in f:
+ print(line.encode('bin'))
+ time.sleep(0.1)
diff --git a/redpitaya/server/test_emb.py b/redpitaya/server/test_emb.py
new file mode 100755
index 0000000..837fd52
--- /dev/null
+++ b/redpitaya/server/test_emb.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+import ctypes, argparse
+import liboscimp_fpga
+
+def parse():
+ parser = argparse.ArgumentParser(description = 'Set offsets to DAC1 and DAC2')
+ parser.add_argument('-of1',
+ action='store',
+ dest='of1',
+ default=0,
+ help='DAC1 offset (bits)')
+ parser.add_argument('-of2',
+ action='store',
+ dest='of2',
+ default=0,
+ help='DAC2 offset (bits)')
+ args = parser.parse_args()
+ return args
+
+def main():
+ args = parse()
+ of1 = int(args.of1)
+ of2 = int(args.of2)
+ liboscimp_fpga.add_const_set_offset("/dev/add_const_0", of1)
+ liboscimp_fpga.add_const_set_offset("/dev/add_const_1", of2)
+ print('offset DAC1 : %i'%of1)
+ print('offset DAC2 : %i'%of2)
+
+if __name__ == "__main__":
+ main()