Commit ed4b2fee689f33cd9982c130724c107e96dbb08f
1 parent
ac6ebf3310
Exists in
master
minor fixes
Showing 18 changed files with 1284 additions and 19 deletions Side-by-side Diff
- redpitaya/client/dds_control.grc
- redpitaya/client/gr_add_const_set_offset.xml
- redpitaya/client/gr_nco_counter_send_conf.xml
- redpitaya/client/gr_source_test.xml
- redpitaya/client/gr_source_test.xml.old
- redpitaya/client/redpitaya_gnuradio.py
- redpitaya/client/redpitaya_gnuradio.pyc
- redpitaya/client/sourceme.bma
- redpitaya/client/top_block.py
- redpitaya/gnuradio_blocks/dds_control.grc
- redpitaya/gnuradio_blocks/gr_source_test.xml
- redpitaya/gnuradio_blocks/gr_source_test.xml.old
- redpitaya/gnuradio_blocks/redpitaya_gnuradio.py
- redpitaya/gnuradio_blocks/redpitaya_gnuradio.pyc
- redpitaya/gnuradio_blocks/top_block.py
- redpitaya/server/server.py
- redpitaya/server/test.py
- redpitaya/server/test_emb.py
redpitaya/client/dds_control.grc
| 1 | +<?xml version='1.0' encoding='utf-8'?> | |
| 2 | +<?grc format='1' created='3.7.10'?> | |
| 3 | +<flow_graph> | |
| 4 | + <timestamp>Thu Feb 2 22:54:58 2017</timestamp> | |
| 5 | + <block> | |
| 6 | + <key>options</key> | |
| 7 | + <param> | |
| 8 | + <key>author</key> | |
| 9 | + <value></value> | |
| 10 | + </param> | |
| 11 | + <param> | |
| 12 | + <key>window_size</key> | |
| 13 | + <value></value> | |
| 14 | + </param> | |
| 15 | + <param> | |
| 16 | + <key>category</key> | |
| 17 | + <value>[GRC Hier Blocks]</value> | |
| 18 | + </param> | |
| 19 | + <param> | |
| 20 | + <key>comment</key> | |
| 21 | + <value></value> | |
| 22 | + </param> | |
| 23 | + <param> | |
| 24 | + <key>description</key> | |
| 25 | + <value></value> | |
| 26 | + </param> | |
| 27 | + <param> | |
| 28 | + <key>_enabled</key> | |
| 29 | + <value>True</value> | |
| 30 | + </param> | |
| 31 | + <param> | |
| 32 | + <key>_coordinate</key> | |
| 33 | + <value>(8, 8)</value> | |
| 34 | + </param> | |
| 35 | + <param> | |
| 36 | + <key>_rotation</key> | |
| 37 | + <value>0</value> | |
| 38 | + </param> | |
| 39 | + <param> | |
| 40 | + <key>generate_options</key> | |
| 41 | + <value>qt_gui</value> | |
| 42 | + </param> | |
| 43 | + <param> | |
| 44 | + <key>hier_block_src_path</key> | |
| 45 | + <value>.:</value> | |
| 46 | + </param> | |
| 47 | + <param> | |
| 48 | + <key>id</key> | |
| 49 | + <value>top_block</value> | |
| 50 | + </param> | |
| 51 | + <param> | |
| 52 | + <key>max_nouts</key> | |
| 53 | + <value>0</value> | |
| 54 | + </param> | |
| 55 | + <param> | |
| 56 | + <key>qt_qss_theme</key> | |
| 57 | + <value></value> | |
| 58 | + </param> | |
| 59 | + <param> | |
| 60 | + <key>realtime_scheduling</key> | |
| 61 | + <value></value> | |
| 62 | + </param> | |
| 63 | + <param> | |
| 64 | + <key>run_command</key> | |
| 65 | + <value>{python} -u {filename}</value> | |
| 66 | + </param> | |
| 67 | + <param> | |
| 68 | + <key>run_options</key> | |
| 69 | + <value>prompt</value> | |
| 70 | + </param> | |
| 71 | + <param> | |
| 72 | + <key>run</key> | |
| 73 | + <value>True</value> | |
| 74 | + </param> | |
| 75 | + <param> | |
| 76 | + <key>thread_safe_setters</key> | |
| 77 | + <value></value> | |
| 78 | + </param> | |
| 79 | + <param> | |
| 80 | + <key>title</key> | |
| 81 | + <value></value> | |
| 82 | + </param> | |
| 83 | + </block> | |
| 84 | + <block> | |
| 85 | + <key>variable_qtgui_range</key> | |
| 86 | + <param> | |
| 87 | + <key>comment</key> | |
| 88 | + <value></value> | |
| 89 | + </param> | |
| 90 | + <param> | |
| 91 | + <key>value</key> | |
| 92 | + <value>0</value> | |
| 93 | + </param> | |
| 94 | + <param> | |
| 95 | + <key>_enabled</key> | |
| 96 | + <value>True</value> | |
| 97 | + </param> | |
| 98 | + <param> | |
| 99 | + <key>_coordinate</key> | |
| 100 | + <value>(704, 24)</value> | |
| 101 | + </param> | |
| 102 | + <param> | |
| 103 | + <key>gui_hint</key> | |
| 104 | + <value>1, 0</value> | |
| 105 | + </param> | |
| 106 | + <param> | |
| 107 | + <key>_rotation</key> | |
| 108 | + <value>0</value> | |
| 109 | + </param> | |
| 110 | + <param> | |
| 111 | + <key>id</key> | |
| 112 | + <value>a_dds</value> | |
| 113 | + </param> | |
| 114 | + <param> | |
| 115 | + <key>label</key> | |
| 116 | + <value>DDS amplitude</value> | |
| 117 | + </param> | |
| 118 | + <param> | |
| 119 | + <key>min_len</key> | |
| 120 | + <value>200</value> | |
| 121 | + </param> | |
| 122 | + <param> | |
| 123 | + <key>orient</key> | |
| 124 | + <value>Qt.Horizontal</value> | |
| 125 | + </param> | |
| 126 | + <param> | |
| 127 | + <key>start</key> | |
| 128 | + <value>0</value> | |
| 129 | + </param> | |
| 130 | + <param> | |
| 131 | + <key>step</key> | |
| 132 | + <value>128</value> | |
| 133 | + </param> | |
| 134 | + <param> | |
| 135 | + <key>stop</key> | |
| 136 | + <value>8191</value> | |
| 137 | + </param> | |
| 138 | + <param> | |
| 139 | + <key>rangeType</key> | |
| 140 | + <value>int</value> | |
| 141 | + </param> | |
| 142 | + <param> | |
| 143 | + <key>widget</key> | |
| 144 | + <value>counter_slider</value> | |
| 145 | + </param> | |
| 146 | + </block> | |
| 147 | + <block> | |
| 148 | + <key>variable</key> | |
| 149 | + <param> | |
| 150 | + <key>comment</key> | |
| 151 | + <value></value> | |
| 152 | + </param> | |
| 153 | + <param> | |
| 154 | + <key>_enabled</key> | |
| 155 | + <value>True</value> | |
| 156 | + </param> | |
| 157 | + <param> | |
| 158 | + <key>_coordinate</key> | |
| 159 | + <value>(0, 248)</value> | |
| 160 | + </param> | |
| 161 | + <param> | |
| 162 | + <key>_rotation</key> | |
| 163 | + <value>0</value> | |
| 164 | + </param> | |
| 165 | + <param> | |
| 166 | + <key>id</key> | |
| 167 | + <value>addr</value> | |
| 168 | + </param> | |
| 169 | + <param> | |
| 170 | + <key>value</key> | |
| 171 | + <value>"192.168.0.202"</value> | |
| 172 | + </param> | |
| 173 | + </block> | |
| 174 | + <block> | |
| 175 | + <key>variable_qtgui_range</key> | |
| 176 | + <param> | |
| 177 | + <key>comment</key> | |
| 178 | + <value></value> | |
| 179 | + </param> | |
| 180 | + <param> | |
| 181 | + <key>value</key> | |
| 182 | + <value>0</value> | |
| 183 | + </param> | |
| 184 | + <param> | |
| 185 | + <key>_enabled</key> | |
| 186 | + <value>True</value> | |
| 187 | + </param> | |
| 188 | + <param> | |
| 189 | + <key>_coordinate</key> | |
| 190 | + <value>(488, 24)</value> | |
| 191 | + </param> | |
| 192 | + <param> | |
| 193 | + <key>gui_hint</key> | |
| 194 | + <value>0, 0</value> | |
| 195 | + </param> | |
| 196 | + <param> | |
| 197 | + <key>_rotation</key> | |
| 198 | + <value>0</value> | |
| 199 | + </param> | |
| 200 | + <param> | |
| 201 | + <key>id</key> | |
| 202 | + <value>f_dds</value> | |
| 203 | + </param> | |
| 204 | + <param> | |
| 205 | + <key>label</key> | |
| 206 | + <value>DDS frequency</value> | |
| 207 | + </param> | |
| 208 | + <param> | |
| 209 | + <key>min_len</key> | |
| 210 | + <value>200</value> | |
| 211 | + </param> | |
| 212 | + <param> | |
| 213 | + <key>orient</key> | |
| 214 | + <value>Qt.Horizontal</value> | |
| 215 | + </param> | |
| 216 | + <param> | |
| 217 | + <key>start</key> | |
| 218 | + <value>0</value> | |
| 219 | + </param> | |
| 220 | + <param> | |
| 221 | + <key>step</key> | |
| 222 | + <value>100000</value> | |
| 223 | + </param> | |
| 224 | + <param> | |
| 225 | + <key>stop</key> | |
| 226 | + <value>60000000</value> | |
| 227 | + </param> | |
| 228 | + <param> | |
| 229 | + <key>rangeType</key> | |
| 230 | + <value>int</value> | |
| 231 | + </param> | |
| 232 | + <param> | |
| 233 | + <key>widget</key> | |
| 234 | + <value>counter_slider</value> | |
| 235 | + </param> | |
| 236 | + </block> | |
| 237 | + <block> | |
| 238 | + <key>variable_qtgui_range</key> | |
| 239 | + <param> | |
| 240 | + <key>comment</key> | |
| 241 | + <value></value> | |
| 242 | + </param> | |
| 243 | + <param> | |
| 244 | + <key>value</key> | |
| 245 | + <value>0</value> | |
| 246 | + </param> | |
| 247 | + <param> | |
| 248 | + <key>_enabled</key> | |
| 249 | + <value>True</value> | |
| 250 | + </param> | |
| 251 | + <param> | |
| 252 | + <key>_coordinate</key> | |
| 253 | + <value>(328, 24)</value> | |
| 254 | + </param> | |
| 255 | + <param> | |
| 256 | + <key>gui_hint</key> | |
| 257 | + <value>2, 0</value> | |
| 258 | + </param> | |
| 259 | + <param> | |
| 260 | + <key>_rotation</key> | |
| 261 | + <value>0</value> | |
| 262 | + </param> | |
| 263 | + <param> | |
| 264 | + <key>id</key> | |
| 265 | + <value>offset_out1</value> | |
| 266 | + </param> | |
| 267 | + <param> | |
| 268 | + <key>label</key> | |
| 269 | + <value>Offset DDS</value> | |
| 270 | + </param> | |
| 271 | + <param> | |
| 272 | + <key>min_len</key> | |
| 273 | + <value>200</value> | |
| 274 | + </param> | |
| 275 | + <param> | |
| 276 | + <key>orient</key> | |
| 277 | + <value>Qt.Horizontal</value> | |
| 278 | + </param> | |
| 279 | + <param> | |
| 280 | + <key>start</key> | |
| 281 | + <value>-8192</value> | |
| 282 | + </param> | |
| 283 | + <param> | |
| 284 | + <key>step</key> | |
| 285 | + <value>100</value> | |
| 286 | + </param> | |
| 287 | + <param> | |
| 288 | + <key>stop</key> | |
| 289 | + <value>8191</value> | |
| 290 | + </param> | |
| 291 | + <param> | |
| 292 | + <key>rangeType</key> | |
| 293 | + <value>int</value> | |
| 294 | + </param> | |
| 295 | + <param> | |
| 296 | + <key>widget</key> | |
| 297 | + <value>counter_slider</value> | |
| 298 | + </param> | |
| 299 | + </block> | |
| 300 | + <block> | |
| 301 | + <key>variable</key> | |
| 302 | + <param> | |
| 303 | + <key>comment</key> | |
| 304 | + <value></value> | |
| 305 | + </param> | |
| 306 | + <param> | |
| 307 | + <key>_enabled</key> | |
| 308 | + <value>True</value> | |
| 309 | + </param> | |
| 310 | + <param> | |
| 311 | + <key>_coordinate</key> | |
| 312 | + <value>(0, 320)</value> | |
| 313 | + </param> | |
| 314 | + <param> | |
| 315 | + <key>_rotation</key> | |
| 316 | + <value>0</value> | |
| 317 | + </param> | |
| 318 | + <param> | |
| 319 | + <key>id</key> | |
| 320 | + <value>port</value> | |
| 321 | + </param> | |
| 322 | + <param> | |
| 323 | + <key>value</key> | |
| 324 | + <value>1001</value> | |
| 325 | + </param> | |
| 326 | + </block> | |
| 327 | + <block> | |
| 328 | + <key>variable</key> | |
| 329 | + <param> | |
| 330 | + <key>comment</key> | |
| 331 | + <value></value> | |
| 332 | + </param> | |
| 333 | + <param> | |
| 334 | + <key>_enabled</key> | |
| 335 | + <value>True</value> | |
| 336 | + </param> | |
| 337 | + <param> | |
| 338 | + <key>_coordinate</key> | |
| 339 | + <value>(8, 160)</value> | |
| 340 | + </param> | |
| 341 | + <param> | |
| 342 | + <key>_rotation</key> | |
| 343 | + <value>0</value> | |
| 344 | + </param> | |
| 345 | + <param> | |
| 346 | + <key>id</key> | |
| 347 | + <value>samp_rate</value> | |
| 348 | + </param> | |
| 349 | + <param> | |
| 350 | + <key>value</key> | |
| 351 | + <value>32000</value> | |
| 352 | + </param> | |
| 353 | + </block> | |
| 354 | + <block> | |
| 355 | + <key>add_const_set_offset</key> | |
| 356 | + <param> | |
| 357 | + <key>addr</key> | |
| 358 | + <value>addr</value> | |
| 359 | + </param> | |
| 360 | + <param> | |
| 361 | + <key>alias</key> | |
| 362 | + <value></value> | |
| 363 | + </param> | |
| 364 | + <param> | |
| 365 | + <key>comment</key> | |
| 366 | + <value></value> | |
| 367 | + </param> | |
| 368 | + <param> | |
| 369 | + <key>const</key> | |
| 370 | + <value>offset_out1</value> | |
| 371 | + </param> | |
| 372 | + <param> | |
| 373 | + <key>device</key> | |
| 374 | + <value>/dev/dds_offset</value> | |
| 375 | + </param> | |
| 376 | + <param> | |
| 377 | + <key>_enabled</key> | |
| 378 | + <value>True</value> | |
| 379 | + </param> | |
| 380 | + <param> | |
| 381 | + <key>_coordinate</key> | |
| 382 | + <value>(304, 176)</value> | |
| 383 | + </param> | |
| 384 | + <param> | |
| 385 | + <key>_rotation</key> | |
| 386 | + <value>0</value> | |
| 387 | + </param> | |
| 388 | + <param> | |
| 389 | + <key>id</key> | |
| 390 | + <value>add_const_set_offset_0</value> | |
| 391 | + </param> | |
| 392 | + <param> | |
| 393 | + <key>port</key> | |
| 394 | + <value>port</value> | |
| 395 | + </param> | |
| 396 | + </block> | |
| 397 | + <block> | |
| 398 | + <key>add_const_set_offset</key> | |
| 399 | + <param> | |
| 400 | + <key>addr</key> | |
| 401 | + <value>addr</value> | |
| 402 | + </param> | |
| 403 | + <param> | |
| 404 | + <key>alias</key> | |
| 405 | + <value></value> | |
| 406 | + </param> | |
| 407 | + <param> | |
| 408 | + <key>comment</key> | |
| 409 | + <value></value> | |
| 410 | + </param> | |
| 411 | + <param> | |
| 412 | + <key>const</key> | |
| 413 | + <value>a_dds</value> | |
| 414 | + </param> | |
| 415 | + <param> | |
| 416 | + <key>device</key> | |
| 417 | + <value>/dev/dds_ampl</value> | |
| 418 | + </param> | |
| 419 | + <param> | |
| 420 | + <key>_enabled</key> | |
| 421 | + <value>True</value> | |
| 422 | + </param> | |
| 423 | + <param> | |
| 424 | + <key>_coordinate</key> | |
| 425 | + <value>(704, 176)</value> | |
| 426 | + </param> | |
| 427 | + <param> | |
| 428 | + <key>_rotation</key> | |
| 429 | + <value>0</value> | |
| 430 | + </param> | |
| 431 | + <param> | |
| 432 | + <key>id</key> | |
| 433 | + <value>add_const_set_offset_0_0</value> | |
| 434 | + </param> | |
| 435 | + <param> | |
| 436 | + <key>port</key> | |
| 437 | + <value>port</value> | |
| 438 | + </param> | |
| 439 | + </block> | |
| 440 | + <block> | |
| 441 | + <key>nco_counter_send_conf</key> | |
| 442 | + <param> | |
| 443 | + <key>acc_size</key> | |
| 444 | + <value>32</value> | |
| 445 | + </param> | |
| 446 | + <param> | |
| 447 | + <key>addr</key> | |
| 448 | + <value>addr</value> | |
| 449 | + </param> | |
| 450 | + <param> | |
| 451 | + <key>alias</key> | |
| 452 | + <value></value> | |
| 453 | + </param> | |
| 454 | + <param> | |
| 455 | + <key>comment</key> | |
| 456 | + <value></value> | |
| 457 | + </param> | |
| 458 | + <param> | |
| 459 | + <key>device</key> | |
| 460 | + <value>/dev/dds_freq</value> | |
| 461 | + </param> | |
| 462 | + <param> | |
| 463 | + <key>_enabled</key> | |
| 464 | + <value>True</value> | |
| 465 | + </param> | |
| 466 | + <param> | |
| 467 | + <key>freq_dds</key> | |
| 468 | + <value>f_dds</value> | |
| 469 | + </param> | |
| 470 | + <param> | |
| 471 | + <key>freq_ref</key> | |
| 472 | + <value>125000000</value> | |
| 473 | + </param> | |
| 474 | + <param> | |
| 475 | + <key>_coordinate</key> | |
| 476 | + <value>(488, 176)</value> | |
| 477 | + </param> | |
| 478 | + <param> | |
| 479 | + <key>_rotation</key> | |
| 480 | + <value>0</value> | |
| 481 | + </param> | |
| 482 | + <param> | |
| 483 | + <key>id</key> | |
| 484 | + <value>nco_counter_send_conf_0</value> | |
| 485 | + </param> | |
| 486 | + <param> | |
| 487 | + <key>offset</key> | |
| 488 | + <value>0</value> | |
| 489 | + </param> | |
| 490 | + <param> | |
| 491 | + <key>port</key> | |
| 492 | + <value>port</value> | |
| 493 | + </param> | |
| 494 | + </block> | |
| 495 | +</flow_graph> |
redpitaya/client/gr_add_const_set_offset.xml
| 1 | +<?xml version="1.0"?> | |
| 2 | +<!-- | |
| 3 | +# GNU Radio blocks for the Red Pitaya transceiver | |
| 4 | +# Copyright (C) 2015 Renzo Davoli | |
| 5 | +# | |
| 6 | +# This program is free software; you can redistribute it and/or | |
| 7 | +# modify it under the terms of the GNU General Public License | |
| 8 | +# as published by the Free Software Foundation; either version 2 | |
| 9 | +# of the License, or (at your option) any later version. | |
| 10 | +# | |
| 11 | +# This program is distributed in the hope that it will be useful, | |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | +# GNU General Public License for more details. | |
| 15 | +# | |
| 16 | +# You should have received a copy of the GNU General Public License | |
| 17 | +# along with this program; if not, write to the Free Software | |
| 18 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 19 | + --> | |
| 20 | +<block> | |
| 21 | + <name>add_const_set_offset</name> | |
| 22 | + <key>add_const_set_offset</key> | |
| 23 | + <category>Red Pitaya</category> | |
| 24 | + <import>import redpitaya_gnuradio</import> | |
| 25 | + <make>redpitaya_gnuradio.add_const_set_offset( | |
| 26 | + addr=$addr, | |
| 27 | + port=$port, | |
| 28 | + device=$device, | |
| 29 | + const=$const, | |
| 30 | +) | |
| 31 | + </make> | |
| 32 | + <callback>set_const(device=$device, const=$const)</callback> | |
| 33 | + <param> | |
| 34 | + <name>Address</name> | |
| 35 | + <key>addr</key> | |
| 36 | + <value>192.168.0.201</value> | |
| 37 | + <type>string</type> | |
| 38 | + </param> | |
| 39 | + <param> | |
| 40 | + <name>Port</name> | |
| 41 | + <key>port</key> | |
| 42 | + <value>1001</value> | |
| 43 | + <type>int</type> | |
| 44 | + </param> | |
| 45 | + <param> | |
| 46 | + <name>Device</name> | |
| 47 | + <key>device</key> | |
| 48 | + <value>/dev/add_const_0</value> | |
| 49 | + <type>string</type> | |
| 50 | + </param> | |
| 51 | + <param> | |
| 52 | + <name>Constant</name> | |
| 53 | + <key>const</key> | |
| 54 | + <value>0</value> | |
| 55 | + <type>int</type> | |
| 56 | + </param> | |
| 57 | +</block> |
redpitaya/client/gr_nco_counter_send_conf.xml
| 1 | +<?xml version="1.0"?> | |
| 2 | +<!-- | |
| 3 | +# GNU Radio blocks for the Red Pitaya transceiver | |
| 4 | +# Copyright (C) 2015 Renzo Davoli | |
| 5 | +# | |
| 6 | +# This program is free software; you can redistribute it and/or | |
| 7 | +# modify it under the terms of the GNU General Public License | |
| 8 | +# as published by the Free Software Foundation; either version 2 | |
| 9 | +# of the License, or (at your option) any later version. | |
| 10 | +# | |
| 11 | +# This program is distributed in the hope that it will be useful, | |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | +# GNU General Public License for more details. | |
| 15 | +# | |
| 16 | +# You should have received a copy of the GNU General Public License | |
| 17 | +# along with this program; if not, write to the Free Software | |
| 18 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 19 | + --> | |
| 20 | +<block> | |
| 21 | + <name>nco_counter_send_conf</name> | |
| 22 | + <key>nco_counter_send_conf</key> | |
| 23 | + <category>Red Pitaya</category> | |
| 24 | + <import>import redpitaya_gnuradio</import> | |
| 25 | + <make>redpitaya_gnuradio.nco_counter_send_conf( | |
| 26 | + addr=$addr, | |
| 27 | + port=$port, | |
| 28 | + device=$device, | |
| 29 | + freq_ref=$freq_ref, | |
| 30 | + freq_dds=$freq_dds, | |
| 31 | + acc_size=$acc_size, | |
| 32 | + offset=$offset, | |
| 33 | +) | |
| 34 | + </make> | |
| 35 | + <callback>set_nco(device=$device, freq_ref=$freq_ref, freq_dds=$freq_dds, acc_size=$acc_size, offset=$offset)</callback> | |
| 36 | + <param> | |
| 37 | + <name>Address</name> | |
| 38 | + <key>addr</key> | |
| 39 | + <value>192.168.0.201</value> | |
| 40 | + <type>string</type> | |
| 41 | + </param> | |
| 42 | + <param> | |
| 43 | + <name>Port</name> | |
| 44 | + <key>port</key> | |
| 45 | + <value>1001</value> | |
| 46 | + <type>int</type> | |
| 47 | + </param> | |
| 48 | + <param> | |
| 49 | + <name>Device</name> | |
| 50 | + <key>device</key> | |
| 51 | + <value>/dev/dds1</value> | |
| 52 | + <type>string</type> | |
| 53 | + </param> | |
| 54 | + <param> | |
| 55 | + <name>Frequency ref</name> | |
| 56 | + <key>freq_ref</key> | |
| 57 | + <value>125000000</value> | |
| 58 | + <type>int</type> | |
| 59 | + </param> | |
| 60 | + <param> | |
| 61 | + <name>Frequency DDS</name> | |
| 62 | + <key>freq_dds</key> | |
| 63 | + <value>0</value> | |
| 64 | + <type>int</type> | |
| 65 | + </param> | |
| 66 | + <param> | |
| 67 | + <name>Accumulator size</name> | |
| 68 | + <key>acc_size</key> | |
| 69 | + <value>28</value> | |
| 70 | + <type>int</type> | |
| 71 | + </param> | |
| 72 | + <param> | |
| 73 | + <name>Offset</name> | |
| 74 | + <key>offset</key> | |
| 75 | + <value>0</value> | |
| 76 | + <type>int</type> | |
| 77 | + </param> | |
| 78 | +</block> |
redpitaya/client/gr_source_test.xml
| 1 | +<?xml version="1.0"?> | |
| 2 | +<!-- | |
| 3 | +# GNU Radio blocks for the Red Pitaya transceiver | |
| 4 | +# Copyright (C) 2015 Renzo Davoli | |
| 5 | +# | |
| 6 | +# This program is free software; you can redistribute it and/or | |
| 7 | +# modify it under the terms of the GNU General Public License | |
| 8 | +# as published by the Free Software Foundation; either version 2 | |
| 9 | +# of the License, or (at your option) any later version. | |
| 10 | +# | |
| 11 | +# This program is distributed in the hope that it will be useful, | |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | +# GNU General Public License for more details. | |
| 15 | +# | |
| 16 | +# You should have received a copy of the GNU General Public License | |
| 17 | +# along with this program; if not, write to the Free Software | |
| 18 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 19 | + --> | |
| 20 | +<block> | |
| 21 | + <name>source_test</name> | |
| 22 | + <key>source_test</key> | |
| 23 | + <category>Red Pitaya</category> | |
| 24 | + <import>import redpitaya_gnuradio</import> | |
| 25 | + <make>redpitaya_gnuradio.source_test()</make> | |
| 26 | + <source> | |
| 27 | + <name>out</name> | |
| 28 | + <type>complex</type> | |
| 29 | + </source> | |
| 30 | +</block> |
redpitaya/client/gr_source_test.xml.old
| 1 | +<?xml version="1.0"?> | |
| 2 | +<!-- | |
| 3 | +# GNU Radio blocks for the Red Pitaya transceiver | |
| 4 | +# Copyright (C) 2015 Renzo Davoli | |
| 5 | +# | |
| 6 | +# This program is free software; you can redistribute it and/or | |
| 7 | +# modify it under the terms of the GNU General Public License | |
| 8 | +# as published by the Free Software Foundation; either version 2 | |
| 9 | +# of the License, or (at your option) any later version. | |
| 10 | +# | |
| 11 | +# This program is distributed in the hope that it will be useful, | |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | +# GNU General Public License for more details. | |
| 15 | +# | |
| 16 | +# You should have received a copy of the GNU General Public License | |
| 17 | +# along with this program; if not, write to the Free Software | |
| 18 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 19 | + --> | |
| 20 | +<block> | |
| 21 | + <name>source_test</name> | |
| 22 | + <key>source_test</key> | |
| 23 | + <category>Red Pitaya</category> | |
| 24 | + <import>import redpitaya_gnuradio</import> | |
| 25 | + <make>redpitaya_gnuradio.source_test()</make> | |
| 26 | + <source> | |
| 27 | + <name>out</name> | |
| 28 | + <type>complex</type> | |
| 29 | + </source> | |
| 30 | +</block> |
redpitaya/client/redpitaya_gnuradio.py
| 1 | +#!/usr/bin/env python | |
| 2 | + | |
| 3 | +# GNU Radio blocks for the Red Pitaya transceiver | |
| 4 | +# Copyright (C) 2015 Renzo Davoli | |
| 5 | +# | |
| 6 | +# This program is free software; you can redistribute it and/or | |
| 7 | +# modify it under the terms of the GNU General Public License | |
| 8 | +# as published by the Free Software Foundation; either version 2 | |
| 9 | +# of the License, or (at your option) any later version. | |
| 10 | +# | |
| 11 | +# This program is distributed in the hope that it will be useful, | |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | +# GNU General Public License for more details. | |
| 15 | +# | |
| 16 | +# You should have received a copy of the GNU General Public License | |
| 17 | +# along with this program; if not, write to the Free Software | |
| 18 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 19 | + | |
| 20 | +import socket, os | |
| 21 | +from gnuradio import gr, blocks | |
| 22 | + | |
| 23 | +class add_const_set_offset(gr.hier_block2): | |
| 24 | + def __init__(self, addr, port, device, const): | |
| 25 | + self.name = "add_const_set_offset" | |
| 26 | + gr.hier_block2.__init__( | |
| 27 | + self, | |
| 28 | + name = self.name, | |
| 29 | + input_signature = gr.io_signature(0, 0, 0), | |
| 30 | + output_signature = gr.io_signature(0, 0, 0) | |
| 31 | + ) | |
| 32 | + self.ctrl_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| 33 | + self.ctrl_sock.connect((addr, port)) | |
| 34 | + self.set_const(device, const) | |
| 35 | + | |
| 36 | + def set_const(self, device, const): | |
| 37 | + self.ctrl_sock.send('%s;%s;%i\n'%(self.name, device, const)) | |
| 38 | + | |
| 39 | + | |
| 40 | +class nco_counter_send_conf(gr.hier_block2): | |
| 41 | + def __init__(self, addr, port, device, freq_ref, freq_dds, acc_size, offset): | |
| 42 | + self.name = "nco_counter_send_conf" | |
| 43 | + gr.hier_block2.__init__( | |
| 44 | + self, | |
| 45 | + name = self.name, | |
| 46 | + input_signature = gr.io_signature(0, 0, 0), | |
| 47 | + output_signature = gr.io_signature(0, 0, 0) | |
| 48 | + ) | |
| 49 | + self.ctrl_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| 50 | + self.ctrl_sock.connect((addr, port)) | |
| 51 | + self.set_nco(device, freq_ref, freq_dds, acc_size, offset) | |
| 52 | + | |
| 53 | + def set_nco(self, device, freq_ref, freq_dds, acc_size, offset): | |
| 54 | + self.ctrl_sock.send('%s;%s;%i;%i;%i;%i\n'%(self.name, device, freq_ref, freq_dds, acc_size, offset)) | |
| 55 | + | |
| 56 | +'''~ | |
| 57 | +class source_test(gr.hier_block2): | |
| 58 | + def __init__(self): | |
| 59 | + self.name = "source_test" | |
| 60 | + gr.hier_block2.__init__( | |
| 61 | + self, | |
| 62 | + name = self.name, | |
| 63 | + input_signature = gr.io_signature(0, 0, 0), | |
| 64 | + output_signature = gr.io_signature(1, 1, gr.sizeof_gr_complex) | |
| 65 | + ) | |
| 66 | + self.data_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| 67 | + self.data_sock.connect((addr, port)) | |
| 68 | + self.data_sock.send('%s'%self.name) | |
| 69 | + fd = os.dup(self.data_sock.fileno()) | |
| 70 | + self.connect(blocks.file_descriptor_source(gr.sizeof_gr_complex, fd), self) | |
| 71 | +''' |
redpitaya/client/redpitaya_gnuradio.pyc
No preview for this file type
redpitaya/client/sourceme.bma
| 1 | +export GRC_BLOCKS_PATH=. |
redpitaya/client/top_block.py
| 1 | +#!/usr/bin/env python2 | |
| 2 | +# -*- coding: utf-8 -*- | |
| 3 | +################################################## | |
| 4 | +# GNU Radio Python Flow Graph | |
| 5 | +# Title: Top Block | |
| 6 | +# Generated: Mon Feb 13 22:24:05 2017 | |
| 7 | +################################################## | |
| 8 | + | |
| 9 | +if __name__ == '__main__': | |
| 10 | + import ctypes | |
| 11 | + import sys | |
| 12 | + if sys.platform.startswith('linux'): | |
| 13 | + try: | |
| 14 | + x11 = ctypes.cdll.LoadLibrary('libX11.so') | |
| 15 | + x11.XInitThreads() | |
| 16 | + except: | |
| 17 | + print "Warning: failed to XInitThreads()" | |
| 18 | + | |
| 19 | +from PyQt4 import Qt | |
| 20 | +from gnuradio import eng_notation | |
| 21 | +from gnuradio import gr | |
| 22 | +from gnuradio.eng_option import eng_option | |
| 23 | +from gnuradio.filter import firdes | |
| 24 | +from gnuradio.qtgui import Range, RangeWidget | |
| 25 | +from optparse import OptionParser | |
| 26 | +import redpitaya_gnuradio | |
| 27 | +import sys | |
| 28 | + | |
| 29 | + | |
| 30 | +class top_block(gr.top_block, Qt.QWidget): | |
| 31 | + | |
| 32 | + def __init__(self): | |
| 33 | + gr.top_block.__init__(self, "Top Block") | |
| 34 | + Qt.QWidget.__init__(self) | |
| 35 | + self.setWindowTitle("Top Block") | |
| 36 | + try: | |
| 37 | + self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) | |
| 38 | + except: | |
| 39 | + pass | |
| 40 | + self.top_scroll_layout = Qt.QVBoxLayout() | |
| 41 | + self.setLayout(self.top_scroll_layout) | |
| 42 | + self.top_scroll = Qt.QScrollArea() | |
| 43 | + self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) | |
| 44 | + self.top_scroll_layout.addWidget(self.top_scroll) | |
| 45 | + self.top_scroll.setWidgetResizable(True) | |
| 46 | + self.top_widget = Qt.QWidget() | |
| 47 | + self.top_scroll.setWidget(self.top_widget) | |
| 48 | + self.top_layout = Qt.QVBoxLayout(self.top_widget) | |
| 49 | + self.top_grid_layout = Qt.QGridLayout() | |
| 50 | + self.top_layout.addLayout(self.top_grid_layout) | |
| 51 | + | |
| 52 | + self.settings = Qt.QSettings("GNU Radio", "top_block") | |
| 53 | + self.restoreGeometry(self.settings.value("geometry").toByteArray()) | |
| 54 | + | |
| 55 | + ################################################## | |
| 56 | + # Variables | |
| 57 | + ################################################## | |
| 58 | + self.samp_rate = samp_rate = 32000 | |
| 59 | + self.port = port = 1001 | |
| 60 | + self.offset_out1 = offset_out1 = 0 | |
| 61 | + self.f_dds = f_dds = 0 | |
| 62 | + self.addr = addr = "192.168.0.202" | |
| 63 | + self.a_dds = a_dds = 0 | |
| 64 | + | |
| 65 | + ################################################## | |
| 66 | + # Blocks | |
| 67 | + ################################################## | |
| 68 | + self._offset_out1_range = Range(-8192, 8191, 100, 0, 200) | |
| 69 | + self._offset_out1_win = RangeWidget(self._offset_out1_range, self.set_offset_out1, 'Offset DDS', "counter_slider", int) | |
| 70 | + self.top_grid_layout.addWidget(self._offset_out1_win, 2, 0) | |
| 71 | + self._f_dds_range = Range(0, 60000000, 100000, 0, 200) | |
| 72 | + self._f_dds_win = RangeWidget(self._f_dds_range, self.set_f_dds, 'DDS frequency', "counter_slider", int) | |
| 73 | + self.top_grid_layout.addWidget(self._f_dds_win, 0, 0) | |
| 74 | + self._a_dds_range = Range(0, 8191, 128, 0, 200) | |
| 75 | + self._a_dds_win = RangeWidget(self._a_dds_range, self.set_a_dds, 'DDS amplitude', "counter_slider", int) | |
| 76 | + self.top_grid_layout.addWidget(self._a_dds_win, 1, 0) | |
| 77 | + self.nco_counter_send_conf_0 = redpitaya_gnuradio.nco_counter_send_conf( | |
| 78 | + addr=addr, | |
| 79 | + port=port, | |
| 80 | + device='/dev/dds_freq', | |
| 81 | + freq_ref=125000000, | |
| 82 | + freq_dds=f_dds, | |
| 83 | + acc_size=32, | |
| 84 | + offset=0, | |
| 85 | + ) | |
| 86 | + | |
| 87 | + self.add_const_set_offset_0_0 = redpitaya_gnuradio.add_const_set_offset( | |
| 88 | + addr=addr, | |
| 89 | + port=port, | |
| 90 | + device='/dev/dds_ampl', | |
| 91 | + const=a_dds, | |
| 92 | + ) | |
| 93 | + | |
| 94 | + self.add_const_set_offset_0 = redpitaya_gnuradio.add_const_set_offset( | |
| 95 | + addr=addr, | |
| 96 | + port=port, | |
| 97 | + device='/dev/dds_offset', | |
| 98 | + const=offset_out1, | |
| 99 | + ) | |
| 100 | + | |
| 101 | + | |
| 102 | + def closeEvent(self, event): | |
| 103 | + self.settings = Qt.QSettings("GNU Radio", "top_block") | |
| 104 | + self.settings.setValue("geometry", self.saveGeometry()) | |
| 105 | + event.accept() | |
| 106 | + | |
| 107 | + def get_samp_rate(self): | |
| 108 | + return self.samp_rate | |
| 109 | + | |
| 110 | + def set_samp_rate(self, samp_rate): | |
| 111 | + self.samp_rate = samp_rate | |
| 112 | + | |
| 113 | + def get_port(self): | |
| 114 | + return self.port | |
| 115 | + | |
| 116 | + def set_port(self, port): | |
| 117 | + self.port = port | |
| 118 | + | |
| 119 | + def get_offset_out1(self): | |
| 120 | + return self.offset_out1 | |
| 121 | + | |
| 122 | + def set_offset_out1(self, offset_out1): | |
| 123 | + self.offset_out1 = offset_out1 | |
| 124 | + self.add_const_set_offset_0.set_const(device='/dev/dds_offset', const=self.offset_out1) | |
| 125 | + | |
| 126 | + def get_f_dds(self): | |
| 127 | + return self.f_dds | |
| 128 | + | |
| 129 | + def set_f_dds(self, f_dds): | |
| 130 | + self.f_dds = f_dds | |
| 131 | + self.nco_counter_send_conf_0.set_nco(device='/dev/dds_freq', freq_ref=125000000, freq_dds=self.f_dds, acc_size=32, offset=0) | |
| 132 | + | |
| 133 | + def get_addr(self): | |
| 134 | + return self.addr | |
| 135 | + | |
| 136 | + def set_addr(self, addr): | |
| 137 | + self.addr = addr | |
| 138 | + | |
| 139 | + def get_a_dds(self): | |
| 140 | + return self.a_dds | |
| 141 | + | |
| 142 | + def set_a_dds(self, a_dds): | |
| 143 | + self.a_dds = a_dds | |
| 144 | + self.add_const_set_offset_0_0.set_const(device='/dev/dds_ampl', const=self.a_dds) | |
| 145 | + | |
| 146 | + | |
| 147 | +def main(top_block_cls=top_block, options=None): | |
| 148 | + | |
| 149 | + from distutils.version import StrictVersion | |
| 150 | + if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): | |
| 151 | + style = gr.prefs().get_string('qtgui', 'style', 'raster') | |
| 152 | + Qt.QApplication.setGraphicsSystem(style) | |
| 153 | + qapp = Qt.QApplication(sys.argv) | |
| 154 | + | |
| 155 | + tb = top_block_cls() | |
| 156 | + tb.start() | |
| 157 | + tb.show() | |
| 158 | + | |
| 159 | + def quitting(): | |
| 160 | + tb.stop() | |
| 161 | + tb.wait() | |
| 162 | + qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) | |
| 163 | + qapp.exec_() | |
| 164 | + | |
| 165 | + | |
| 166 | +if __name__ == '__main__': | |
| 167 | + main() |
redpitaya/gnuradio_blocks/dds_control.grc
| ... | ... | @@ -145,6 +145,33 @@ |
| 145 | 145 | </param> |
| 146 | 146 | </block> |
| 147 | 147 | <block> |
| 148 | + <key>variable</key> | |
| 149 | + <param> | |
| 150 | + <key>comment</key> | |
| 151 | + <value></value> | |
| 152 | + </param> | |
| 153 | + <param> | |
| 154 | + <key>_enabled</key> | |
| 155 | + <value>True</value> | |
| 156 | + </param> | |
| 157 | + <param> | |
| 158 | + <key>_coordinate</key> | |
| 159 | + <value>(0, 248)</value> | |
| 160 | + </param> | |
| 161 | + <param> | |
| 162 | + <key>_rotation</key> | |
| 163 | + <value>0</value> | |
| 164 | + </param> | |
| 165 | + <param> | |
| 166 | + <key>id</key> | |
| 167 | + <value>addr</value> | |
| 168 | + </param> | |
| 169 | + <param> | |
| 170 | + <key>value</key> | |
| 171 | + <value>"192.168.0.202"</value> | |
| 172 | + </param> | |
| 173 | + </block> | |
| 174 | + <block> | |
| 148 | 175 | <key>variable_qtgui_range</key> |
| 149 | 176 | <param> |
| 150 | 177 | <key>comment</key> |
| ... | ... | @@ -282,6 +309,33 @@ |
| 282 | 309 | </param> |
| 283 | 310 | <param> |
| 284 | 311 | <key>_coordinate</key> |
| 312 | + <value>(0, 320)</value> | |
| 313 | + </param> | |
| 314 | + <param> | |
| 315 | + <key>_rotation</key> | |
| 316 | + <value>0</value> | |
| 317 | + </param> | |
| 318 | + <param> | |
| 319 | + <key>id</key> | |
| 320 | + <value>port</value> | |
| 321 | + </param> | |
| 322 | + <param> | |
| 323 | + <key>value</key> | |
| 324 | + <value>1001</value> | |
| 325 | + </param> | |
| 326 | + </block> | |
| 327 | + <block> | |
| 328 | + <key>variable</key> | |
| 329 | + <param> | |
| 330 | + <key>comment</key> | |
| 331 | + <value></value> | |
| 332 | + </param> | |
| 333 | + <param> | |
| 334 | + <key>_enabled</key> | |
| 335 | + <value>True</value> | |
| 336 | + </param> | |
| 337 | + <param> | |
| 338 | + <key>_coordinate</key> | |
| 285 | 339 | <value>(8, 160)</value> |
| 286 | 340 | </param> |
| 287 | 341 | <param> |
| ... | ... | @@ -301,7 +355,7 @@ |
| 301 | 355 | <key>add_const_set_offset</key> |
| 302 | 356 | <param> |
| 303 | 357 | <key>addr</key> |
| 304 | - <value>192.168.0.201</value> | |
| 358 | + <value>addr</value> | |
| 305 | 359 | </param> |
| 306 | 360 | <param> |
| 307 | 361 | <key>alias</key> |
| ... | ... | @@ -317,7 +371,7 @@ |
| 317 | 371 | </param> |
| 318 | 372 | <param> |
| 319 | 373 | <key>device</key> |
| 320 | - <value>/dev/dds1_offset</value> | |
| 374 | + <value>/dev/dds_offset</value> | |
| 321 | 375 | </param> |
| 322 | 376 | <param> |
| 323 | 377 | <key>_enabled</key> |
| 324 | 378 | |
| ... | ... | @@ -337,14 +391,14 @@ |
| 337 | 391 | </param> |
| 338 | 392 | <param> |
| 339 | 393 | <key>port</key> |
| 340 | - <value>1001</value> | |
| 394 | + <value>port</value> | |
| 341 | 395 | </param> |
| 342 | 396 | </block> |
| 343 | 397 | <block> |
| 344 | 398 | <key>add_const_set_offset</key> |
| 345 | 399 | <param> |
| 346 | 400 | <key>addr</key> |
| 347 | - <value>192.168.0.201</value> | |
| 401 | + <value>addr</value> | |
| 348 | 402 | </param> |
| 349 | 403 | <param> |
| 350 | 404 | <key>alias</key> |
| ... | ... | @@ -360,7 +414,7 @@ |
| 360 | 414 | </param> |
| 361 | 415 | <param> |
| 362 | 416 | <key>device</key> |
| 363 | - <value>/dev/dds1_ampl</value> | |
| 417 | + <value>/dev/dds_ampl</value> | |
| 364 | 418 | </param> |
| 365 | 419 | <param> |
| 366 | 420 | <key>_enabled</key> |
| ... | ... | @@ -380,7 +434,7 @@ |
| 380 | 434 | </param> |
| 381 | 435 | <param> |
| 382 | 436 | <key>port</key> |
| 383 | - <value>1001</value> | |
| 437 | + <value>port</value> | |
| 384 | 438 | </param> |
| 385 | 439 | </block> |
| 386 | 440 | <block> |
| ... | ... | @@ -391,7 +445,7 @@ |
| 391 | 445 | </param> |
| 392 | 446 | <param> |
| 393 | 447 | <key>addr</key> |
| 394 | - <value>192.168.0.201</value> | |
| 448 | + <value>addr</value> | |
| 395 | 449 | </param> |
| 396 | 450 | <param> |
| 397 | 451 | <key>alias</key> |
| ... | ... | @@ -403,7 +457,7 @@ |
| 403 | 457 | </param> |
| 404 | 458 | <param> |
| 405 | 459 | <key>device</key> |
| 406 | - <value>/dev/dds1_freq</value> | |
| 460 | + <value>/dev/dds_freq</value> | |
| 407 | 461 | </param> |
| 408 | 462 | <param> |
| 409 | 463 | <key>_enabled</key> |
| ... | ... | @@ -435,7 +489,7 @@ |
| 435 | 489 | </param> |
| 436 | 490 | <param> |
| 437 | 491 | <key>port</key> |
| 438 | - <value>1001</value> | |
| 492 | + <value>port</value> | |
| 439 | 493 | </param> |
| 440 | 494 | </block> |
| 441 | 495 | </flow_graph> |
redpitaya/gnuradio_blocks/gr_source_test.xml
| 1 | +<?xml version="1.0"?> | |
| 2 | +<!-- | |
| 3 | +# GNU Radio blocks for the Red Pitaya transceiver | |
| 4 | +# Copyright (C) 2015 Renzo Davoli | |
| 5 | +# | |
| 6 | +# This program is free software; you can redistribute it and/or | |
| 7 | +# modify it under the terms of the GNU General Public License | |
| 8 | +# as published by the Free Software Foundation; either version 2 | |
| 9 | +# of the License, or (at your option) any later version. | |
| 10 | +# | |
| 11 | +# This program is distributed in the hope that it will be useful, | |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | +# GNU General Public License for more details. | |
| 15 | +# | |
| 16 | +# You should have received a copy of the GNU General Public License | |
| 17 | +# along with this program; if not, write to the Free Software | |
| 18 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 19 | + --> | |
| 20 | +<block> | |
| 21 | + <name>source_test</name> | |
| 22 | + <key>source_test</key> | |
| 23 | + <category>Red Pitaya</category> | |
| 24 | + <import>import redpitaya_gnuradio</import> | |
| 25 | + <make>redpitaya_gnuradio.source_test()</make> | |
| 26 | + <source> | |
| 27 | + <name>out</name> | |
| 28 | + <type>complex</type> | |
| 29 | + </source> | |
| 30 | +</block> |
redpitaya/gnuradio_blocks/gr_source_test.xml.old
| 1 | +<?xml version="1.0"?> | |
| 2 | +<!-- | |
| 3 | +# GNU Radio blocks for the Red Pitaya transceiver | |
| 4 | +# Copyright (C) 2015 Renzo Davoli | |
| 5 | +# | |
| 6 | +# This program is free software; you can redistribute it and/or | |
| 7 | +# modify it under the terms of the GNU General Public License | |
| 8 | +# as published by the Free Software Foundation; either version 2 | |
| 9 | +# of the License, or (at your option) any later version. | |
| 10 | +# | |
| 11 | +# This program is distributed in the hope that it will be useful, | |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | +# GNU General Public License for more details. | |
| 15 | +# | |
| 16 | +# You should have received a copy of the GNU General Public License | |
| 17 | +# along with this program; if not, write to the Free Software | |
| 18 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 19 | + --> | |
| 20 | +<block> | |
| 21 | + <name>source_test</name> | |
| 22 | + <key>source_test</key> | |
| 23 | + <category>Red Pitaya</category> | |
| 24 | + <import>import redpitaya_gnuradio</import> | |
| 25 | + <make>redpitaya_gnuradio.source_test()</make> | |
| 26 | + <source> | |
| 27 | + <name>out</name> | |
| 28 | + <type>complex</type> | |
| 29 | + </source> | |
| 30 | +</block> |
redpitaya/gnuradio_blocks/redpitaya_gnuradio.py
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | # along with this program; if not, write to the Free Software |
| 18 | 18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 19 | 19 | |
| 20 | -import socket | |
| 20 | +import socket, os | |
| 21 | 21 | from gnuradio import gr, blocks |
| 22 | 22 | |
| 23 | 23 | class add_const_set_offset(gr.hier_block2): |
| ... | ... | @@ -52,4 +52,21 @@ |
| 52 | 52 | |
| 53 | 53 | def set_nco(self, device, freq_ref, freq_dds, acc_size, offset): |
| 54 | 54 | self.ctrl_sock.send('%s;%s;%i;%i;%i;%i\n'%(self.name, device, freq_ref, freq_dds, acc_size, offset)) |
| 55 | + | |
| 56 | +'''~ | |
| 57 | +class source_test(gr.hier_block2): | |
| 58 | + def __init__(self): | |
| 59 | + self.name = "source_test" | |
| 60 | + gr.hier_block2.__init__( | |
| 61 | + self, | |
| 62 | + name = self.name, | |
| 63 | + input_signature = gr.io_signature(0, 0, 0), | |
| 64 | + output_signature = gr.io_signature(1, 1, gr.sizeof_gr_complex) | |
| 65 | + ) | |
| 66 | + self.data_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| 67 | + self.data_sock.connect((addr, port)) | |
| 68 | + self.data_sock.send('%s'%self.name) | |
| 69 | + fd = os.dup(self.data_sock.fileno()) | |
| 70 | + self.connect(blocks.file_descriptor_source(gr.sizeof_gr_complex, fd), self) | |
| 71 | +''' |
redpitaya/gnuradio_blocks/redpitaya_gnuradio.pyc
No preview for this file type
redpitaya/gnuradio_blocks/top_block.py
| 1 | +#!/usr/bin/env python2 | |
| 2 | +# -*- coding: utf-8 -*- | |
| 3 | +################################################## | |
| 4 | +# GNU Radio Python Flow Graph | |
| 5 | +# Title: Top Block | |
| 6 | +# Generated: Mon Feb 13 22:24:05 2017 | |
| 7 | +################################################## | |
| 8 | + | |
| 9 | +if __name__ == '__main__': | |
| 10 | + import ctypes | |
| 11 | + import sys | |
| 12 | + if sys.platform.startswith('linux'): | |
| 13 | + try: | |
| 14 | + x11 = ctypes.cdll.LoadLibrary('libX11.so') | |
| 15 | + x11.XInitThreads() | |
| 16 | + except: | |
| 17 | + print "Warning: failed to XInitThreads()" | |
| 18 | + | |
| 19 | +from PyQt4 import Qt | |
| 20 | +from gnuradio import eng_notation | |
| 21 | +from gnuradio import gr | |
| 22 | +from gnuradio.eng_option import eng_option | |
| 23 | +from gnuradio.filter import firdes | |
| 24 | +from gnuradio.qtgui import Range, RangeWidget | |
| 25 | +from optparse import OptionParser | |
| 26 | +import redpitaya_gnuradio | |
| 27 | +import sys | |
| 28 | + | |
| 29 | + | |
| 30 | +class top_block(gr.top_block, Qt.QWidget): | |
| 31 | + | |
| 32 | + def __init__(self): | |
| 33 | + gr.top_block.__init__(self, "Top Block") | |
| 34 | + Qt.QWidget.__init__(self) | |
| 35 | + self.setWindowTitle("Top Block") | |
| 36 | + try: | |
| 37 | + self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) | |
| 38 | + except: | |
| 39 | + pass | |
| 40 | + self.top_scroll_layout = Qt.QVBoxLayout() | |
| 41 | + self.setLayout(self.top_scroll_layout) | |
| 42 | + self.top_scroll = Qt.QScrollArea() | |
| 43 | + self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) | |
| 44 | + self.top_scroll_layout.addWidget(self.top_scroll) | |
| 45 | + self.top_scroll.setWidgetResizable(True) | |
| 46 | + self.top_widget = Qt.QWidget() | |
| 47 | + self.top_scroll.setWidget(self.top_widget) | |
| 48 | + self.top_layout = Qt.QVBoxLayout(self.top_widget) | |
| 49 | + self.top_grid_layout = Qt.QGridLayout() | |
| 50 | + self.top_layout.addLayout(self.top_grid_layout) | |
| 51 | + | |
| 52 | + self.settings = Qt.QSettings("GNU Radio", "top_block") | |
| 53 | + self.restoreGeometry(self.settings.value("geometry").toByteArray()) | |
| 54 | + | |
| 55 | + ################################################## | |
| 56 | + # Variables | |
| 57 | + ################################################## | |
| 58 | + self.samp_rate = samp_rate = 32000 | |
| 59 | + self.port = port = 1001 | |
| 60 | + self.offset_out1 = offset_out1 = 0 | |
| 61 | + self.f_dds = f_dds = 0 | |
| 62 | + self.addr = addr = "192.168.0.202" | |
| 63 | + self.a_dds = a_dds = 0 | |
| 64 | + | |
| 65 | + ################################################## | |
| 66 | + # Blocks | |
| 67 | + ################################################## | |
| 68 | + self._offset_out1_range = Range(-8192, 8191, 100, 0, 200) | |
| 69 | + self._offset_out1_win = RangeWidget(self._offset_out1_range, self.set_offset_out1, 'Offset DDS', "counter_slider", int) | |
| 70 | + self.top_grid_layout.addWidget(self._offset_out1_win, 2, 0) | |
| 71 | + self._f_dds_range = Range(0, 60000000, 100000, 0, 200) | |
| 72 | + self._f_dds_win = RangeWidget(self._f_dds_range, self.set_f_dds, 'DDS frequency', "counter_slider", int) | |
| 73 | + self.top_grid_layout.addWidget(self._f_dds_win, 0, 0) | |
| 74 | + self._a_dds_range = Range(0, 8191, 128, 0, 200) | |
| 75 | + self._a_dds_win = RangeWidget(self._a_dds_range, self.set_a_dds, 'DDS amplitude', "counter_slider", int) | |
| 76 | + self.top_grid_layout.addWidget(self._a_dds_win, 1, 0) | |
| 77 | + self.nco_counter_send_conf_0 = redpitaya_gnuradio.nco_counter_send_conf( | |
| 78 | + addr=addr, | |
| 79 | + port=port, | |
| 80 | + device='/dev/dds_freq', | |
| 81 | + freq_ref=125000000, | |
| 82 | + freq_dds=f_dds, | |
| 83 | + acc_size=32, | |
| 84 | + offset=0, | |
| 85 | + ) | |
| 86 | + | |
| 87 | + self.add_const_set_offset_0_0 = redpitaya_gnuradio.add_const_set_offset( | |
| 88 | + addr=addr, | |
| 89 | + port=port, | |
| 90 | + device='/dev/dds_ampl', | |
| 91 | + const=a_dds, | |
| 92 | + ) | |
| 93 | + | |
| 94 | + self.add_const_set_offset_0 = redpitaya_gnuradio.add_const_set_offset( | |
| 95 | + addr=addr, | |
| 96 | + port=port, | |
| 97 | + device='/dev/dds_offset', | |
| 98 | + const=offset_out1, | |
| 99 | + ) | |
| 100 | + | |
| 101 | + | |
| 102 | + def closeEvent(self, event): | |
| 103 | + self.settings = Qt.QSettings("GNU Radio", "top_block") | |
| 104 | + self.settings.setValue("geometry", self.saveGeometry()) | |
| 105 | + event.accept() | |
| 106 | + | |
| 107 | + def get_samp_rate(self): | |
| 108 | + return self.samp_rate | |
| 109 | + | |
| 110 | + def set_samp_rate(self, samp_rate): | |
| 111 | + self.samp_rate = samp_rate | |
| 112 | + | |
| 113 | + def get_port(self): | |
| 114 | + return self.port | |
| 115 | + | |
| 116 | + def set_port(self, port): | |
| 117 | + self.port = port | |
| 118 | + | |
| 119 | + def get_offset_out1(self): | |
| 120 | + return self.offset_out1 | |
| 121 | + | |
| 122 | + def set_offset_out1(self, offset_out1): | |
| 123 | + self.offset_out1 = offset_out1 | |
| 124 | + self.add_const_set_offset_0.set_const(device='/dev/dds_offset', const=self.offset_out1) | |
| 125 | + | |
| 126 | + def get_f_dds(self): | |
| 127 | + return self.f_dds | |
| 128 | + | |
| 129 | + def set_f_dds(self, f_dds): | |
| 130 | + self.f_dds = f_dds | |
| 131 | + self.nco_counter_send_conf_0.set_nco(device='/dev/dds_freq', freq_ref=125000000, freq_dds=self.f_dds, acc_size=32, offset=0) | |
| 132 | + | |
| 133 | + def get_addr(self): | |
| 134 | + return self.addr | |
| 135 | + | |
| 136 | + def set_addr(self, addr): | |
| 137 | + self.addr = addr | |
| 138 | + | |
| 139 | + def get_a_dds(self): | |
| 140 | + return self.a_dds | |
| 141 | + | |
| 142 | + def set_a_dds(self, a_dds): | |
| 143 | + self.a_dds = a_dds | |
| 144 | + self.add_const_set_offset_0_0.set_const(device='/dev/dds_ampl', const=self.a_dds) | |
| 145 | + | |
| 146 | + | |
| 147 | +def main(top_block_cls=top_block, options=None): | |
| 148 | + | |
| 149 | + from distutils.version import StrictVersion | |
| 150 | + if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): | |
| 151 | + style = gr.prefs().get_string('qtgui', 'style', 'raster') | |
| 152 | + Qt.QApplication.setGraphicsSystem(style) | |
| 153 | + qapp = Qt.QApplication(sys.argv) | |
| 154 | + | |
| 155 | + tb = top_block_cls() | |
| 156 | + tb.start() | |
| 157 | + tb.show() | |
| 158 | + | |
| 159 | + def quitting(): | |
| 160 | + tb.stop() | |
| 161 | + tb.wait() | |
| 162 | + qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) | |
| 163 | + qapp.exec_() | |
| 164 | + | |
| 165 | + | |
| 166 | +if __name__ == '__main__': | |
| 167 | + main() |
redpitaya/server/server.py
| 1 | 1 | #!/usr/bin/env python |
| 2 | + | |
| 2 | 3 | import socket |
| 3 | 4 | from thread import start_new_thread |
| 4 | 5 | import liboscimp_fpga |
| 5 | 6 | |
| 6 | -ctrl_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| 7 | -ctrl_sock.bind(('', 1001)) | |
| 8 | -ctrl_sock.listen(10) | |
| 9 | - | |
| 10 | 7 | def clientThread(conn, addr): |
| 11 | 8 | print('Open connection from ' + addr[0] + ':' + str(addr[1]) + '\n') |
| 12 | 9 | while True: |
| 13 | 10 | |
| 14 | 11 | |
| ... | ... | @@ -24,11 +21,16 @@ |
| 24 | 21 | liboscimp_fpga.nco_counter_send_conf(recv[1], int(recv[2]), int(recv[3]), int(recv[4]), int(recv[5])) |
| 25 | 22 | except: |
| 26 | 23 | pass |
| 27 | - conn.close() | |
| 24 | + conn.close() | |
| 28 | 25 | |
| 29 | -while 1: | |
| 30 | - conn, addr = ctrl_sock.accept() | |
| 31 | - start_new_thread(clientThread ,(conn, addr,)) | |
| 26 | +ctrl_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| 27 | +ctrl_sock.bind(('', 1001)) | |
| 28 | +ctrl_sock.listen(10) | |
| 32 | 29 | |
| 33 | -ctrl_sock.close() | |
| 30 | +try: | |
| 31 | + while True: | |
| 32 | + conn, addr = ctrl_sock.accept() | |
| 33 | + start_new_thread(clientThread ,(conn, addr,)) | |
| 34 | +except KeyboardInterrupt: | |
| 35 | + ctrl_sock.close() |
redpitaya/server/test.py
redpitaya/server/test_emb.py
| 1 | +#!/usr/bin/env python | |
| 2 | +import ctypes, argparse | |
| 3 | +import liboscimp_fpga | |
| 4 | + | |
| 5 | +def parse(): | |
| 6 | + parser = argparse.ArgumentParser(description = 'Set offsets to DAC1 and DAC2') | |
| 7 | + parser.add_argument('-of1', | |
| 8 | + action='store', | |
| 9 | + dest='of1', | |
| 10 | + default=0, | |
| 11 | + help='DAC1 offset (bits)') | |
| 12 | + parser.add_argument('-of2', | |
| 13 | + action='store', | |
| 14 | + dest='of2', | |
| 15 | + default=0, | |
| 16 | + help='DAC2 offset (bits)') | |
| 17 | + args = parser.parse_args() | |
| 18 | + return args | |
| 19 | + | |
| 20 | +def main(): | |
| 21 | + args = parse() | |
| 22 | + of1 = int(args.of1) | |
| 23 | + of2 = int(args.of2) | |
| 24 | + liboscimp_fpga.add_const_set_offset("/dev/add_const_0", of1) | |
| 25 | + liboscimp_fpga.add_const_set_offset("/dev/add_const_1", of2) | |
| 26 | + print('offset DAC1 : %i'%of1) | |
| 27 | + print('offset DAC2 : %i'%of2) | |
| 28 | + | |
| 29 | +if __name__ == "__main__": | |
| 30 | + main() |