Merge pull request #1 from osqzss/master

update
This commit is contained in:
Evanqiao 2016-07-10 18:45:51 +08:00 committed by GitHub
commit b96ca814f2
16 changed files with 6188 additions and 1840 deletions

View File

@ -5,8 +5,8 @@ all: gps-sdr-sim
SHELL=/bin/bash SHELL=/bin/bash
CC=gcc CC=gcc
CFLAGS=-fopenmp -O3 -Wall CFLAGS=-O3 -Wall
LDFLAGS=-lm -fopenmp LDFLAGS=-lm
gps-sdr-sim: gpssim.o gps-sdr-sim: gpssim.o
${CC} $< ${LDFLAGS} -o $@ ${CC} $< ${LDFLAGS} -o $@
@ -15,5 +15,6 @@ clean:
rm -f gpssim.o gps-sdr-sim *.bin rm -f gpssim.o gps-sdr-sim *.bin
time: gps-sdr-sim time: gps-sdr-sim
time ./gps-sdr-sim -e brdc3540.14n -u circle.csv -b 1
time ./gps-sdr-sim -e brdc3540.14n -u circle.csv -b 8 time ./gps-sdr-sim -e brdc3540.14n -u circle.csv -b 8
time ./gps-sdr-sim -e brdc3540.14n -u circle.csv -b 16 time ./gps-sdr-sim -e brdc3540.14n -u circle.csv -b 16

View File

@ -10,15 +10,12 @@ to RF using software-defined radio (SDR) platforms, such as
2. Create an empty project for a console application. 2. Create an empty project for a console application.
3. On the Solution Explorer at right, add "gpssim.c" and "getopt.c" to the Souce Files folder. 3. On the Solution Explorer at right, add "gpssim.c" and "getopt.c" to the Souce Files folder.
4. Select "Release" in Solution Configurations drop-down list. 4. Select "Release" in Solution Configurations drop-down list.
5. Open the Property Pages dialog box and expand the Configuration Properties. 5. Build the solution.
6. Expand the C/C++ node and select the Language property page.
7. Enable the OpenMP Support (/openmp).
8. Build the solution.
### Building with GCC ### Building with GCC
``` ```
$ gcc gpssim.c -lm -fopenmp -o gps-sdr-sim $ gcc gpssim.c -lm -O3 -o gps-sdr-sim
``` ```
### Generating the GPS signal file ### Generating the GPS signal file
@ -40,11 +37,23 @@ then used to generate the digitized I/Q samples for the GPS signal.
The bladeRF command line interface requires I/Q pairs stored as signed The bladeRF command line interface requires I/Q pairs stored as signed
16-bit integers, while the hackrf_transfer and gps-sdr-sim-uhd.py 16-bit integers, while the hackrf_transfer and gps-sdr-sim-uhd.py
supports signed bytes. support signed bytes.
HackRF and bladeRF require 2.6 MHz sample rate, while the USRP2 requires HackRF and bladeRF require 2.6 MHz sample rate, while the USRP2 requires
2.5 MHz (an even integral decimator of 100 MHz). 2.5 MHz (an even integral decimator of 100 MHz).
The simulation start time can be specified if the corresponding set of ephemerides
is available. Otherwise the first time of ephemeris in the RINEX navigation file
is selected.
The maximum simulation duration time is defined by USER_MOTION_SIZE to
prevent the output file from getting too large.
The output file size can be reduced by using "-b 1" option to store
four 1-bit I/Q samples into a single byte.
You can use [bladeplayer](https://github.com/osqzss/gps-sdr-sim/tree/master/player)
for bladeRF to playback the compressed file.
``` ```
Usage: gps-sdr-sim [options] Usage: gps-sdr-sim [options]
Options: Options:
@ -52,23 +61,26 @@ Options:
-u <user_motion> User motion file (dynamic mode) -u <user_motion> User motion file (dynamic mode)
-g <nmea_gga> NMEA GGA stream (dynamic mode) -g <nmea_gga> NMEA GGA stream (dynamic mode)
-l <location> Lat,Lon,Hgt (static mode) e.g. 30.286502,120.032669,100 -l <location> Lat,Lon,Hgt (static mode) e.g. 30.286502,120.032669,100
-t <date,time> Scenario start time YYYY/MM/DD,hh:mm:ss
-d <duration> Duration [sec] (max: 300)
-o <output> I/Q sampling data file (default: gpssim.bin) -o <output> I/Q sampling data file (default: gpssim.bin)
-s <frequency> Sampling frequency [Hz] (default: 2600000) -s <frequency> Sampling frequency [Hz] (default: 2600000)
-b <iq_bits> I/Q data format [8/16] (default: 8) -b <iq_bits> I/Q data format [1/8/16] (default: 16)
-v Show details about simulated channels
``` ```
The user motion can be specified in either dynamic or static mode: The user motion can be specified in either dynamic or static mode:
``` ```
> gps-sdr-sim -e brdc3540.14n -u circle.csv -b 16 > gps-sdr-sim -e brdc3540.14n -u circle.csv
``` ```
``` ```
> gps-sdr-sim -e brdc3540.14n -g triumphv3.txt -b 16 > gps-sdr-sim -e brdc3540.14n -g triumphv3.txt
``` ```
``` ```
> gps-sdr-sim -e brdc3540.14n -l 30.286502,120.032669,100 -b 16 > gps-sdr-sim -e brdc3540.14n -l 30.286502,120.032669,100
``` ```
### Transmitting the samples ### Transmitting the samples

21
extclk/Readme.md Normal file
View File

@ -0,0 +1,21 @@
# HackRF External TCXO
### Gerber Files
| File | Layer |
|:-----------|:------------------------|
| extclk.GTL | Top layer |
| extclk.GBL | Bottom layer |
| extclk.GTS | Top solder stop mask |
| extclk.GBS | Bottom solder stop mask |
| extclk.GTO | Top silk mask |
| extclk.TXT | NC Drill |
| extclk.GML | Mechanical layer |
### BOM (bill of material)
| Part | Value |
|:-----|:------|
|X1 |[FOX924B-10.000](http://www.digikey.com/product-detail/en/FOX924B-10.000/631-1067-1-ND/1024772), TCXO 10MHz HCMOS 2.5ppm|
|C1 |CAP 1uF 0805|
|C2 |OPEN|

720
extclk/extclk.GBL Normal file
View File

@ -0,0 +1,720 @@
G75*
G70*
%OFA0B0*%
%FSLAX24Y24*%
%IPPOS*%
%LPD*%
%AMOC8*
5,1,8,0,0,1.08239X$1,22.5*
%
%ADD10C,0.0000*%
%ADD11C,0.0594*%
%ADD12C,0.0277*%
%ADD13C,0.0079*%
D10*
X000534Y001854D02*
X000534Y008941D01*
X005652Y008941D01*
X005652Y001854D01*
X000534Y001854D01*
D11*
X003971Y002504D03*
X003971Y003504D03*
X003971Y004504D03*
X003971Y005504D03*
X003971Y006504D03*
X003971Y007504D03*
X004971Y007504D03*
X004971Y006504D03*
X004971Y005504D03*
X004971Y004504D03*
X004971Y003504D03*
X004971Y002504D03*
D12*
X003133Y003390D03*
X003172Y005358D03*
X003133Y007366D03*
X001322Y008351D03*
X005022Y008351D03*
X001322Y002445D03*
D13*
X000724Y002473D02*
X003556Y002473D01*
X003556Y002422D02*
X003619Y002269D01*
X003736Y002152D01*
X003889Y002089D01*
X004054Y002089D01*
X004206Y002152D01*
X004323Y002269D01*
X004386Y002422D01*
X004386Y002587D01*
X004323Y002739D01*
X004206Y002856D01*
X004054Y002919D01*
X003889Y002919D01*
X003736Y002856D01*
X003619Y002739D01*
X003556Y002587D01*
X003556Y002422D01*
X003567Y002395D02*
X000724Y002395D01*
X000724Y002318D02*
X003599Y002318D01*
X003647Y002241D02*
X000724Y002241D01*
X000724Y002164D02*
X003725Y002164D01*
X003556Y002550D02*
X000724Y002550D01*
X000724Y002627D02*
X003573Y002627D01*
X003605Y002705D02*
X000724Y002705D01*
X000724Y002782D02*
X003662Y002782D01*
X003744Y002859D02*
X000724Y002859D01*
X000724Y002936D02*
X005463Y002936D01*
X005463Y002859D02*
X005198Y002859D01*
X005206Y002856D02*
X005054Y002919D01*
X004889Y002919D01*
X004736Y002856D01*
X004619Y002739D01*
X004556Y002587D01*
X004556Y002422D01*
X004619Y002269D01*
X004736Y002152D01*
X004889Y002089D01*
X005054Y002089D01*
X005206Y002152D01*
X005323Y002269D01*
X005386Y002422D01*
X005386Y002587D01*
X005323Y002739D01*
X005206Y002856D01*
X005280Y002782D02*
X005463Y002782D01*
X005463Y002705D02*
X005337Y002705D01*
X005369Y002627D02*
X005463Y002627D01*
X005463Y002550D02*
X005386Y002550D01*
X005386Y002473D02*
X005463Y002473D01*
X005463Y002395D02*
X005375Y002395D01*
X005343Y002318D02*
X005463Y002318D01*
X005463Y002241D02*
X005295Y002241D01*
X005218Y002164D02*
X005463Y002164D01*
X005463Y002086D02*
X000724Y002086D01*
X000724Y002044D02*
X000724Y008752D01*
X005463Y008752D01*
X005463Y002044D01*
X000724Y002044D01*
X000724Y003014D02*
X005463Y003014D01*
X005463Y003091D02*
X005114Y003091D01*
X005058Y003068D02*
X005218Y003134D01*
X005341Y003257D01*
X005407Y003417D01*
X005407Y003465D01*
X005011Y003465D01*
X005011Y003543D01*
X005407Y003543D01*
X005407Y003591D01*
X005341Y003751D01*
X005218Y003874D01*
X005058Y003940D01*
X005010Y003940D01*
X005010Y003544D01*
X004932Y003544D01*
X004932Y003940D01*
X004884Y003940D01*
X004724Y003874D01*
X004601Y003751D01*
X004535Y003591D01*
X004535Y003543D01*
X004932Y003543D01*
X004932Y003465D01*
X004535Y003465D01*
X004535Y003417D01*
X004601Y003257D01*
X004724Y003134D01*
X004884Y003068D01*
X004932Y003068D01*
X004932Y003465D01*
X005010Y003465D01*
X005010Y003068D01*
X005058Y003068D01*
X005010Y003091D02*
X004932Y003091D01*
X004932Y003168D02*
X005010Y003168D01*
X005010Y003246D02*
X004932Y003246D01*
X004932Y003323D02*
X005010Y003323D01*
X005010Y003400D02*
X004932Y003400D01*
X004932Y003477D02*
X004386Y003477D01*
X004386Y003422D02*
X004386Y003587D01*
X004323Y003739D01*
X004206Y003856D01*
X004054Y003919D01*
X003889Y003919D01*
X003736Y003856D01*
X003619Y003739D01*
X003556Y003587D01*
X003556Y003422D01*
X003619Y003269D01*
X003736Y003152D01*
X003889Y003089D01*
X004054Y003089D01*
X004206Y003152D01*
X004323Y003269D01*
X004386Y003422D01*
X004377Y003400D02*
X004542Y003400D01*
X004574Y003323D02*
X004345Y003323D01*
X004300Y003246D02*
X004613Y003246D01*
X004690Y003168D02*
X004222Y003168D01*
X004058Y003091D02*
X004828Y003091D01*
X004744Y002859D02*
X004198Y002859D01*
X004280Y002782D02*
X004662Y002782D01*
X004605Y002705D02*
X004337Y002705D01*
X004369Y002627D02*
X004573Y002627D01*
X004556Y002550D02*
X004386Y002550D01*
X004386Y002473D02*
X004556Y002473D01*
X004567Y002395D02*
X004375Y002395D01*
X004343Y002318D02*
X004599Y002318D01*
X004647Y002241D02*
X004295Y002241D01*
X004218Y002164D02*
X004725Y002164D01*
X005252Y003168D02*
X005463Y003168D01*
X005463Y003246D02*
X005330Y003246D01*
X005368Y003323D02*
X005463Y003323D01*
X005463Y003400D02*
X005400Y003400D01*
X005463Y003477D02*
X005011Y003477D01*
X005010Y003555D02*
X004932Y003555D01*
X004932Y003632D02*
X005010Y003632D01*
X005010Y003709D02*
X004932Y003709D01*
X004932Y003787D02*
X005010Y003787D01*
X005010Y003864D02*
X004932Y003864D01*
X004714Y003864D02*
X004187Y003864D01*
X004276Y003787D02*
X004637Y003787D01*
X004584Y003709D02*
X004335Y003709D01*
X004367Y003632D02*
X004552Y003632D01*
X004535Y003555D02*
X004386Y003555D01*
X004206Y004152D02*
X004054Y004089D01*
X003889Y004089D01*
X003736Y004152D01*
X003619Y004269D01*
X003556Y004422D01*
X003556Y004587D01*
X003619Y004739D01*
X003736Y004856D01*
X003889Y004919D01*
X004054Y004919D01*
X004206Y004856D01*
X004323Y004739D01*
X004386Y004587D01*
X004386Y004422D01*
X004323Y004269D01*
X004206Y004152D01*
X004227Y004173D02*
X004715Y004173D01*
X004736Y004152D02*
X004889Y004089D01*
X005054Y004089D01*
X005206Y004152D01*
X005323Y004269D01*
X005386Y004422D01*
X005386Y004587D01*
X005323Y004739D01*
X005206Y004856D01*
X005054Y004919D01*
X004889Y004919D01*
X004736Y004856D01*
X004619Y004739D01*
X004556Y004587D01*
X004556Y004422D01*
X004619Y004269D01*
X004736Y004152D01*
X004638Y004250D02*
X004304Y004250D01*
X004347Y004328D02*
X004595Y004328D01*
X004563Y004405D02*
X004379Y004405D01*
X004386Y004482D02*
X004556Y004482D01*
X004556Y004559D02*
X004386Y004559D01*
X004365Y004637D02*
X004577Y004637D01*
X004609Y004714D02*
X004333Y004714D01*
X004271Y004791D02*
X004671Y004791D01*
X004767Y004869D02*
X004176Y004869D01*
X004081Y005100D02*
X004861Y005100D01*
X004889Y005089D02*
X005054Y005089D01*
X005206Y005152D01*
X005323Y005269D01*
X005386Y005422D01*
X005386Y005587D01*
X005323Y005739D01*
X005206Y005856D01*
X005054Y005919D01*
X004889Y005919D01*
X004736Y005856D01*
X004619Y005739D01*
X004556Y005587D01*
X004556Y005422D01*
X004619Y005269D01*
X004736Y005152D01*
X004889Y005089D01*
X005081Y005100D02*
X005463Y005100D01*
X005463Y005023D02*
X000724Y005023D01*
X000724Y004946D02*
X005463Y004946D01*
X005463Y004869D02*
X005176Y004869D01*
X005271Y004791D02*
X005463Y004791D01*
X005463Y004714D02*
X005333Y004714D01*
X005365Y004637D02*
X005463Y004637D01*
X005463Y004559D02*
X005386Y004559D01*
X005386Y004482D02*
X005463Y004482D01*
X005463Y004405D02*
X005379Y004405D01*
X005347Y004328D02*
X005463Y004328D01*
X005463Y004250D02*
X005304Y004250D01*
X005227Y004173D02*
X005463Y004173D01*
X005463Y004096D02*
X005070Y004096D01*
X004873Y004096D02*
X004070Y004096D01*
X003873Y004096D02*
X000724Y004096D01*
X000724Y004173D02*
X003715Y004173D01*
X003638Y004250D02*
X000724Y004250D01*
X000724Y004328D02*
X003595Y004328D01*
X003563Y004405D02*
X000724Y004405D01*
X000724Y004482D02*
X003556Y004482D01*
X003556Y004559D02*
X000724Y004559D01*
X000724Y004637D02*
X003577Y004637D01*
X003609Y004714D02*
X000724Y004714D01*
X000724Y004791D02*
X003671Y004791D01*
X003767Y004869D02*
X000724Y004869D01*
X000724Y005100D02*
X003861Y005100D01*
X003889Y005089D02*
X004054Y005089D01*
X004206Y005152D01*
X004323Y005269D01*
X004386Y005422D01*
X004386Y005587D01*
X004323Y005739D01*
X004206Y005856D01*
X004054Y005919D01*
X003889Y005919D01*
X003736Y005856D01*
X003619Y005739D01*
X003556Y005587D01*
X003556Y005422D01*
X003619Y005269D01*
X003736Y005152D01*
X003889Y005089D01*
X003711Y005178D02*
X000724Y005178D01*
X000724Y005255D02*
X003633Y005255D01*
X003593Y005332D02*
X000724Y005332D01*
X000724Y005410D02*
X003561Y005410D01*
X003556Y005487D02*
X000724Y005487D01*
X000724Y005564D02*
X003556Y005564D01*
X003579Y005641D02*
X000724Y005641D01*
X000724Y005719D02*
X003611Y005719D01*
X003676Y005796D02*
X000724Y005796D01*
X000724Y005873D02*
X003778Y005873D01*
X003889Y006089D02*
X004054Y006089D01*
X004206Y006152D01*
X004323Y006269D01*
X004386Y006422D01*
X004386Y006587D01*
X004323Y006739D01*
X004206Y006856D01*
X004054Y006919D01*
X003889Y006919D01*
X003736Y006856D01*
X003619Y006739D01*
X003556Y006587D01*
X003556Y006422D01*
X003619Y006269D01*
X003736Y006152D01*
X003889Y006089D01*
X003850Y006105D02*
X000724Y006105D01*
X000724Y006028D02*
X005463Y006028D01*
X005463Y006105D02*
X005092Y006105D01*
X005054Y006089D02*
X005206Y006152D01*
X005323Y006269D01*
X005386Y006422D01*
X005386Y006587D01*
X005323Y006739D01*
X005206Y006856D01*
X005054Y006919D01*
X004889Y006919D01*
X004736Y006856D01*
X004619Y006739D01*
X004556Y006587D01*
X004556Y006422D01*
X004619Y006269D01*
X004736Y006152D01*
X004889Y006089D01*
X005054Y006089D01*
X005164Y005873D02*
X005463Y005873D01*
X005463Y005796D02*
X005266Y005796D01*
X005331Y005719D02*
X005463Y005719D01*
X005463Y005641D02*
X005363Y005641D01*
X005386Y005564D02*
X005463Y005564D01*
X005463Y005487D02*
X005386Y005487D01*
X005381Y005410D02*
X005463Y005410D01*
X005463Y005332D02*
X005349Y005332D01*
X005309Y005255D02*
X005463Y005255D01*
X005463Y005178D02*
X005232Y005178D01*
X004711Y005178D02*
X004232Y005178D01*
X004309Y005255D02*
X004633Y005255D01*
X004593Y005332D02*
X004349Y005332D01*
X004381Y005410D02*
X004561Y005410D01*
X004556Y005487D02*
X004386Y005487D01*
X004386Y005564D02*
X004556Y005564D01*
X004579Y005641D02*
X004363Y005641D01*
X004331Y005719D02*
X004611Y005719D01*
X004676Y005796D02*
X004266Y005796D01*
X004164Y005873D02*
X004778Y005873D01*
X004850Y006105D02*
X004092Y006105D01*
X004236Y006182D02*
X004706Y006182D01*
X004629Y006260D02*
X004314Y006260D01*
X004351Y006337D02*
X004591Y006337D01*
X004559Y006414D02*
X004383Y006414D01*
X004386Y006491D02*
X004556Y006491D01*
X004556Y006569D02*
X004386Y006569D01*
X004361Y006646D02*
X004581Y006646D01*
X004613Y006723D02*
X004330Y006723D01*
X004261Y006801D02*
X004681Y006801D01*
X004789Y006878D02*
X004153Y006878D01*
X004054Y007089D02*
X004206Y007152D01*
X004323Y007269D01*
X004386Y007422D01*
X004386Y007587D01*
X004323Y007739D01*
X004206Y007856D01*
X004054Y007919D01*
X003889Y007919D01*
X003736Y007856D01*
X003619Y007739D01*
X003556Y007587D01*
X003556Y007422D01*
X003619Y007269D01*
X003736Y007152D01*
X003889Y007089D01*
X004054Y007089D01*
X004104Y007110D02*
X004839Y007110D01*
X004889Y007089D02*
X005054Y007089D01*
X005206Y007152D01*
X005323Y007269D01*
X005386Y007422D01*
X005386Y007587D01*
X005323Y007739D01*
X005206Y007856D01*
X005054Y007919D01*
X004889Y007919D01*
X004736Y007856D01*
X004619Y007739D01*
X004556Y007587D01*
X004556Y007422D01*
X004619Y007269D01*
X004736Y007152D01*
X004889Y007089D01*
X004701Y007187D02*
X004241Y007187D01*
X004318Y007264D02*
X004624Y007264D01*
X004589Y007342D02*
X004353Y007342D01*
X004385Y007419D02*
X004557Y007419D01*
X004556Y007496D02*
X004386Y007496D01*
X004386Y007573D02*
X004556Y007573D01*
X004583Y007651D02*
X004360Y007651D01*
X004328Y007728D02*
X004615Y007728D01*
X004686Y007805D02*
X004257Y007805D01*
X004142Y007883D02*
X004801Y007883D01*
X005142Y007883D02*
X005463Y007883D01*
X005463Y007960D02*
X000724Y007960D01*
X000724Y008037D02*
X005463Y008037D01*
X005463Y008114D02*
X000724Y008114D01*
X000724Y008192D02*
X005463Y008192D01*
X005463Y008269D02*
X000724Y008269D01*
X000724Y008346D02*
X005463Y008346D01*
X005463Y008424D02*
X000724Y008424D01*
X000724Y008501D02*
X005463Y008501D01*
X005463Y008578D02*
X000724Y008578D01*
X000724Y008655D02*
X005463Y008655D01*
X005463Y008733D02*
X000724Y008733D01*
X000724Y007883D02*
X003801Y007883D01*
X003686Y007805D02*
X000724Y007805D01*
X000724Y007728D02*
X003615Y007728D01*
X003583Y007651D02*
X000724Y007651D01*
X000724Y007573D02*
X003556Y007573D01*
X003556Y007496D02*
X000724Y007496D01*
X000724Y007419D02*
X003557Y007419D01*
X003589Y007342D02*
X000724Y007342D01*
X000724Y007264D02*
X003624Y007264D01*
X003701Y007187D02*
X000724Y007187D01*
X000724Y007110D02*
X003839Y007110D01*
X003789Y006878D02*
X000724Y006878D01*
X000724Y006955D02*
X005463Y006955D01*
X005463Y006878D02*
X005153Y006878D01*
X005261Y006801D02*
X005463Y006801D01*
X005463Y006723D02*
X005330Y006723D01*
X005361Y006646D02*
X005463Y006646D01*
X005463Y006569D02*
X005386Y006569D01*
X005386Y006491D02*
X005463Y006491D01*
X005463Y006414D02*
X005383Y006414D01*
X005351Y006337D02*
X005463Y006337D01*
X005463Y006260D02*
X005314Y006260D01*
X005236Y006182D02*
X005463Y006182D01*
X005463Y005951D02*
X000724Y005951D01*
X000724Y006182D02*
X003706Y006182D01*
X003629Y006260D02*
X000724Y006260D01*
X000724Y006337D02*
X003591Y006337D01*
X003559Y006414D02*
X000724Y006414D01*
X000724Y006491D02*
X003556Y006491D01*
X003556Y006569D02*
X000724Y006569D01*
X000724Y006646D02*
X003581Y006646D01*
X003613Y006723D02*
X000724Y006723D01*
X000724Y006801D02*
X003681Y006801D01*
X005104Y007110D02*
X005463Y007110D01*
X005463Y007187D02*
X005241Y007187D01*
X005318Y007264D02*
X005463Y007264D01*
X005463Y007342D02*
X005353Y007342D01*
X005385Y007419D02*
X005463Y007419D01*
X005463Y007496D02*
X005386Y007496D01*
X005386Y007573D02*
X005463Y007573D01*
X005463Y007651D02*
X005360Y007651D01*
X005328Y007728D02*
X005463Y007728D01*
X005463Y007805D02*
X005257Y007805D01*
X005463Y007032D02*
X000724Y007032D01*
X000724Y004018D02*
X005463Y004018D01*
X005463Y003941D02*
X000724Y003941D01*
X000724Y003864D02*
X003755Y003864D01*
X003667Y003787D02*
X000724Y003787D01*
X000724Y003709D02*
X003607Y003709D01*
X003575Y003632D02*
X000724Y003632D01*
X000724Y003555D02*
X003556Y003555D01*
X003556Y003477D02*
X000724Y003477D01*
X000724Y003400D02*
X003565Y003400D01*
X003597Y003323D02*
X000724Y003323D01*
X000724Y003246D02*
X003643Y003246D01*
X003720Y003168D02*
X000724Y003168D01*
X000724Y003091D02*
X003884Y003091D01*
X005228Y003864D02*
X005463Y003864D01*
X005463Y003787D02*
X005306Y003787D01*
X005358Y003709D02*
X005463Y003709D01*
X005463Y003632D02*
X005390Y003632D01*
X005407Y003555D02*
X005463Y003555D01*
M02*

31
extclk/extclk.GBS Normal file
View File

@ -0,0 +1,31 @@
G75*
G70*
%OFA0B0*%
%FSLAX24Y24*%
%IPPOS*%
%LPD*%
%AMOC8*
5,1,8,0,0,1.08239X$1,22.5*
%
%ADD10C,0.0000*%
%ADD11C,0.0634*%
D10*
X000534Y001854D02*
X000534Y008941D01*
X005652Y008941D01*
X005652Y001854D01*
X000534Y001854D01*
D11*
X003971Y002504D03*
X003971Y003504D03*
X003971Y004504D03*
X003971Y005504D03*
X003971Y006504D03*
X003971Y007504D03*
X004971Y007504D03*
X004971Y006504D03*
X004971Y005504D03*
X004971Y004504D03*
X004971Y003504D03*
X004971Y002504D03*
M02*

17
extclk/extclk.GML Normal file
View File

@ -0,0 +1,17 @@
G75*
G70*
%OFA0B0*%
%FSLAX24Y24*%
%IPPOS*%
%LPD*%
%AMOC8*
5,1,8,0,0,1.08239X$1,22.5*
%
%ADD10C,0.0000*%
D10*
X000534Y001854D02*
X000534Y008941D01*
X005652Y008941D01*
X005652Y001854D01*
X000534Y001854D01*
M02*

1172
extclk/extclk.GTL Normal file

File diff suppressed because it is too large Load Diff

109
extclk/extclk.GTO Normal file
View File

@ -0,0 +1,109 @@
G75*
G70*
%OFA0B0*%
%FSLAX24Y24*%
%IPPOS*%
%LPD*%
%AMOC8*
5,1,8,0,0,1.08239X$1,22.5*
%
%ADD10C,0.0000*%
%ADD11C,0.0079*%
%ADD12C,0.0080*%
D10*
X000534Y001854D02*
X000534Y008941D01*
X005652Y008941D01*
X005652Y001854D01*
X000534Y001854D01*
D11*
X001400Y003075D02*
X002818Y003075D01*
X002818Y003784D01*
X001400Y003784D01*
X001400Y003075D01*
X002030Y004414D02*
X002188Y004414D01*
X002739Y005063D02*
X002739Y005732D01*
X002188Y006382D02*
X002030Y006382D01*
X001479Y005732D02*
X001479Y005063D01*
X001400Y007012D02*
X002818Y007012D01*
X002818Y007721D01*
X001400Y007721D01*
X001400Y007012D01*
X003096Y004591D02*
X003098Y004606D01*
X003104Y004620D01*
X003114Y004632D01*
X003126Y004641D01*
X003141Y004646D01*
X003156Y004647D01*
X003171Y004644D01*
X003184Y004637D01*
X003195Y004626D01*
X003203Y004613D01*
X003207Y004599D01*
X003207Y004583D01*
X003203Y004569D01*
X003195Y004556D01*
X003184Y004545D01*
X003171Y004538D01*
X003156Y004535D01*
X003141Y004536D01*
X003126Y004541D01*
X003114Y004550D01*
X003104Y004562D01*
X003098Y004576D01*
X003096Y004591D01*
X003471Y007004D02*
X004471Y007004D01*
X004471Y008004D01*
X005471Y008004D01*
X005471Y002004D01*
X003471Y002004D01*
X003471Y007004D01*
X003471Y008004D01*
X004471Y008004D01*
D12*
X001163Y007663D02*
X001163Y007454D01*
X000954Y007663D01*
X000902Y007663D01*
X000850Y007611D01*
X000850Y007506D01*
X000902Y007454D01*
X000902Y007301D02*
X000850Y007248D01*
X000850Y007144D01*
X000902Y007091D01*
X001111Y007091D01*
X001163Y007144D01*
X001163Y007248D01*
X001111Y007301D01*
X001163Y005754D02*
X001163Y005544D01*
X001163Y005649D02*
X000850Y005649D01*
X000954Y005544D01*
X000850Y005391D02*
X001163Y005182D01*
X001163Y005391D02*
X000850Y005182D01*
X001163Y003726D02*
X001163Y003517D01*
X001163Y003621D02*
X000850Y003621D01*
X000954Y003517D01*
X000902Y003364D02*
X000850Y003311D01*
X000850Y003207D01*
X000902Y003154D01*
X001111Y003154D01*
X001163Y003207D01*
X001163Y003311D01*
X001111Y003364D01*
M02*

43
extclk/extclk.GTS Normal file
View File

@ -0,0 +1,43 @@
G75*
G70*
%OFA0B0*%
%FSLAX24Y24*%
%IPPOS*%
%LPD*%
%AMOC8*
5,1,8,0,0,1.08239X$1,22.5*
%
%ADD10C,0.0000*%
%ADD11C,0.0634*%
%ADD12R,0.0434X0.0532*%
%ADD13R,0.0631X0.0749*%
D10*
X000534Y001854D02*
X000534Y008941D01*
X005652Y008941D01*
X005652Y001854D01*
X000534Y001854D01*
D11*
X003971Y002504D03*
X003971Y003504D03*
X003971Y004504D03*
X003971Y005504D03*
X003971Y006504D03*
X003971Y007504D03*
X004971Y007504D03*
X004971Y006504D03*
X004971Y005504D03*
X004971Y004504D03*
X004971Y003504D03*
X004971Y002504D03*
D12*
X002503Y003429D03*
X001715Y003429D03*
X001715Y007366D03*
X002503Y007366D03*
D13*
X002640Y006225D03*
X001577Y006225D03*
X001577Y004571D03*
X002640Y004571D03*
M02*

27
extclk/extclk.TXT Normal file
View File

@ -0,0 +1,27 @@
%
M48
M72
T01C0.0157
T02C0.0394
%
T01
X1322Y2445
X3133Y3390
X3172Y5358
X3133Y7366
X1322Y8351
X5022Y8351
T02
X4971Y7504
X4971Y6504
X4971Y5504
X4971Y4504
X4971Y3504
X4971Y2504
X3971Y2504
X3971Y3504
X3971Y4504
X3971Y5504
X3971Y6504
X3971Y7504
M30

BIN
extclk/hackrf_gpssim.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

BIN
extclk/hackrf_tcxo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

1354
gpssim.c

File diff suppressed because it is too large Load Diff

155
gpssim.h Normal file
View File

@ -0,0 +1,155 @@
#ifndef GPSSIM_H
#define GPSSIM_H
#define TRUE (1)
#define FALSE (0)
/*! \brief Maximum length of a line in a text file (RINEX, motion) */
#define MAX_CHAR (100)
/*! \brief Maximum number of satellites in RINEX file */
#define MAX_SAT (32)
/*! \brief Maximum number of channels we simulate */
#define MAX_CHAN (16)
/*! \brief Maximum number of user motion points */
#define USER_MOTION_SIZE (3000) // max duration at 10Hz
/*! \brief Number of subframes */
#define N_SBF (5) // 5 subframes per frame
/*! \brief Number of words per subframe */
#define N_DWRD_SBF (10) // 10 word per subframe
/*! \brief Number of words */
#define N_DWRD ((N_SBF+1)*N_DWRD_SBF) // Subframe word buffer size
/*! \brief C/A code sequence length */
#define CA_SEQ_LEN (1023)
#define SECONDS_IN_WEEK 604800.0
#define SECONDS_IN_HALF_WEEK 302400.0
#define SECONDS_IN_DAY 86400.0
#define SECONDS_IN_HOUR 3600.0
#define SECONDS_IN_MINUTE 60.0
#define POW2_M5 0.03125
#define POW2_M19 1.907348632812500e-6
#define POW2_M29 1.862645149230957e-9
#define POW2_M31 4.656612873077393e-10
#define POW2_M33 1.164153218269348e-10
#define POW2_M43 1.136868377216160e-13
#define POW2_M55 2.775557561562891e-17
// Conventional values employed in GPS ephemeris model (ICD-GPS-200)
#define GM_EARTH 3.986005e14
#define OMEGA_EARTH 7.2921151467e-5
#define PI 3.1415926535898
#define WGS84_RADIUS 6378137.0
#define WGS84_ECCENTRICITY 0.0818191908426
#define R2D 57.2957795131
#define SPEED_OF_LIGHT 2.99792458e8
#define LAMBDA_L1 0.190293672798365
/*! \brief GPS L1 Carrier frequency */
#define CARR_FREQ (1575.42e6)
/*! \brief C/A code frequency */
#define CODE_FREQ (1.023e6)
#define CARR_TO_CODE (1.0/1540.0)
// Sampling data format
#define SC01 (1)
#define SC08 (8)
#define SC16 (16)
#define EPHEM_ARRAY_SIZE (13) // for daily GPS broadcast ephemers file (brdc)
/*! \brief Structure representing GPS time */
typedef struct
{
int week; /*!< GPS week number (since January 1980) */
double sec; /*!< second inside the GPS \a week */
} gpstime_t;
/*! \brief Structure repreenting UTC time */
typedef struct
{
int y; /*!< Calendar year */
int m; /*!< Calendar month */
int d; /*!< Calendar day */
int hh; /*!< Calendar hour */
int mm; /*!< Calendar minutes */
double sec; /*!< Calendar seconds */
} datetime_t;
/*! \brief Structure representing ephemeris of a single satellite */
typedef struct
{
int vflg; /*!< Valid Flag */
datetime_t t;
gpstime_t toc; /*!< Time of Clock */
gpstime_t toe; /*!< Time of Ephemeris */
int iodc; /*!< Issue of Data, Clock */
int iode; /*!< Isuse of Data, Ephemeris */
double deltan; /*!< Delta-N (radians/sec) */
double cuc; /*!< Cuc (radians) */
double cus; /*!< Cus (radians) */
double cic; /*!< Correction to inclination cos (radians) */
double cis; /*!< Correction to inclination sin (radians) */
double crc; /*!< Correction to radius cos (meters) */
double crs; /*!< Correction to radius sin (meters) */
double ecc; /*!< e Eccentricity */
double sqrta; /*!< sqrt(A) (sqrt(m)) */
double m0; /*!< Mean anamoly (radians) */
double omg0; /*!< Longitude of the ascending node (radians) */
double inc0; /*!< Inclination (radians) */
double aop;
double omgdot; /*!< Omega dot (radians/s) */
double idot; /*!< IDOT (radians/s) */
double af0; /*!< Clock offset (seconds) */
double af1; /*!< rate (sec/sec) */
double af2; /*!< acceleration (sec/sec^2) */
double tgd; /*!< Group delay L2 bias */
// Working variables follow
double n; /*!< Mean motion (Average angular velocity) */
double sq1e2; /*!< sqrt(1-e^2) */
double A; /*!< Semi-major axis */
double omgkdot; /*!< OmegaDot-OmegaEdot */
} ephem_t;
typedef struct
{
gpstime_t g;
double range; // pseudorange
double rate;
double d; // geometric distance
double azel[2];
} range_t;
/*! \brief Structure representing a Channel */
typedef struct
{
int prn; /*< PRN Number */
int ca[CA_SEQ_LEN]; /*< C/A Sequence */
double f_carr; /*< Carrier frequency */
double f_code; /*< Code frequency */
unsigned int carr_phase; /*< Carrier phase */
int carr_phasestep; /*< Carrier phasestep */
double code_phase; /*< Code phase */
gpstime_t g0; /*!< GPS time at start */
unsigned long sbf[5][N_DWRD_SBF]; /*!< current subframe */
unsigned long dwrd[N_DWRD]; /*!< Data words of sub-frame */
int iword; /*!< initial word */
int ibit; /*!< initial bit */
int icode; /*!< initial code */
int dataBit; /*!< current data bit */
int codeCA; /*!< current C/A code */
double azel[2];
range_t rho0;
} channel_t;
#endif

View File

@ -2,7 +2,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <libbladeRF.h> #include <libbladeRF.h>
#ifdef _WIN32
#include "getopt.h"
#else
#include <unistd.h>
#endif
#define TX_FREQUENCY 1575420000 #define TX_FREQUENCY 1575420000
#define TX_SAMPLERATE 2600000 #define TX_SAMPLERATE 2600000
@ -15,6 +21,18 @@
#define NUM_TRANSFERS 16 #define NUM_TRANSFERS 16
#define TIMEOUT_MS 1000 #define TIMEOUT_MS 1000
#define AMPLITUDE (1000) // Default amplitude for 12-bit I/Q
void usage(void)
{
fprintf(stderr, "Usage: bladeplayer [options]\n"
" -f <tx_file> I/Q sampling data file (required)\n"
" -b <iq_bits> I/Q data format [1/16] (default: 16)\n"
" -g <tx_vga1> TX VGA1 gain (default: %d)\n",
TX_VGA1);
return;
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int status; int status;
@ -26,16 +44,71 @@ int main(int argc, char *argv[])
enum state {INIT, READ_FILE, PAD_TRAILING, DONE}; enum state {INIT, READ_FILE, PAD_TRAILING, DONE};
enum state state = INIT; enum state state = INIT;
if (argc!=2) { int compressed = 0;
fprintf(stderr, "Usage: bladeplayer <tx_file>\n"); uint8_t *read_buffer;
size_t samples_read;
int16_t lut[256][8];
int16_t amp = AMPLITUDE;
int i,k;
int gain = TX_VGA1;
int result;
int data_format;
char txfile[128];
// Empty TX file name
txfile[0] = 0;
if (argc<3) {
usage();
exit(1); exit(1);
} }
while ((result=getopt(argc,argv,"g:b:f:"))!=-1)
{
switch (result)
{
case 'g':
gain = atoi(optarg);
if (gain>-4 || gain<-35)
{
printf("ERROR: Invalid TX VGA1 gain.\n");
exit(1);
}
break;
case 'b':
data_format = atoi(optarg);
if (data_format!=1 && data_format!=16)
{
printf("ERROR: Invalid I/Q data format.\n");
exit(1);
}
else if (data_format==1)
compressed = 1;
break;
case 'f':
strcpy(txfile, optarg);
break;
case ':':
case '?':
usage();
exit(1);
default:
break;
}
}
// Open TX file. // Open TX file.
fp = fopen(argv[1], "rb"); if (txfile[0]==0)
{
printf("ERROR: I/Q sampling data file is not specified.\n");
exit(1);
}
fp = fopen(txfile, "rb");
if (fp==NULL) { if (fp==NULL) {
fprintf(stderr, "Failed to open TX file: %s\n", argv[1]); fprintf(stderr, "ERROR: Failed to open TX file: %s\n", argv[1]);
exit(1); exit(1);
} }
@ -75,13 +148,13 @@ int main(int argc, char *argv[])
printf("TX bandwidth: %u Hz\n", TX_BANDWIDTH); printf("TX bandwidth: %u Hz\n", TX_BANDWIDTH);
} }
status = bladerf_set_txvga1(dev, TX_VGA1); status = bladerf_set_txvga1(dev, gain);
if (status != 0) { if (status != 0) {
fprintf(stderr, "Failed to set TX VGA1 gain: %s\n", bladerf_strerror(status)); fprintf(stderr, "Failed to set TX VGA1 gain: %s\n", bladerf_strerror(status));
goto out; goto out;
} }
else { else {
printf("TX VGA1 gain: %d dB\n", TX_VGA1); printf("TX VGA1 gain: %d dB\n", gain);
} }
status = bladerf_set_txvga2(dev, TX_VGA2); status = bladerf_set_txvga2(dev, TX_VGA2);
@ -97,13 +170,27 @@ int main(int argc, char *argv[])
printf("Running...\n"); printf("Running...\n");
// Allocate a buffer to hold each block of samples to transmit. // Allocate a buffer to hold each block of samples to transmit.
tx_buffer = (int16_t*)malloc(SAMPLES_PER_BUFFER* 2 * sizeof(int16_t)); tx_buffer = (int16_t*)malloc(SAMPLES_PER_BUFFER * 2 * sizeof(int16_t));
if (tx_buffer == NULL) { if (tx_buffer == NULL) {
fprintf(stderr, "Failed to allocate TX buffer.\n"); fprintf(stderr, "Failed to allocate TX buffer.\n");
goto out; goto out;
} }
// if compressed
read_buffer = (uint8_t*)malloc(SAMPLES_PER_BUFFER / 4);
if (read_buffer == NULL) {
fprintf(stderr, "Failed to allocate read buffer.\n");
goto out;
}
for (i=0; i<256; i++)
{
for (k=0; k<8; k++)
lut[i][k] = ((i>>(7-k))&0x1)?amp:-amp;
}
// Configure the TX module for use with the synchronous interface. // Configure the TX module for use with the synchronous interface.
status = bladerf_sync_config(dev, status = bladerf_sync_config(dev,
BLADERF_MODULE_TX, BLADERF_MODULE_TX,
@ -131,6 +218,9 @@ int main(int argc, char *argv[])
int16_t *tx_buffer_current = tx_buffer; int16_t *tx_buffer_current = tx_buffer;
unsigned int buffer_samples_remaining = SAMPLES_PER_BUFFER; unsigned int buffer_samples_remaining = SAMPLES_PER_BUFFER;
// if compressed
unsigned int read_samples_remaining = SAMPLES_PER_BUFFER / 4;
// Keep adding to the buffer until it is full or a failure occurs // Keep adding to the buffer until it is full or a failure occurs
while (buffer_samples_remaining > 0 && status == 0 && state != DONE) { while (buffer_samples_remaining > 0 && status == 0 && state != DONE) {
size_t samples_populated = 0; size_t samples_populated = 0;
@ -139,11 +229,35 @@ int main(int argc, char *argv[])
case INIT: case INIT:
case READ_FILE: case READ_FILE:
// Read from the input file // Read from the input file
samples_populated = fread(tx_buffer_current, if (compressed)
2 * sizeof(int16_t), {
buffer_samples_remaining, int16_t *write_buffer_current = tx_buffer;
fp);
samples_read = fread(read_buffer,
sizeof(uint8_t),
read_samples_remaining,
fp);
samples_populated = samples_read * 4;
buffer_samples_remaining = read_samples_remaining * 4;
// Expand compressed data into TX buffer
for (i=0; i<samples_read; i++)
{
memcpy(write_buffer_current, lut[read_buffer[i]], 8);
// Advance the write buffer pointer
write_buffer_current += 8;
}
}
else
{
samples_populated = fread(tx_buffer_current,
2 * sizeof(int16_t),
buffer_samples_remaining,
fp);
}
// If the end of the file was reached, pad the rest of the buffer and finish. // If the end of the file was reached, pad the rest of the buffer and finish.
if (feof(fp)) { if (feof(fp)) {
state = PAD_TRAILING; state = PAD_TRAILING;
@ -187,6 +301,9 @@ int main(int argc, char *argv[])
// Free up our resources // Free up our resources
free(tx_buffer); free(tx_buffer);
// if compressed
free(read_buffer);
// Close TX file // Close TX file
fclose(fp); fclose(fp);

File diff suppressed because it is too large Load Diff