Design of serial communication system between FPGA and GPS-OEM Board

Source: Internet
Author: User
Design of serial communication system between FPGA and GPS-OEM Board
[Date:] Source: Electronic Components application Author: Chen shilei, Liu Guixi, to Guohua [Font:Large Medium Small]

 

 

0 Introduction

Global Positioning System (GPS) is the second generation of satellite navigation system in the United States. It is developed on the basis of the satellite navigation system of the Meridian Instrument. GPS can provide all-weather, continuous, real-time and high-precision navigation parameters, realize 3D positioning, and provide accurate time information. The GPS system consists of the spatial part, the ground monitoring part, and the ground receiver part. The basic principle of GPS positioning technology is to use the method of ranging and rendezvous positioning. The user receiver receives signals from satellites and uses pseudo-random noise codes generated by the local machine to obtain the distance observation volume and navigation message: then, the receiver location is calculated based on the satellite location and clock difference correction information provided by the navigation message. Due to its global coverage, high accuracy, fast positioning speed, good real-time performance, and strong anti-interference ability. In recent years, GPS has been widely used at home and abroad and has played a significant role in various fields. It has become an indispensable part of the information age. However, GPS Positioning receivers are expensive and difficult to meet application requirements under specific conditions. Therefore, many users expect to design and use a personalized GPS positioning receiver according to their own use environment and performance requirements. In consideration of the circuit area, occupied space, circuit stability and reliability, the field programmable gate array (FPGA) is used to receive, extract, and store GPS signals.

1. Working Principle and communication protocol of the OEM Board

1.1 how OEM Boards work

The task of a GPS signal receiver is to capture the signals of a number of satellites to be tested selected based on a certain satellite height cutoff angle and track the operation of these satellites. Then, the received GPS signal is transformed, amplified, and processed to measure the transmission time of the GPS signal from the satellite to the receiver antenna, and then the navigation message sent by the GPS satellite is obtained. finally, the 3D position, velocity, and time of the Observatory are calculated in real time.

GPS-OEM board is the core component of GPS receiver. The circuit board can receive GPS signals, processing signals, output observation signals, and positioning results. The user uses the OEM board for secondary hardware development and can develop GPS receivers for various applications. The GPS25 OEM board of GARMIN Corporation is used as an example. As a major component of the GPS receiver, this board can receive signals from antenna units and perform a series of processing processes such as frequency conversion, amplification, and filtering, so as to track, lock, and measure GPS satellite signals, and finally generate the data information of the computing position (including: latitude, longitude, height, speed, date, time, course, satellite status, etc.), and by the RS-232 Standard Serial Output serial data, the OEM board is 12 channel GPS receiver, it can track up to 12 GPS satellites at the same time and continuously track GPS satellites for fast positioning.

The end user can enable the OEM board to work in the default factory status, without the need to set input statements. However, to use GPS information, you must use the output statement.

1.2 GPS-OEM board communication protocol

GPS-OEM board has many models and different performance, but their Serial Output Format of GPS positioning information mostly adopts the NMEA-0183 communication standard format developed by the National Ocean Electronics Association. The output data uses an ASCII code. The data format is set to 1 start bit, 8 data bits, and 1 stop bit. There is no parity check. The default baud rate of the output is 4800 baud. It contains information such as latitude, longitude, height, speed, date, time, course, and satellite status. There are 6 common statements, including GGA, GLL, GSA, GSV, RMC, and VTG. Generally, applications only care about the time, latitude and longitude, and the ground speed information. Therefore, the minimum positioning information of gprs mc is usually used to obtain the required information. However, note that these settings are valid only after the system is powered on and configured. You need to reset each time you power on again. Standard Format of NMEA-0183 communication is as follows:

$ <Address zone>, <data zone>, <data zone> ,... <Verification area>, <CR> <LF>

Where: "$" indicates the Start mark of the statement; "address area" indicates the identifier; "data area" indicates the content to send data; "," indicates the data area separator; in the "verification area", the checksum is used. <CR> <LF> indicates the statement Terminator.

The following describes the example of a GPRS Mc statement. This statement contains information such as time, date, orientation, speed, and magnetic offset, which can basically meet general navigation requirements. The structure of the GPRS Mc statement is: $ gprs mc, <1>, <2>, <3>, <4>, <5>, <6>, <7>, <8>, <9>, <lO>, <11>, * hh <CR> <LF>. "GP" indicates the conversation identifier, "RMC" indicates the statement identifier, and "*" indicates the test identifier. "Hh" indicates the checksum, which represents the bitwise XOR or value of all characters between "$" and "*" (excluding these two characters ).

The content in the Data zone of $ uplmc statement is as follows: (1) UTC time, hhmmss (hour, minute, second) Format
(2) Positioning status, A = valid, V = invalid
(3) latitude ddmm. mmmm (degree) format (the preceding 0 will also be transmitted)
(4) latitude hemisphere N (northern hemisphere) or S (Southern Hemisphere)
(5) longitude dddmm. mmmm (degree) format (the preceding 0 will also be transmitted)
(6) longitude hemisphere E (eastern longitude) or W (Western longitude)
(7) ground speed (000.0 ~ Section 999.9, the previous 0 will also be transmitted)
(8) ground heading (000.0 ~ 359.9 degrees. Based on the reference of zhenbei, the preceding 0 will also be transmitted)
(9) UTC date, in ddmmyy format
(10) magnetic angle (000.0 ~ 180.0 degrees, the previous 0 will also be transmitted)
(11) magnetic angle direction, E (East) or W (West)

In practice, generally, only the time and location information is extracted and the validity of the positioning data is verified.

2. Design of A Serial Communication System

2.1 System Communication Principles

Because the FPGA interface uses TTL level, and the serial communication of the OEM Board adopts the standard level of RS-232, the level conversion is required, and the level conversion interface can be implemented through the MAX202 chip. GPS25 has two serial ports. Port 1 can be used to input the differential correction information and output the original measurement information of the satellite. Port 2 is used to input the set statement and output the Positioning Statement. Therefore, you only need to connect the FPGA interface to GPS25 Serial Port 2. its Interface Circuit l is shown. The global clock Global_clk of FPGA is generated by a 24 MHz crystal oscillator.

2.2 personalized OEM board configuration

After the FPGA module is powered on, the asynchronous serial transmission circuit sends the User-Defined configuration statement to customize the OEM board.

The default baud rate of GPS25 is 4800 bit/s. Therefore, the baud rate clock of the asynchronous serial transmission circuit in FPGA should also be set to this value. The specific value can be achieved by dividing the global clock of the system. After the end sign is sent, the position information receiving and reading circuit in FPGA can start to work and wait for the data to be received. In this example, the position information of the OEM board is received using the $ GPRS Mc statement. If the application system has special requirements, initialization, configuration, and selection of the output statement are also required. It should be noted that the checksum in NMEA-0183 format does not need to be sent.

The $ GRMI statement can be used for initialization. The result is:

Where, <1> ~ <4> items are used to set geographical locations. Their format is the same as that of the $ GPGGA statement. <5> items are UTC date, and the format is "day, day, month, year ", item <6> is UTC time. The format is the same as that of $ GPGGA. In item <7>, A = automatic positioning and R = device reset.

You can use the $ PGRMC statement to configure the OEM board. This statement has 14 valid items, of which the <10> Option selects the baud rate, 1 ~ 7 represents the standard baud rate of 300 ~ 19200. During configuration, you can leave the original configuration item unchanged with null items. For example, if the parameter is set to 9600 port and the second pulse is output, the statement is:

There are more than 10 output statements in GPS25. The default output statements are five, including $ GPGGA. You can use the $ PGRMO statement to set output information. Its structure is:

Where, <1> is the legal statement name, such as gprs mc; <2> is the statement state, 1 indicates that the statement output is prohibited, and 2 indicates that the statement output is allowed, 3 indicates that all statement output is forbidden, and 4 indicates that all statements are allowed.

For example, the following input statement only allows the OEM board to output the $ uplmc statement:

$ Pgrmo, 3 <CR> <LF>; Disable output of all statements.

$ Pgrmo, gprs mc, 2 <CR> <LF>; allows output of $ gprs mc.

3. Receive and read positioning information

3.1 Design of the receiving module

The receiving module in this design is mainly responsible for receiving the navigation and positioning signals output by OEM board Serial Port 2. This module includes the txd start position detection circuit, sampling circuit, baud rate generator and asynchronous FIFO cache design. In this example, the baud rate generator is actually a clock divider, And the generated clock frequency is 16 times the baud rate clock. The purpose is to precisely sample the received data and propose asynchronous serial data, it can also provide a write clock for Asynchronous FIFO.

Before receiving, the rxd signal directly output from the OEM board should be processed synchronously to filter out interference in the output, reduce the probability of steady state generation in Central Asia during asynchronous time domain data transmission, and improve system stability and reliability. This design uses two-level D triggers to achieve signal synchronization. According to the communication protocol of asynchronous transmission, when the circuit detects a negative hop change in the output syn_txd after the OEM board is synchronized. The entire receiving sampling circuit starts to work. In order to avoid interference and obtain the correct start bit, at least half of the clock at the baud rate must belong to logic 0, that is, after eight clock cycles, it can be determined that the receipt is a reliable start bit. After receiving the correct start bit, the subsequent data bit is sampled every 16 sampling periods. That is, take the 8th baud rate clock sample values of each bit to ensure correct sampling. Figure 2 shows the serial port receiving status of the system. After 8 consecutive sampling times, that is, after a byte data is received, you can set the bit end mark. Each sampled byte of data is first cached in the FIFO. Because the maximum number of bytes transmitted by the data in the GPRS Mc format is 72 bytes, after receiving a set of data, you must set the full signal of the FIFO, the global clock control is used to read the cached data for subsequent processing. After reading the data, you can receive the ending mark of the subsequent module and reset the read enabling function to wait for the arrival of the next group of data. The simulation result 3 is shown.

3.2 data verification and storage design

To correctly read the output statements of the OEM board, first judge the statement type, and then store data, and then determine the end mark of the statement. In this example, the received data is stored in the RAM set in FPGA, and the extraction and processing of time and location information is completed in other parts.

The data verification module is enabled by a full FIFO signal. When the full signal is detected to be valid. The verification module continuously reads and processes the data. When the Start mark "$" is detected, data is read and detected. Output data appears in the form of statements. Each statement represents a type of data, and each type of data has its own identifier. Therefore, determine whether the statement is required based on the received statement identifier (for example, "GP" is the identifier and "RMC" is the statement name ).

According to NMEA-0183 communication standard format content, the received data can be tested. That is, the received information is inconsistent or byte. When "*" is received, compare the next character "hh" with the actual difference or whether the value is equal. If the values are equal, the received data is correct. If the values are not equal, the received data is invalid. Then, the system resets the storage device and waits for the next data group to be detected. When <CR> <LF> is detected, it indicates that the Data Reading is complete. The system sends an end sign to the FIFO and waits for the next data detection. The system verification flowchart 4 is shown.

4 Conclusion

Based on the hardware characteristics of PFGA and GPS-25 OEM board, this paper analyzes the problem of serial communication between FPGA and OEM board, and focuses on the design of GPS positioning information reading.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.