LS20031 GPS module with LPCXpresso Base Board

This project demonstrates how to use the GPS smart antenna module LS20031 with the LPC1343 LPCXpresso Board and the LPCXpresso Base Board.


GPS data on OLED display
Figure 1 - GPS data on OLED display

 

Required Parts

Preparation

The first thing that needs to be done is to solder four wires to the GPS module and then connect them to the expansion dual row header connector on the LPCXpresso Base Board. Table 1 specifies the Pin description of the GPS module and Figure 2 shows how the module is connected to the base board.

Pin # Name Type Description
1 VCC P Power input
2 RX I Data input (TTL level)
3 TX O Data output (TTL level)
4 GND P Ground
5 GND P Ground

Table 1 - PIN Description

RX on the module should be plugged in to PIO1_7-TDX on the base board and TX on the module should be plugged in to PIO1_6-RXD on the base board. VCC for LS20031 is Min 3V, Max 4.2V and Typ 3.3V.


GPS module connected to LPCXpresso Base Board
Figure 2 - GPS module connected to LPCXpresso Base Board

Description

The GPS module uses protocol NMEA 0183 ver. 3.01. There are six different NMEA output messages on the GPS:

  • GGA - Global positioning system fixed data
  • GLL - Geographic position – latitude/longitude
  • GSA - Global Navigation Satellite System (GNSS), DOP (dilution of precision) and active satellites
  • GSV - GNSS satellites in view
  • RMC - Recommended minimum specific GNSS data
  • VTG - Course over ground and ground speed

In our example we only use GGA. The output message is a text string and could look something like this: $GPGGA,173415.400,3514.5974,N,12037.2028,W,1,8,1.18, 84.6,M,-30.8,M,,*50

Comma e.g. ‘,’ is the divider between the different values. $GPGGA is the protocol header for GGA. Next we have the UTC time and then the latitude value and so on. More information on the different output messages can be found in the LS20031 datasheet.

One thing that is good to know is that the datasheet states that the GPS module uses 9600bps, but this did not work. A 5Hz GPS's need more bandwidth. At Sparkfun product page it states to use 57600bps, which works better.

Source code

This is how main() could look like. In main() we need to initiate timers if we want to use delays, install the GPIO interrupt handler, initialize SSP port routine, initialize and clear the OLED screen, if we want to use the joystick we need to initialize this as well and finally we need to initialize the UART to 57600 baud rate. The only thing left to do now is to parse out the data from the GPS module and show it on the OLED-display and that's the easy part.
 

  int main(void)
  {
    init_timer32(0, 10);
    GPIOInit();
    SSPInit();
    oled_init();
    oled_clearScreen(OLED_COLOR_WHITE);

   joystick_init();

   UARTInit(57600);

   while(1) {
     uint8_t joyState = joystick_read();
     if ((joyState & JOYSTICK_CENTER) != 0) {
       //Break the loop if joystick center is pressed	
       break;
     }

     parseGpsData();

     // Update every second
     delay32Ms(0, 1000);
    }
    return 1;
  }

                    

Import project into LPCXpresso IDE

Begin by importing the driver and sample application bundle (zip file) for the LPC1343 LPCXpresso Board found at the Embedded Artists support site.

  1. In the LPCXpresso IDE, Quickstart tab, choose Import Example project(s)
  2. Browse to the downloaded zip file (for example lpc1343_xpr_bb_100222.zip)
  3. Click finish to import the drivers and sample applications.

The second step is to import GPS module project. Do the same as when importing the drivers, but choose LS20031_gps_example.zip in step 2. To build or debug the example just click build/debug in the QuickStart tab

More information on how to work with the LPCXpresso Base Board as well as the LPCXpresso IDE can be found in the User's Manual for the LPCXpresso Base Board. This User's Manual can be found at the Embedded Artists support site.


Base Board overview
Figure 3 - Base Board overview with GPS module