jerabaul29 / interrupt_GPS_synchronization

using GPS PPS synchronization for high-accuracy timing on MCU
MIT License
0 stars 0 forks source link

high-accuracy clock system using GPS #1

Open jerabaul29 opened 4 years ago

jerabaul29 commented 4 years ago

@jvoermans I have unfortunately no GPS breakout for debugging / testing... Can you help me a bit?

Could you:

https://github.com/jerabaul29/interrupt_GPS_synchronization/blob/630fe059a415b19f7c4d920e2101dffff564b3b2/interrupt_catch_micro/src/main.cpp#L20-L45

if (SERIAL_GPS.available()>0){
  char c_GPS = SERIAL_GPS.read();
  Serial.print(c_GPS);

  if (c_GPS=='\n'){
    Serial.print(F("newline at "));
    Serial.println(micros());
  }
}

The reason for that is that I want to know when the PPS output is set high by the GPS receiver. Guess this is just before the serial transmission happens, but want to check.

jerabaul29 commented 4 years ago

(and show me the serial output you get on the computer).

jvoermans commented 4 years ago

Sorry, bit confused. What should I do with pin 2? And regarding the PPS, I assume I should read the output of the digital pin then?

jerabaul29 commented 4 years ago

You can put pin 2 connected to PPS and otherwise loge the GPS as I show.

When a rising / falling edge is applied on 2 from PPS this will trigger an interrupt and measure time very accurately.

jerabaul29 commented 4 years ago

Actually, when running this with the GPS, can you use RISING instead of FALLING?

jvoermans commented 4 years ago

@jerabaul29 Could you explain in words exactly what is happening in this sketch? I uploaded it to the mega without issues. Serial monitor gives 'micros' after each GPRMC and GPGGA message. But what do they mean exactly? I assume the micros correspond to the instant at which the GPRMS message and GPGGA message were received, but how does this then related to UTC?

I understand that the rise of the PPS signal corresponds to the start of the UTC seconds. So identifying the instant the PPS rises to 3.3V and relating this to the micros time stamp gives a reference of time for all the measurements. So if we get this reference at a certain frequency, say once every 10-30 minutes, than the timeseries of the different instruments can be matched.

jerabaul29 commented 4 years ago

So basically:

gauteh commented 3 years ago

Noticed this, I implemented something similar a while ago that might be of interest: https://github.com/gauteh/sonobuoy-gautebuoy/blob/master/buoy/gps.cpp#L99