nRF9160 NMEA date

Hello

I am using nRF9160 to synchronise date and time of an RTC in another module using nRF GPS and 1PPS outputs.

My desired accuracy is within 10 milliseconds.

I have observed that PVT event date and time is not provided until a valid fix is achieved with 4x satellites which can take some time.

I have observed that NMEA string provides time as soon as the module detects a single satellite which is generally faster however I have been unable to find a way to get date at this point.

Is there a way to get date from NMEA or when only a single satellite is available?

I would prefer to use only GPS for this rather than involve  LTE.

Thanks for any guidance in advance.

Parents Reply Children
  • Thanks for providing this information. I've had our expert comment on this, and he informs that the NMEA time is just counting seconds from the start until the first fix. Can you double check if you are really seeing time or just the count from zero seconds upwards.Are you able to provide the NMEA information string you are seeing?

    Kind regards,
    Øyvind

  • Hello,

    When I first activate the nRF9160 I see seconds counting up from 00:00:00 until I get my first "in-fix" satellite and then I start to see valid UTC time from NMEA events. Once I have 4x "in-fix" satellites and get an actual fix I start to see valid UTC date and time from PVT events.

    This can be reproduced by modifying https://academy.nordicsemi.com/courses/cellular-iot-fundamentals/lessons/lesson-6-cellular-fundamentals/topic/lesson-6-exercise-1/ with...

    1. Subscribe to NMEA events with command nrf_modem_gnss_nmea_mask_set(NRF_MODEM_GNSS_NMEA_GGA_MASK).
    2. Add NRF_MODEM_GNSS_EVT_NMEA event within gnss_event_handler().
    3. Within NRF_MODEM_GNSS_EVT_NMEA event read the NMEA string with 
      nrf_modem_gnss_read((void *)&nmea, sizeof(nmea), NRF_MODEM_GNSS_DATA_NMEA) and then outut the string via LOG_INF() or equivalent.
  • Its best to have a mediocre/poor GNSS signal when testing so that you are more likely to get a period of between 1x and 3x "in-fix" satellites during which NMEA events occur before getting a valid fix with a PVT event.

  • An extract from my debug output is below. You can see the NMEA counting up from 000000.00 and then once gets a single satellite "in-fix" it gets UTC (10:23:00.54). If I leave it longer the GNSS output will get a date and time once start getting valid PVT/GNSS fixes.

    [00:00:49.578,338] <inf> main: SV: 3 sig: 1 c/n0: 273 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:49.578,369] <inf> main: SV: 21 sig: 1 c/n0: 271 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:49.578,369] <inf> main: SV: 1 sig: 1 c/n0: 0 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:49.578,399] <inf> main: GNSS: 05/01/1980 23:59:42.000 0.000000,0.000000,0.000000
    [00:00:49.578,491] <inf> main: NMEA: $GPGGA,000049.00,,,,,0,,99.99,,M,,M,,*6B

    [00:00:50.578,033] <inf> main: SV: 3 sig: 1 c/n0: 275 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:50.578,094] <inf> main: SV: 21 sig: 1 c/n0: 268 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:50.578,094] <inf> main: SV: 1 sig: 1 c/n0: 73 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:50.578,125] <inf> main: GNSS: 05/01/1980 23:59:42.000 0.000000,0.000000,0.000000
    [00:00:50.578,186] <inf> main: NMEA: $GPGGA,000050.00,,,,,0,,99.99,,M,,M,,*63

    [00:00:51.578,308] <inf> main: SV: 3 sig: 1 c/n0: 277 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:51.578,308] <inf> main: SV: 21 sig: 1 c/n0: 268 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:51.578,338] <inf> main: SV: 1 sig: 1 c/n0: 0 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:51.578,369] <inf> main: GNSS: 05/01/1980 23:59:42.000 0.000000,0.000000,0.000000
    [00:00:51.578,430] <inf> main: NMEA: $GPGGA,000051.00,,,,,0,,99.99,,M,,M,,*62

    [00:00:52.578,704] <inf> main: SV: 3 sig: 1 c/n0: 279 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:52.578,735] <inf> main: SV: 21 sig: 1 c/n0: 260 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:52.578,765] <inf> main: SV: 1 sig: 1 c/n0: 55 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:52.578,796] <inf> main: GNSS: 05/01/1980 23:59:42.000 0.000000,0.000000,0.000000
    [00:00:52.578,857] <inf> main: NMEA: $GPGGA,000052.00,,,,,0,,99.99,,M,,M,,*61

    [00:00:53.587,432] <inf> main: SV: 3 sig: 1 c/n0: 280 el: 0 az: 0 in-fix: 1 unhealthy: 0
    [00:00:53.587,432] <inf> main: SV: 21 sig: 1 c/n0: 260 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:53.587,463] <inf> main: SV: 1 sig: 1 c/n0: 0 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:53.587,493] <inf> main: GNSS: 05/01/1980 23:59:42.000 0.000000,0.000000,0.000000
    [00:00:53.587,554] <inf> main: NMEA: $GPGGA,102300.54,,,,,0,01,99.99,,M,,M,,*66

    [00:00:54.579,498] <inf> main: SV: 3 sig: 1 c/n0: 280 el: 0 az: 0 in-fix: 1 unhealthy: 0
    [00:00:54.579,528] <inf> main: SV: 21 sig: 1 c/n0: c/n0l: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:54.579,559] <inf> main: SV: 1 sig: 1 c/n0: 25 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:54.579,559] <inf> main: GNSS: 05/01/1980 23:59:42.000 0.000000,0.000000,0.000000
    [00:00:54.579,650] <inf> main: NMEA: $GPGGA,102301.54,,,,,0,01,99.99,,M,,M,,*67

    [00:00:55.579,864] <inf> main: SV: 3 sig: 1 c/n0: 281 el: 0 az: 0 in-fix: 1 unhealthy: 0
    [00:00:55.579,895] <inf> main: SV: 21 sig: 1 c/n0: 251 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:55.579,895] <inf> main: SV: 1 sig: 1 c/n0: 0 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:55.579,925] <inf> main: SV: 23 sig: 1 c/n0: 251 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:55.579,956] <inf> main: GNSS: 05/01/1980 23:59:42.000 0.000000,0.000000,0.000000
    [00:00:55.580,291] <inf> main: NMEA: $GPGGA,102302.54,,,,,0,01,99.99,,M,,M,,*64

    [00:00:56.580,505] <inf> main: SV: 3 sig: 1 c/n0: 283 el: 0 az: 0 in-fix: 1 unhealthy: 0
    [00:00:56.580,535] <inf> main: SV: 21 sig: 1 c/n0: 249 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:56.580,535] <inf> main: SV: 1 sig: 1 c/n0: 70 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:56.580,566] <inf> main: SV: 23 sig: 1 c/n0: 246 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:56.580,596] <inf> main: GNSS: 05/01/1980 23:59:42.000 0.000000,0.000000,0.000000
    [00:00:56.580,657] <inf> main: NMEA: $GPGGA,102303.54,,,,,0,01,99.99,,M,,M,,*65

    [00:00:57.580,535] <inf> main: SV: 3 sig: 1 c/n0: 284 el: 0 az: 0 in-fix: 1 unhealthy: 0
    [00:00:57.580,535] <inf> main: SV: 21 sig: 1 c/n0: 242 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:57.580,566] <inf> main: SV: 1 sig: 1 c/n0: 70 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:57.580,566] <inf> main: SV: 23 sig: 1 c/n0: 243 el: 0 az: 0 in-fix: 0 unhealthy: 0
    [00:00:57.580,596] <inf> main: GNSS: 05/01/1980 23:59:42.000 0.000000,0.000000,0.000000
    [00:00:57.580,688] <inf> main: NMEA: $GPGGA,102304.54,,,,,0,01,99.99,,M,,M,,*62

  • Hi, the problem seems to be that you are looking at the wrong NMEA sentence. $GPGGA does not contain the date at all. You should be looking at $GPRMC which contains both time and date.

    It should be noted, though, that the accuracy of the time is guaranteed only after getting the first fix. Also, 1PPS pulses start only after the first fix.

    Kind regards,
    Øyvind

Related