I'm finally having some success from my GPS receiver (mostly software) project.
The data was captured from test points on the KiwiSDR GPS receiver board (
http://kiwisdr.com/), which uses a Skyworks SE4150L front end.
The data was collected by using a Digilent Nexys2 FPGA board, using the EPP / USB interface to send the 16,368MHz bitstream to a PC for recording.
The bitstream has the GPS L1 (1575.42 MHz) signal down-converted to 4,092MHz IF.
From then on it is all offline processing.
- a couple of ms of data is heavily analysed to detect the C/A code from the Space Vehicles (SVs). It tests 16,368 alignments, over twenty one 500Hz-wide frequency bands)
- Each SV signal then tracked for a few ms, to find the peak signal power and drop out any false positives, and allow estimate of the freqency
- The signals are then locked on, using two PID-like control loops to track both frequency and C/A code alignment
- The I/Q data from the locked signal is then decoded to recover the BPSK Navigation data
- Framing of the BPSK is recovered using the Transfer Work and Parity information
- As the SV time calibration and Orbit data subframes are received from each SV, it is decoded to give the NAV information required.
- Every ms, a new snapshot of timing information can be taken, to deduce when the SV transmitted the signal
Id, State, Orbt, Time, WeekNo, FrameOfWeek, msOfFrame, ChipOfCode, fracOfChip
01, LOCKED, NO,YES, 1850, 109754, 2550, 481, 7 0 29 10 1....
02,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
03, LOCKED, NO,YES, 1942, 38862, 4356, 6, 61 7 7 16 123..
04, LOCKED, YES,YES, 1942, 92209, 4354, 308, 43 7 7 14 1234.
05,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
06,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
07,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
08,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
09,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
10,ACQUIRE, NO, NO, 0, 4, 5946, 0, 2 1 -1 0 .....
11,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
12,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
13,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
14, LOCKED, YES,YES, 1942, 92209, 4357, 431, 49 7 7 17 1234.
15,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
16, LOCKED, NO, NO, 0, 5, 4346, 708, 57 4 29 6 .....
17,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
18,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
19,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
20,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
21,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
22,ACQUIRE, NO, NO, 0, 0, 534, 0, 1 0 -1 0 .....
23, LOCKED, NO, NO, 0, 92209, 4349, 35, 35 7 7 9 ...45
24,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
25,ACQUIRE, NO, NO, 0, 0, 550, 0, 2 0 -1 0 .....
26, LOCKED, YES,YES, 1942, 92209, 4353, 127, 63 7 7 13 1234.
27,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
28,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
29,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
30,ACQUIRE, NO, NO, 0, 0, 0, 0, 0 0 -2 0 .....
31, LOCKED, YES,YES, 1942, 92209, 4360, 390, 47 7 8 0 1234.
32,ACQUIRE, NO, NO, 0, 0, 0, 0, 2 0 -2 0 .....
- This timing information (with an accuracy of about 30ns) is then combined with the parameters from the NAV data, to allow calculation of the SV's positions:
Location is ( -25130455.31126, -7725302.46258, -4938664.23183) @ 553258.49430079
Location is ( -16270394.15858, -11271476.24594, -17523671.16328) @ 553258.49748713
Location is ( -26148084.68495, -4670089.21235, -1576468.02291) @ 553258.49364161
Location is ( -16596519.86073, -2385756.26196, -20618396.91183) @ 553258.50017198
And this is then thrown through a linear equation solver to give a position solution, in Earth Centered, Earth Fixed coordinates, that is then converted to Lat/Long/Alt:
Solved is ( -4582649.395993, 609390.121661, -4379461.963727) @ 0.003112 (alt 6368023.154693)
Lat/Lon/Alt : -43.642632, 172.425379, 27.3
I've still got to add a few features to the for things like the ionospheric delay, and I need to reliability lock onto signals that are on the edges between frequency bands during the acquisition phase (it sometimes locks with a 500Hz offset, causing the I/Q data to flip every millisecond). This will increase the number of tracked satellites, and improve accuracy.
Using only standard 'C' libraries only, it is 2300 lines of code. I've structured the code / algorithms used such that I can start off-loading things down into the FPGA hardware.