Skip to content

Commit eb9dcef

Browse files
tokangasrlubos
authored andcommitted
samples: nrf9160: gnss: add TTFF test mode
Added time-to-first-fix (TTFF) test mode. It can be used to run TTFF tests for GNSS cold, warm or hot starts, with or without assistance. Signed-off-by: Tommi Kangas <[email protected]>
1 parent db2a3fc commit eb9dcef

File tree

4 files changed

+275
-39
lines changed

4 files changed

+275
-39
lines changed

doc/nrf/releases/release-notes-changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ nRF9160 samples
138138
* :ref:`gnss_sample` sample:
139139

140140
* Added support for minimal assistance using factory almanac, time and location.
141+
* Added support for TTFF test mode.
141142

142143
* nRF9160: HTTP update samples:
143144

samples/nrf9160/gnss/Kconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ config GNSS_SAMPLE_MODE_CONTINUOUS
1616
config GNSS_SAMPLE_MODE_PERIODIC
1717
bool "Periodic fixes"
1818

19+
config GNSS_SAMPLE_MODE_TTFF_TEST
20+
bool "Time-to-first-fix (TTFF) test mode"
21+
select GNSS_SAMPLE_NMEA_ONLY
22+
1923
endchoice
2024

2125
if GNSS_SAMPLE_MODE_PERIODIC
@@ -37,6 +41,20 @@ config GNSS_SAMPLE_PERIODIC_TIMEOUT
3741

3842
endif # GNSS_SAMPLE_MODE_PERIODIC
3943

44+
if GNSS_SAMPLE_MODE_TTFF_TEST
45+
46+
config GNSS_SAMPLE_MODE_TTFF_TEST_COLD_START
47+
bool "Delete GNSS data before each start (cold start)"
48+
help
49+
When enabled, deletes all stored data from GNSS to force a cold start every time GNSS is started.
50+
51+
config GNSS_SAMPLE_MODE_TTFF_TEST_INTERVAL
52+
int "Time to wait between TTFF tests in seconds"
53+
range 1 604800
54+
default 120
55+
56+
endif # GNSS_SAMPLE_MODE_TTFF_TEST
57+
4058
config GNSS_SAMPLE_NMEA_ONLY
4159
bool "Output only NMEA strings"
4260
help

samples/nrf9160/gnss/README.rst

Lines changed: 83 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,36 @@ Because `NMEA`_ data needs to be read as soon as an NMEA event is received, a :r
3333
The event handler function reads the received NMEA strings and puts those into the message queue.
3434
The consumer loop reads from the queue and outputs the strings to the console.
3535

36+
Operation modes
37+
===============
38+
39+
The sample supports different operation modes:
40+
41+
* Continuous
42+
* Periodic
43+
* Time-to-first-fix (TTFF) test
44+
3645
By default, the sample runs in continuous tracking mode.
37-
You can also configure it to run in periodic mode, where fixes are acquired periodically with the set interval.
46+
In continuous mode, GNSS tries to acquire a fix once a second.
47+
48+
In periodic mode, fixes are acquired periodically with the set interval.
49+
50+
In TTFF test mode, the sample acquires fixes periodically and calculates the TTFF for each fix.
51+
You can use the TTFF test mode without assistance or with any supported assistance method.
52+
You can also configure it to perform cold starts, where the stored data is deleted from GNSS before each start.
53+
If you enable assistance with cold starts, new assistance data is also downloaded and injected to GNSS before each start.
3854

3955
Output modes
4056
============
4157

42-
This sample operates in two different output modes.
58+
The sample supports two output modes:
59+
60+
* Position, Velocity, and Time (PVT) and NMEA
61+
* NMEA-only
4362

44-
In the default mode, the sample displays information from both PVT (Position, Velocity, and Time) and NMEA strings.
45-
You can also configure the sample to run in NMEA-only mode, where only the NMEA strings are displayed in the console.
46-
In the NMEA-only mode, you can visualize the data from the GNSS using a third-party tool.
63+
By default, the sample displays information from both PVT and NMEA strings.
64+
You can also configure the sample to run in NMEA-only output mode, where only the NMEA strings are displayed in the console.
65+
In the NMEA-only output mode, you can visualize the data from the GNSS using a third-party tool.
4766

4867
A-GPS and P-GPS
4968
===============
@@ -52,7 +71,6 @@ When support for A-GPS or P-GPS, or both, is enabled, a :ref:`Zephyr workqueue <
5271
Downloading the data can take some time.
5372
The workqueue ensures that the main thread is not blocked during the operation.
5473

55-
You can enable A-GPS and P-GPS support for both the default mode (PVT and NMEA) and the NMEA-only mode.
5674
When assistance support is enabled, the sample receives an A-GPS data request notification from the GNSS module, and it starts downloading the assistance data requested by the GNSS module.
5775
The sample then displays the information in the terminal about the download process.
5876
Finally, after the download completes, the sample switches back to the previous display mode.
@@ -80,8 +98,8 @@ Check and configure the following configuration options for the sample:
8098

8199
.. _CONFIG_GNSS_SAMPLE_NMEA_ONLY:
82100

83-
CONFIG_GNSS_SAMPLE_NMEA_ONLY - To enable NMEA-only mode
84-
The NMEA-only mode can be used for example with 3rd party tools to visualize the GNSS output.
101+
CONFIG_GNSS_SAMPLE_NMEA_ONLY - To enable NMEA-only output mode
102+
The NMEA-only output mode can be used for example with 3rd party tools to visualize the GNSS output.
85103

86104
.. _CONFIG_GNSS_SAMPLE_ANTENNA_EXTERNAL:
87105

@@ -104,6 +122,16 @@ CONFIG_GNSS_SAMPLE_MODE_PERIODIC - To enable periodic fixes
104122
This configuration option enables periodic fixes instead of continuous tracking.
105123
Set :kconfig:`CONFIG_GNSS_SAMPLE_PERIODIC_INTERVAL` and :kconfig:`CONFIG_GNSS_SAMPLE_PERIODIC_TIMEOUT` to configure the desired fix interval and timeout.
106124

125+
.. _CONFIG_GNSS_SAMPLE_MODE_TTFF_TEST:
126+
127+
CONFIG_GNSS_SAMPLE_MODE_TTFF_TEST - To enable time-to-first-fix (TTFF) test mode
128+
This configuration enables the TTFF test mode instead of continuous tracking.
129+
When TTFF test mode is enabled, the :ref:`CONFIG_GNSS_SAMPLE_NMEA_ONLY <CONFIG_GNSS_SAMPLE_NMEA_ONLY>` option is automatically selected.
130+
Set the :kconfig:`CONFIG_GNSS_SAMPLE_MODE_TTFF_TEST_INTERVAL` option to configure the time between fixes.
131+
If you have enabled the :kconfig:`CONFIG_GNSS_SAMPLE_MODE_TTFF_TEST_COLD_START` option, the sample will perform GNSS cold starts instead of hot starts.
132+
When assistance is used, LTE may block the GNSS operation and increase the time needed to get a fix.
133+
You can set the :kconfig:`CONFIG_GNSS_SAMPLE_LTE_ON_DEMAND` option to disable LTE after the assistance data has been downloaded, so that GNSS can run without interruptions.
134+
107135
Building and running
108136
********************
109137

@@ -121,10 +149,10 @@ Testing
121149
After programming the sample and all the prerequisites to the development kit, you can test the sample by performing the following steps:
122150

123151
1. Connect your nRF9160 DK to the PC using a USB cable and power on or reset your nRF9160 DK.
124-
2. Open a terminal emulator.
152+
#. Open a terminal emulator.
125153
#. Test the sample by performing the following steps:
126154

127-
If the default mode is enabled:
155+
If the default output mode is enabled:
128156

129157
a. Observe that the following information is displayed in the terminal emulator:
130158

@@ -167,15 +195,15 @@ After programming the sample and all the prerequisites to the development kit, y
167195
168196
NMEA strings:
169197
170-
$GPGGA,054824.58,6128.77008,N,02351.48387,E,1,07,2.05,116.27,M,0,,*22
198+
$GPGGA,054824.58,6129.28608,N,02346.17887,E,1,07,2.05,116.27,M,0,,*22
171199
$GPGLL,6129.28608,N,02346.17887,E,054824.58,A,A*6B
172200
$GPGSA,A,3,10,12,17,24,28,,,,,,,,3.05,2.05,2.25,1*13
173201
$GPGSV,2,1,7,17,50,083,41,24,68,250,38,10,14,294,46,28,23,071,38,1*56
174202
$GPGSV,2,2,7,12,29,240,36,19,00,000,32,1,00,000,33,1*50
175203
$GPRMC,054824.58,A,6129.28608,N,02346.17887,E,0.08,0.00,030620,,,A,V*29
176204
---------------------------------
177205
178-
If NMEA-only mode is enabled:
206+
If NMEA-only output mode is enabled:
179207

180208
a. Observe that the following information is displayed in the terminal emulator:
181209

@@ -197,6 +225,48 @@ After programming the sample and all the prerequisites to the development kit, y
197225
$GPGSV,1,1,2,17,,,24,1,,,28,1*6D
198226
$GPRMC,000002.00,V,,,,,,,060180,,,N,V*0A
199227
228+
If TTFF test mode is enabled:
229+
230+
a. Observe that the following information is displayed in the terminal emulator:
231+
232+
.. code-block:: console
233+
234+
$GPGGA,000033.00,,,,,0,,99.99,,M,,M,,*66
235+
$GPGLL,,,,,000033.00,V,N*4A
236+
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,1*2D
237+
$GPGSV,3,1,10,1,,,36,5,,,26,7,,,25,10,,,44,1*53
238+
$GPGSV,3,2,10,14,,,43,17,,,37,21,,,41,23,,,43,1*64
239+
$GPGSV,3,3,10,24,,,31,28,,,39,1*61
240+
$GPRMC,000033.00,V,,,,,,,060180,,,N,V*08
241+
$GPGGA,121300.68,6129.28608,N,02346.17887,E,1,05,2.41,123.44,M,,M,,*7A
242+
$GPGLL,6129.28608,N,02346.17887,E,121300.68,A,A*63
243+
$GPGSA,A,3,01,10,17,21,23,,,,,,,,6.32,2.41,5.84,1*12
244+
$GPGSV,4,1,14,1,17,047,37,7,-22,107,25,10,22,314,44,12,09,232,,1*41
245+
$GPGSV,4,2,14,13,29,173,,14,38,072,44,15,40,211,,17,46,106,37,1*65
246+
$GPGSV,4,3,14,19,35,139,,21,15,019,41,23,19,279,42,24,51,273,32,1*6F
247+
$GPGSV,4,4,14,28,,,39,30,00,110,,1*52
248+
$GPRMC,121300.68,A,6129.28608,N,02346.17887,E,0.10,0.00,200122,,,A,V*2C
249+
[00:00:34.790,649] <inf> gnss_sample: Time to fix: 34
250+
[00:00:34.796,447] <inf> gnss_sample: Sleeping for 120 seconds
251+
[00:02:34.699,493] <inf> gnss_sample: Starting GNSS
252+
$GPGGA,121500.82,,,,,0,,99.99,,M,,M,,*6B
253+
$GPGLL,,,,,121500.82,V,N*47
254+
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99,1*2D
255+
$GPGSV,1,1,0,,,,,,,,,,,,,,,,,1*54
256+
$GPRMC,121500.82,V,,,,,,,200122,,,N,V*09
257+
$GPGGA,121501.82,6129.28608,N,02346.17887,E,1,04,2.73,118.22,M,,M,,*78
258+
$GPGLL,6129.28608,N,02346.17887,E,121501.82,A,A*69
259+
$GPGSA,A,3,10,17,21,23,,,,,,,,,7.59,2.73,7.08,1*18
260+
$GPGSV,4,1,13,1,18,046,28,10,22,313,49,12,10,232,26,13,28,173,25,1*51
261+
$GPGSV,4,2,13,14,37,072,50,15,40,211,25,17,46,105,45,19,35,138,31,1*63
262+
$GPGSV,4,3,13,21,15,018,45,23,18,278,45,24,52,273,,28,,,44,1*57
263+
$GPGSV,4,4,13,30,00,110,,1*55
264+
$GPRMC,121501.82,A,6129.28608,N,02346.17887,E,0.16,0.00,200122,,,A,V*20
265+
[00:02:35.940,582] <inf> gnss_sample: Time to fix: 1
266+
[00:02:35.946,319] <inf> gnss_sample: Sleeping for 120 seconds
267+
268+
#. Observe that the samples displays the time to fix for each fix.
269+
200270
If A-GPS and/or P-GPS support is enabled:
201271

202272
a. Observe that the following message is displayed in the terminal emulator immediately after the device boots:
@@ -205,7 +275,7 @@ After programming the sample and all the prerequisites to the development kit, y
205275
206276
[00:00:04.488,494] <inf> gnss_sample: Assistance data needed, ephe 0xffffffff, alm 0xffffffff, flags 0x3b
207277
208-
b. Observe the following actions in the terminal emulator:
278+
#. Observe the following actions in the terminal emulator:
209279

210280
i. The sample downloads the requested assistance data if needed (with P-GPS, the data may already be available in the flash memory).
211281
#. The sample continues after the download has completed.

0 commit comments

Comments
 (0)