@philip max yeah, direct-write-per-sentence at 18Hz is going to bite you — SD cards have write latency that's all over the place depending on the card, and even a "fast" card will stall occasionally while it's doing internal housekeeping. At 18Hz you've got about 55ms between fixes, and some SD write cycles can eat 50-150ms on their own, so you're basically gambling every cycle.
The pattern that works reliably is a circular buffer in RAM sized to hold maybe 1-2 seconds worth of NMEA data, then writing to SD in chunks aligned to the card's sector size (512 bytes is the sector, but you want to write in multiples — 4KB blocks tend to be the sweet spot for throughput without wasting too much RAM). Your DMA feeds into the circular buffer, and a lower-priority task or timer callback drains it to SD when there's a full block ready. That way a slow SD write never blocks the receive path.
One thing worth flagging: the card itself matters a lot here. Industrial or "dashcam" rated cards handle sustained sequential writes much better than standard Class 10 consumer cards — the latter can have write amplification issues that cause random stalls. If you're seeing drops even with a decent buffer, try swapping the card before assuming it's a firmware problem.
If you want to get really clean about it, you can add a simple sequence counter to each logged fix so you can detect gaps in post-processing even if you do drop something — makes it easy to audit a long session and know exactly where any holes are rather than guessing.