Updated README and added bpsk31_ber.py

This commit is contained in:
ha7ilm 2017-06-14 11:57:32 +02:00
parent ee5b546439
commit 09bcde5b4e
2 changed files with 68 additions and 9 deletions

View file

@ -1,14 +1,20 @@
libcsdr CSDR
======= ====
`csdr` is a command line tool to carry out DSP tasks for Software Defined Radio.
It can be used to build simple signal processing flow graphs, right from the command line.
The included `libcsdr` library contains the DSP functions that `csdr` makes use of. It was designed to use auto-vectorization available in `gcc`, and also has some functions optimized with inline assembly for ARM NEON to achieve some speedup by taking advantage of SIMD command sets available in today's CPUs.
*libcsdr* is a set of simple DSP routines for Software Defined Radio.
It is mostly useful for AM/FM/SSB demodulation and spectrum display.
Feel free to use it in your projects. Feel free to use it in your projects.
Most of the code is available under the permissive BSD license, with some optional parts under GPL. For additional details, see <a href="#licensing">licensing</a>. Most of the code is available under the permissive BSD license, with some optional parts under GPL. For additional details, see <a href="#licensing">licensing</a>.
- The package comes with a command-line tool `csdr`, which lets you build DSP processing chains by shell pipes. `csdr` has already been used to build:
- The code of *libcsdr* was intended to be easy to follow.
- *libcsdr* was designed to use auto-vectorization available in *gcc*. It means that it can achieve some speedup by taking advantage of SIMD command sets available in today's CPUs (e.g. SSE on x86 and NEON on ARM). - AM/FM/SSB/CW demodulators, BPSK31 decoder and waterfall display in [OpenWebRX](https://github.com/simonyiszk/openwebrx),
- AM/FM/SSB modulators in [qtcsdr](https://github.com/ha7ilm/qtcsdr) that can also be used standalone with [rpitx](https://github.com/ha7ilm/rpitx-app-note),
- a decoder for FSK transmissions sent with the CC1111 wireless MCU, and also a standalone RTTY demodulator.
How to compile How to compile
-------------- --------------
@ -22,11 +28,11 @@ If you compile on ARM, please edit the Makefile and tailor `PARAMS_NEON` for you
To run the examples, you will also need <a href="http://sdr.osmocom.org/trac/wiki/rtl-sdr">rtl_sdr</a> from Osmocom, and the following packages (at least on Debian): `mplayer octave gnuplot gnuplot-x11` To run the examples, you will also need <a href="http://sdr.osmocom.org/trac/wiki/rtl-sdr">rtl_sdr</a> from Osmocom, and the following packages (at least on Debian): `mplayer octave gnuplot gnuplot-x11`
If you compile *fftw3* from sources for use with *libcsdr*, you need to configure it with 32-bit float support enabled: If you compile `fftw3` from sources for use with `libcsdr`, you need to configure it with 32-bit float support enabled:
./configure --enable-float ./configure --enable-float
(This is for *fftw3*, not *libcsdr*. You do not need to run the configure script before compiling *libcsdr*.) (This is for `fftw3`, not `libcsdr`. You do not need to run the configure script before compiling `libcsdr`.)
Credits Credits
------- -------

53
grc_tests/bpsk31_ber.py Executable file
View file

@ -0,0 +1,53 @@
#!/usr/bin/python
import os, time, signal
from subprocess import *
#https://bugs.python.org/issue1652
def p(x):
global printcmds
if printcmds: print x
return check_output(x, shell=True)
printcmds=True
def genfiles(snr):
cmd="""(while true; do echo -n 'CQ CQ CQ DE HA7ILM HA7ILM HA7ILM PSE K '; done) | \
csdr psk31_varicode_encoder_u8_u8 | \
tee /s/bpsk31_testin | \
csdr differential_encoder_u8_u8 | \
csdr psk_modulator_u8_c 2 | \
csdr psk31_interpolate_sine_cc 256 | \
csdr awgn_cc %d | \
csdr timing_recovery_cc GARDNER 256 0.5 2 --add_q | \
csdr dbpsk_decoder_c_u8 | \
dd bs=1024 count=10 of=/s/bpsk31_testout
"""%snr
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
if printcmds: print cmd
os.system(cmd)
def getminsize():
return min(os.path.getsize("/s/bpsk31_testout"), os.path.getsize("/s/bpsk31_testin"))
def mkdiff(shift):
if shift==0:
return int(p("cmp -l /s/bpsk31_testin /s/bpsk31_testout | wc -l"))
elif shift<0:
return int(p("(dd if=/dev/zero bs=%d count=1; cat /s/bpsk31_testin)>/s/bpsk31_testin0; cmp -l /s/bpsk31_testin0 /s/bpsk31_testout | wc -l"%-shift))
elif shift>0:
return int(p("(dd if=/dev/zero bs=%d count=1; cat /s/bpsk31_testout)>/s/bpsk31_testout0; cmp -l /s/bpsk31_testin /s/bpsk31_testout0 | wc -l"%shift))
lf=open("/s/output_results","w")
for snr in range(0,20,2):
genfiles(snr)
num_totalbits=getminsize()
num_errors=None
for shift in range(-5,5):
curr_num_errors = mkdiff(shift)
if not num_errors or (num_errors and num_errors > curr_num_errors):
num_errors = curr_num_errors
lf.write("%d; %d; %d; %d\n" %(snr, num_errors, num_totalbits, num_errors/float(num_totalbits)))