Skip to content

Latest commit

 

History

History
59 lines (53 loc) · 3.68 KB

AboutTheCurrentVersion.md

File metadata and controls

59 lines (53 loc) · 3.68 KB

About the current version of the project

The version of the python implementation available in this repository is a little more advanced than what's described in the tutorial. It contains some additionnal features such as :

  • The possibility to change the transmission mode from BPSK to QPSK while the ZedBoard is already working through the use of a switch button (SW0 on the Zedboard)
  • PrnGenerator module can recreate a LFSR of any size following the bit length we are giving to it
  • Currently, the way we configured the board doesn't allow it but if configured properly, we could flash the bitstream so that the taps of the LFSR are chosen through the use of GPIO or something else while the program is running. Most of the modules are ready to handle the situation.
  • The prn.py file also contains a few utility functions that help working with different taps (finding a list of taps, [writing them into/reading them from] a file, saving in binary files the prn generated by a certain LFSR...)
  • The file that flashes the ZedBoard permits to set all the parameters we wish to change with our B/QPSK transmitter.
./amaranth_twstft/flashZedBoard.py -h

usage: flashZedBoard.py [-h] [--bitlen BITLEN] [--noiselen NOISELEN] [--no-reload] [-s SEED]
                        [-t TAPS] [-m MODFREQ] [--invert-first-code] [-p] [-v] [--no-build]
                        [--no-load] [--build-dir BUILD_DIR]

options:
  -h, --help            show this help message and exit
  --bitlen BITLEN       number of bits of the LFSR
  --noiselen NOISELEN   length of the PRN sequence
  --no-reload           stop generation after noiselen bits
  -s SEED, --seed SEED  initial value of the LFSR (default 1)
  -t TAPS, --taps TAPS  taps positions for the LFSR (if not defined, allows to
                        dynamically define taps (currently not supported so
                        default taps will be the smallest msequence generator
                        taps))
  -m MODFREQ, --modfreq MODFREQ
                        frequency of the PSK modulation (Herz) (default
                        :2.5e6)
  --invert-first-code   invert (xor) the first code after PPS rise
  -p, --print           creates a binary file containing the PRN sequence that
                        should be generated
  -v, --verbose         prints all the parameters used for this instance of
                        the program
  --no-build            sources generate only
  --no-load             don't load bitstream
  --build-dir BUILD_DIR
                        build directory

While the -p option is hidden between all the other non-mandatory arguments, it should really be used if the correlation between a local copy of the pseudo-random sequence (as generated with this -p option) and the received signal is to be computed. The output format of the file generated with the -p option is interleaved 8-bit IQ coefficients each equal to 1 or 0. With GNU Octave (or Matlab), the PRN sequence output with -p is read using

f=fopen('prn.bin');
code=fread(f,inf,'int8');
fclose(f);
codei=code(1:2:end);codei=codei-mean(codei);
codeq=code(2:2:end);codeq=codeq-mean(codeq);

Of course the correlation is only relevant after the local oscillator frequency offset between the Zedboard generating the signal and the SDR (in our case the B210) recording the signal has been compensated for. GNU Radio will take care of this correction with the Costas Loop block with Order 2 for BPSK and 4 for QPSK, while GNU/Octave requires identifying the frequency offset (argmax(FFT)), compensating by multiplying with a numerically controlled oscillator, and only then correlating.

The bitstreams produced are stored in the build/top.bit file and can be archived for future use.