GPS HDL Data Decode
This example shows how to perform bit synchronization, frame synchronization, and data decoding on global positioning system (GPS) legacy navigation (LNAV) symbols using Simulink® blocks. These blocks are optimized for HDL code generation and hardware implementation. You can obtain LNAV symbols by performing acquisition and tracking on a GPS baseband waveform using the GPS HDL Acquisition and Tracking Using C/A Code example.
GPS Navigation Message
This figure shows the structure of the GPS navigation message. Each navigation message comprises 25 frames, each frame comprises 5 subframes, and each subframe comprises 10 words. Each word comprises 30 bits in which 24 are data bits and 6 are parity bits. Consequently, each navigation message comprises 37,500 bits. The navigation message transmits at a bit rate of 50 bits per second and has a duration of 12.5 minutes.
Each subframe starts with the Telemetry Word (TLM), which contains a preamble and a TLM message. The preamble is used to synchronize the frames. The second word in a subframe is the handover word (HOW), which contains the time of week (HOWTOW) message and subframe identifier (ID). The subframe ID provides the subframe number and the TOW increments for every subframe to show the time of the received navigation message in the week. Subframes 2 and 3 contain the Ephemeris parameters that provide the information required to determine the exact position of the transmitting satellite. Subframes 4 and 5 contain the Almanac parameters that are dispersed throughout the message. To extract one full set of almanac data, you require a complete navigation message. Almanac parameters help you to obtain rough position estimates of all 32 GPS satellites.
The model in this example mainly consists of bit synchronization, frame synchronization, data decoding, and data interpretation modules. The inputs to the model are the tracked and frequency-corrected GPS LNAV symbols that are tracked and frequency corrected. A set of such tracked LNAV symbols are stored in a MAT file and are used as inputs to the model. The model can process eight satellite channels simultaneously and outputs decoded parameters from all the eight channels. You can use these parameters for GPS position estimation. This figure shows the high-level overview of one of these satellite channels.
This example uses one Simulink model, one function, two scripts, and a MAT file.
gpshdlDataDecode— Decodes the LNAV symbols and extracts GPS parameters.
gpshdlDataDecodeInit— Generates parameters and inputs required to run the
gpshdlDataDecodemodel. The model calls this script using the InitFcn callback.
gpshdlDataDecodeConfig— Generates parameters required for data interpretation in the
gpshdlDataDecodeInitscript calls this function.
gpshdlDataDecodePostSim— Collects outputs from the
gpshdlDataDecodemodel and returns a structure of the decoded parameters. The model calls this script in the StopFcn callback.
gpshdlTrackedSignal— This MAT file contains the tracked signal of a single satellite extracted from the GPS waveform. This signal forms the input to the
This figure shows the top-level view of the
gpshdlDataDecode model. The
Data Decode subsystem executes the core data-decoding logic and outputs the decoded parameters.
Prepare Outputs subsystem accepts the serial parameters from the
Data Decode subsystem and scales the parameters by appropriate scaling factors. The subsystem also vectorizes these parameters and groups similar parameters.
Data Decode Subsystem Inputs
The input ports are column vectors of length 8 because the example decodes data from eight satellites simultaneously.
lnavSym — Legacy navigation symbols extracted from the GPS waveform, specified as 16-bit complex data.
valid — Control signal to validate the lnavSym signal, specified as a Boolean signal.
reset — Control signal to reset data decoding, specified as a Boolean signal.
Data Decode Subsystem Outputs
parameterSet — Set of GPS parameters decoded and extracted from the input LNAV symbols, returned as a 32-bit signed integer. The subsystem returns the parameters serially in consecutive clock cycles. This port has a length of eight because the subsystem decodes the data from eight satellites simultaneously.
parameterSetStart — Control signal that indicates the start of parameterSet. This port has a dimension of eight, because the subsystem decodes the data from eight satellites simultaneously.
almanacData — Almanac data of 32 GPS satellites decoded from the first input satellite channel, returned as 25-bit unsigned integer. The subsystem returns these parameters serially in consecutive clock cycles.
almanacDataStart — Control signal that indicates the start of almanacData.
decodingActive — Control signal that indicates whether the subsystem can synchronize the LNAV symbols and decode data properly. This port has a length of eight because the subsystem decodes the data from eight satellites simultaneously.
Prepare Outputs Subsystem Outputs
All the outputs that this subsystem returns have
double data type.
CEI — Clock, ephemeris, and integrity parameters, returned as an 8-by-29 matrix. Each of the satellites has 29 CEI parameters.
UTC — Coordinated universal time parameters, returned as an 8-by-8 matrix. Each of the satellites has eight UTC parameters.
almanacData — Almanac data of 32 GPS satellites decoded from the first input satellite channel, returned as a 32-by-10 matrix. Each satellite has 10 such almanac parameters.
almanacParam — Almanac parameters other than almanacData, returned as an 8-by-34 matrix. Each satellite has 34 such parameters.
otherParam — Additional parameters extracted from the LNAV symbols, returned as an 8-by-102 matrix. Each satellite has 102 such parameters.
This figure shows the
Data Decode subsystem which comprises the
Data Decode Core and
Almanac Data subsystems.
Data Decode Core Subsystem
Data Decode Core subsystem accepts the GPS LNAV symbols that you obtain by performing acquisition and tracking on the GPS waveform. The subsystem performs bit synchronization to find the start of a bit in the LNAV symbols and then demodulates the symbols to obtain bits. The subsystem performs frame synchronization to find the beginning of the frame and then performs Hamming decoding to recover the data. The subsystem concatenates specific bits of the decoded data to obtain GPS parameters.
Data Decode Core subsystem contains these main subsystems:
Bit Synchronization— Finds the bit transition boundary in the LNAV symbols based on the positive-edge and negative-edge transition of the symbols and performs hard-decision decoding to obtain bits.
Frame Synchronization and Data Decoding— Checks for the preamble sequence in the incoming bits, verifies the parity, decodes the encoded data, and extracts HOWTOW and Subframe ID from the data to verify if both HOWTOW and Subframe ID agree with each other. If all the checks pass, the subsystem confirms that the frame synchronization is successful and forwards the decoded data, one word (24 bits) at a time.
Data Interpretation— Selects and concatenates a set of bits from the decoded word and then converts the concatenated value from two's complement form to signed integer form to obtain a GPS parameter. This subsystem performs these steps for all the GPS parameters.
Serializer— Converts the extracted GPS parameters from vector to serial values.
Almanac Data Subsystem
Almanac Data subsystem executes the data interpretation and serializer logic for the Almanac. The subsystem takes the decoded words of the first satellite channel from the
Frame Synchronization and Data Decoding subsystem and concatenates selective bits from the words to obtain almanac parameters. The subsystem processes only the first satellite channel because the other satellite channels contain similar almanac data.
Run The Model
Open and run the
gpshdlDataDecode model. After simulation, the
gpshdlDataDecodePostSim script uses the simulation output to create
ceiStruct structure contains these CEI parameters.
ans = struct with fields: IntegrityStatusFlag: 0 AlertFlag: 0 WeekNumber: 101 SVHealth: 0 URAID: 0 ReferenceTimeOfClock: 0 IssueOfDataEphemeris: 0 ReferenceTimeOfEphemeris: 0 FitIntervalFlag: 0 IssueOfDataClock: 0 GroupDelayDifferential: 0 MeanMotionDifference: 0 RateOfRightAscension: 0 InclinationRate: 0 MeanAnomaly: 0 LongitudeOfAscendingNode: -0.8400 Inclination: 0.3000 ArgumentOfPerigee: -0.5200 Eccentricity: 0.0200 SemiMajorAxisLength: 2.6560e+04 SVClockCorrectionCoefficients: [3x1 double] HarmonicCorrectionTerms: [6x1 double]
Generate HDL Code
To generate HDL code, you must have an HDL Coder™ license. Use
makehdltb functions to generate HDL code and an HDL test bench for the
Data Decode subsystem.
Synthesize the HDL code for a Xilinx® Zynq®-7000 ZC706 evaluation board. This table shows the post-place-and-route resource utilization. The maximum frequency of operation is 221 MHz.
Resources Usage _______________ _____ Slice LUT 14223 Slice Registers 33625 DSP48 24
 IS-GPS-200, Rev: L. "NAVSTAR GPS Space Segment/Navigation User Segment Interfaces." GPS Enterprise Space & Missile Systems Center (SMC) - LAAFB. https://www.gps.gov/technical/icwg/IS-GPS-200M.pdf