1. An overview of the

There are various sensor devices such as camera, laser, inertial navigation and so on on the map acquisition vehicle, and the data collected are image, laser point cloud, trajectory and so on. In the process of generating map data, these data need to be associated, but these devices all run independently, and the time synchronization system can complete this task.

Time synchronization System is based on the time information of GPS (Global Positioning System). This paper mainly describes the GPS timing principle, timing method, timing process and abnormal situation in the timing system.

2. GPS timing principle

GPS satellites are equipped with highly accurate atomic clocks (cesium atoms) that allow them to synchronize time with each other at a very high precision, and their time starts exactly right. Because of the clock difference between the user receiver and the satellite, at least four satellites are needed to realize the navigation and positioning of the zero point time reference system.

When a user has worked out the difference between his own clock and the satellite’s, he can correct his own local clock to synchronize it with the satellite’s precise clock, a process called timing.

The principle of atomic clocks is that the electrons in an atom move from one energy level to another at a very steady frequency, so that they can be used as pendulums to pinpoint the exact time.

The principle of GPS timing is that GPS receiver can simultaneously receive signals of >=4 satellites within its field of vision at any time, and extract and output two kinds of time signals after decoding and processing:

(1) The synchronization error between the Pulse front and the international standard time of PPS (Pulse Per Second) with a time interval of 1S is less than 1us.

(2) the serial port output information is the international standard time and date corresponding to the PPS front, the most widely used is NMEA-0183 protocol, such as $GPGGA,$GPRMC, etc.

Recommended Minimum Spegps/Transit Data(RMC) Recommended Location Information.

Protocol format:

$GPRMC,<1>,<2>,<3>,<4>,<5>,<6>,<7>,<8>,<9>,<10>,<11>*hh<CR><LF>

Sample data:

A, $GPRMC, 161229.487, 3723.2475, N, 12158.3416 W, 0.13, 309.62, 120598, * 10

3. GPS timing method

3.1 Relationship between PPS and NMEA

To describe the timing method of GPS, it is necessary to first understand the relationship and function between PPS and NMEA. As shown in the figure below, in the case of GPS positioning, PPS will arrive first and NMEA data will arrive later. However, the time interval set by different GPS manufacturers is not the same, some are a few milliseconds, and some are hundreds of milliseconds.

PPS with NMEA

Yellow: PPS, rising edge is exactly 0 seconds.

Blue: NMEA, GPS time information, including year, month, day, minutes and seconds.

3.2 Detailed explanation of GPS timing process

Structure drawing of GPS timing system

The structure diagram of GPS timing system is shown in the figure above:

(1)GPS receiver produces output PPS pulse signal and effective GPS time information under the condition of positioning. This information is output by serial communication, TTL/RS232 signal type, ASCII code, bort rate 9600BPS ~ 460800BPS, configable, following the NMEA-0183 protocol. There are as many as a dozen types of data for this protocol, and RMC is usually sufficient to extract GPS time information.

(2) Crystal oscillator can provide accurate clock source for MCU (Microcontroller Unit, microcontrol Unit or single chip microcomputer) to maintain system operation, which is greatly affected by the environment, especially the temperature change. Optional OCXO – thermostatic crystal oscillator, temperature characteristics up to 3ppb.

(3) Specific measures are as follows:

  • By extracting the GPS time information in RMC, we can get the time, minute and second, year, month and day, and assign the value to the system time with crystal oscillator as the clock source, so that the MCU system time is corrected to UTC time.
  • MCU uses the interrupt mechanism of IO to get the pulse time of PPS. Based on this, the millisecond and below time is cleared to zero, so as to correct the zero seconds of the system time.
  • Check the time, wait for 3 seconds, then compare the GPS time with the system time to see if it is consistent, and verify the situation of +1 second or -1 second that may occur when the PPS timing is full second.

As shown in the figure above, this is a sample of data from the post-time test. The EVENT function of GPS receiver and MCU were used to record the same signal pulse at the same time, and then the time was compared. The road sections tested included viaduct, shopping mall, loop line, street and other scenes. The test duration was 5 hours and 38 minutes, and the comparison results were as follows: SEC difference =0, microsecond difference <=4us.

3.3 Camera synchronization in the application of time synchronization system

Image data source is to collect the car sensors, camera, the collection have multiple cameras installed in the car, distributed in different locations of the roof platform, towards all directions, collection and road signs, POI, etc., the image information with matching position trajectory information to make as the map data, time synchronization system can only match these data.

Camera time synchronization structure of time synchronization system

As shown in the figure above, one of the applications of the time synchronization system is the structure of the camera time synchronization. In the case that the time system has been timed, the camera time synchronization method is briefly described:

(1) The camera works in the external trigger mode. MCU provides the trigger source, that is, the pulse signal, and records the pulse number.

(2) When the camera takes pictures, the exposure time will produce pulse output, which will be captured by MCU, and the time and sequence number of this moment will be recorded.

(3) The recorded time information and sequence number will be stored, and the storage of photos will correspond to the sequence number one by one. The time information can also be matched with the location track, so as to complete the correlation between photos and locations.

4. GPS timing exception handling

The above introduces the principle, method and process of GPS timing, which can complete the timing of time. However, the actual application scenario is complex and random. Because the process of GPS receiver from losing the lock to positioning is not fixed in time, equipment and environmental factors all have an impact. The system time of MCU with crystal oscillator as the clock source runs freely before the timing. These factors bring unknown conditions to the GPS timing. Here, some abnormal circumstances are listed.

4.1 PPS and crystal oscillator

As shown in the figure above, the alignment of PPS and crystal clock exists in three situations:

(1) The rising edge of PPS is aligned with the crystal oscillator clock, which is an ideal state. After the crystal oscillator is divided by frequency and doubled by frequency, it provides a perfect duration of 1 second for the MCU system time, but this kind of situation almost does not exist.

(2) The system time of MCU is slower than 1 second, PPS arrives and enters the next second, but the system time has not finished the current second, special processing is needed to terminate the whole second of the system time in advance and enter the zero time of the next second immediately. The unit of time information in seconds or above corresponds to “+1”.

(3) The system time of MCU is faster than 1 second. Before the arrival of PPS, the system time has entered the next second and has been running for a period of time. In this case, the system time should be returned to the zero moment of this second, and the seconds of time information need not “+1” or “-1”.

4.2 Time information of PPS and GPS

In general, PPS and GPS time information NMEA data are relatively stable in time interval, but there are some special cases. As shown in the figure above, the output time of the “gnRMC” statement is variable.

This situation can cause a time “jump back” phenomenon: When the time information arrives in 0.999 seconds, the time information contained in it is the current second. Before the time information transmission and parsing are completed, the PPS of the next second arrives, and the time enters the time of the next second zero. After a certain amount of time (generally within 100ms), the time information is given to the system time, and the second information is the time of the last second. So you have a second bounce.

There are many ways to deal with it, and you can think about it by yourself.

5. Summary

Knowing the principle and method of GPS timing, we can design a stable and high-precision time synchronization system. On this basis, we can try to use GPS devices from different manufacturers to test in a complex environment, make up for the differences and improve the timing method.

6. The appendix

PPS signal processing: anti – jamming, filtering clutter interference

GPS time signal level conversion

Crystal oscillator processing signal: control the clock voltage amplitude, isolated DC filtering