Skip to content

Real Time Streaming to HackRF

Nguyễn Mạnh Toàn edited this page Dec 19, 2018 · 15 revisions

Step 1: Create FIFO for GPS Simulation Data

mkfifo gpsstream

Step 2: Invoke GPS Simulator with current ephemeris file and current time/date and stream to FIFO. According to the delay of ephemeris set if you download from here. Thus, you need to modify a little bit of gpssim's source code to estimate the current satellite position.

  • The first, comment from line 2011 to line 2024
  • The second, insert at line 2057 as follow:
  if (subGpsTime(gmax,g0) < 0.0)
  {
    ieph = neph -1;
  }
It looks like:
...
2054:   if (ieph>=0) // ieph has been set
2055:     break;
2056: }
2057: if (subGpsTime(gmax,g0) < 0.0)
2058: {
2059:   ieph = neph -1;
2060: }
2061: if (ieph == -1)
2062: {
2063:   fprintf(stderr, "ERROR: No current set of ephemerides has been found.\n");
2064:   exit(1);
2065: }
  • The last but not least, you also need to re-compile source code
gcc gpssim.c -lm -O3 -o gps-sdr-sim

After that, you can go to next step.

./gps-sdr-sim -e brdcXXXX.17X -l 50.059330, 0.008319,100 -b 8 -t $(date -u +%Y/%m/%d,%H:%M:%S) -i -o gpsstream
  • GPS-SDR-SIM only accepts the input variable as UTC time for "-t" option
  • Here is details of function date2gps
  • The time input must be in UTC time and follow as a proper format YYYY/MM/DD,hh:mm:ss
  • Regarding the accuracy, The time input should not be less or more than 4 hours which was compared with the time of the first or last field in the RINEX file respectively. Otherwise, kindly download a new RINEX file. Normally, the RINEX file will be updated every 2 ~ 3 hours.
  • To see the current UTC time/date, you can execute the command:
date -u +%Y/%m/%d,%H:%M:%S

Step 3: Broadcast GPS Simulation Data from FIFO

hackrf_transfer -t ./gpsstream -f 1575420000 -s 2600000 -a 1 -x 0
Clone this wiki locally