ZakKemble / GPRS_C_SDK

Ai-Thinker A9/A9G GPRS (with GPS(A9G)) module C development SDK
MIT License
20 stars 12 forks source link

Corrupted NMEA messages might mess up the GPS parser #2

Closed ZakKemble closed 4 years ago

ZakKemble commented 4 years ago

The GPS parser looks for the VTG NMEA message in each NMEA frame received from the GPS receiver to determine the end of the frame (this isn't very good since VTG can be in different places depending on what receiver is used). If the message ID "VTG" or the new line at the end of the VTG message "\r\n" is corrupted, like from GSM interference on the UART lines, the parser won't find the message and the buffer is left unchanged since it doesn’t think the entire NMEA frame has been received yet. If the VTG message is corrupted for a few frames in a row then the buffer will fill up and is never cleared, and new frames won't be added to the buffer and processed.