alp@vilnius: ~ up since 2019 · Vilnius Download cv.pdf

← ALP-OS

alp ~ $ work zero-coords

700 trackers on Null Island

After a firmware update, 700 trackers sent positions at 0, 0 while claiming a GPS fix. The fix flag switched on before the NMEA data was stable. I made it wait, then fixed two older bugs that the wait exposed.

700 unitssent a GPS fix with zero coordinates

In 2024, after a firmware update, 700 trackers in the field started sending records with zero coordinates. The records said they had a GPS fix.

0, 0 is a spot in the Gulf of Guinea, known as Null Island. A record without a fix is just a gap. A record with a “fix” at 0, 0 is worse, because the server puts it on the map.

The flag moved too early

I reproduced it. The GPS fix signal switched to “fix” before NMEA stabilization had finished. Any record created in that window had a fix but no real position.

So I made the fix signal wait until NMEA is stable. In factory test mode the wait is skipped, so production tests stay fast.

A flag that never reset

While wiring that in, I found that the unstable-fix flag was never reset on sleep or on GPS loss, so it carried over into the next fix. I reworked it. The unstable-fix flag now only starts NMEA stabilization, and a separate “NMEA stable” flag feeds the fix filter, the same way the speed and altitude filters do.

What the wait exposed

The new delay uncovered an ordering bug. “Update good coordinates” ran before “update GPS fix state”, so coordinates changed while the status still said no fix, and went stale after ultra-deep sleep. I swapped the order, so coordinates only update on a stable fix, and the fix status now resets on sleep.

I also added GNSS status 4, “filter active”, so testers can see why coordinates are being held.

The fix flag waits for stable NMEA, and coordinates follow the fix state Schematic timeline, not to scale. Before: once the module gets a fix, NMEA goes through a stabilization window. The fix IO flipped to fix at the start of that window, so a record created inside it said fix and carried coordinates 0, 0. After: the fix IO flips only when NMEA is stable, so a record inside the window says no fix. Factory test mode skips the wait. Second part, the order of each GNSS update. Before: update good coordinates ran before update GPS fix state, so coordinates changed while the status still said no fix. After: the unstable-fix flag only starts NMEA stabilization. A separate NMEA stable flag feeds the fix filter together with the speed and altitude filters. The fix filter sets the GPS fix state first, and good coordinates update only when the fix is acquired and stable. Sleep resets the current fix status, and GNSS status 4, filter active, shows testers why coordinates are held. Test drives on 3 device families produced no zero-coordinate records. BEFORE · the fix IO flips while NMEA is still stabilizing schematic NMEA before fix stabilizing stable fix IO no fix fix (too early) fix record: fix = yes, coordinates 0, 0 AFTER · the fix IO waits for NMEA stable NMEA before fix stabilizing stable fix IO no fix fix record: fix = no Factory test mode skips the wait, so production test time stays short. ORDER IN EACH GNSS UPDATE before 1. good coordinates 2. GPS fix state coordinates change while the status says no fix after unstable-fix stabilize NMEA NMEA stable speed filter altitude filter fix filter 1. GPS fix state only if acquired and stable 2. good coordinates Sleep resets the current fix status. GNSS status 4, filter active, shows testers why coordinates are held. Test drives on 3 device families: no zero-coordinate records.
The fix flag waits for stable NMEA, and coordinates follow the fix state

Conclusion

Test drives on 3 device families produced no zero-coordinate records. All three fixes touch the same state, so I put them in one test firmware, and QA verified them together.

Adding a delay changes the order things happen in, and that brings hidden ordering bugs to the surface. The first fix was small. Most of the work was in what it uncovered.

Tags gnss field-bug