GPS NMEA sentence reader for Nucleo boards.

Dependencies:   mbed MODSERIAL

I had a lot of trouble getting other GPS examples to work. So I took Edoardo De Marchi's code from 2014 and hacked it until it was working on newer hardware.

Advice:

  • Start with confirming the module works in U-Center, and know the baud rate. Many older libraries assume 9600. Newer modules run at higher baud rates
  • Use a good terminal program and confirm you have human readable messages starting with "$GNGGA" or "$GPGSV" or similar.

Comments in code include links to NMEA sentence guides:

Most libraries do not include sentence filters for the types of sentences output by my M8N (and perhaps other modules as well)

Most older versions of the MODSERIAL library do not update properly to support STM32. I have found and included a version of the lib which will compile without errors. However, when using it in my code, the NMEA sentence gets corrupted somehow (for example showing some HUGE [6 digit] Satellite count, etc.

Committer:
edodm85
Date:
Fri Aug 22 12:43:55 2014 +0000
Revision:
1:acd907fbcbae
Parent:
0:ea14ad6794af
Added support for LPC4330

Who changed what in which revision?

UserRevisionLine numberNew contents of line
edodm85 0:ea14ad6794af 1 #pragma once
edodm85 0:ea14ad6794af 2 #include "mbed.h"
edodm85 0:ea14ad6794af 3 #include "MODSERIAL.h"
edodm85 0:ea14ad6794af 4
edodm85 0:ea14ad6794af 5 MODSERIAL pc(USBTX,USBRX);
edodm85 0:ea14ad6794af 6
edodm85 1:acd907fbcbae 7 #if defined(TARGET_LPC1768)
edodm85 1:acd907fbcbae 8 MODSERIAL gps(p13, p14);
edodm85 1:acd907fbcbae 9 #elif defined(TARGET_LPC4330_M4)
edodm85 1:acd907fbcbae 10 MODSERIAL gps(UART0_TX, UART0_RX);
edodm85 1:acd907fbcbae 11 #endif
edodm85 0:ea14ad6794af 12
edodm85 0:ea14ad6794af 13
edodm85 0:ea14ad6794af 14 char cDataBuffer[500];
edodm85 0:ea14ad6794af 15 int i = 0;
edodm85 0:ea14ad6794af 16
edodm85 0:ea14ad6794af 17
edodm85 0:ea14ad6794af 18 void Init();
edodm85 0:ea14ad6794af 19 void parse(char *cmd, int n);