When using GNSS periodic mode with nrf_modem_gnss_fix_interval_set() set to 20 minutes and nrf_modem_gnss_fix_retry_set() to 5 minutes, the actual wake-up intervals are inconsistent:
- When fix is obtained: Next wake-up occurs after ~2 minutes 43 seconds instead of 20 minutes
- When fix times out: Next wake-up occurs correctly after ~20 minutes
The application stops and restarts periodic mode at various points during operation. (this is a measure for when a fix is not found for 2 tries it will only try x hours later)
Expected Behavior
GNSS should wake up every 20 minutes in periodic mode, regardless of whether the previous attempt obtained a fix or timed out.
Observed Behavior
Case 1: Successful Fix (Incorrect Interval)
[06:25:57.647] GNSS woke up in periodic mode
[06:29:01.568] GNSS fix event
[06:29:01.579] GNSS enters sleep because fix was achieved
[06:31:44.748] GNSS woke up in periodic mode // Only ~2min 43s later!
Actual interval: ~2 minutes 43 seconds (expected: 20 minutes)
Case 2: Fix Timeout (Correct Interval)
[03:05:56.691] GNSS woke up in periodic mode
[03:10:56.696] GNSS enters sleep because fix retry timeout reached
[03:25:56.746] GNSS woke up in periodic mode // ~20 minutes later ✓
Actual interval: ~20 minutes (as expected)
Configuration
// Function to initialize (or reinit) the GNSS
int gnss_init_and_start(void)
{
nrf_modem_gnss_event_handler_set(gnss_event_handler);
nrf_modem_gnss_fix_interval_set(CONFIG_TRACKER_PERIODIC_INTERVAL); // 20 minutes (1200 seconds)
nrf_modem_gnss_fix_retry_set(CONFIG_TRACKER_PERIODIC_TIMEOUT); // 5 minutes (300 seconds)
nrf_modem_gnss_start();
nrf_modem_gnss_prio_mode_enable();
}
// Function to stop the GNSS
int gnss_stop()
{
int err = nrf_modem_gnss_stop();
if(err == 0) {
gnss_active = false;
}
return err;
}
Note: Periodic mode is stopped and restarted at various points during operation.
Environment
- nRF Connect SDK version: [3.0.2]
- Hardware: [nRF9151 DK / Thingy:91X]