How do I configure the GPS Shield?

I have been trying to reconfigure my GPS chip to only output GPGLL NMEA messages, instead of its default flooding of numerous NMEA messages.

To do so, I’ve been following the Technical User’s Guide referenced by the GPS shield guide at https://github.com/DexterInd/DI_Arduino/tree/master/GPS_Shield

I’m simply using SPI to attempt configuring the GPS. The only slight modification I’ve made to my GPS shield is changing RX to pin 3. Using SoftwareSerial and the Arduino IDE, I have tried writing several iterations of the example strings in the Technical Guide to the Serial port. I haven’t seen a NACK or ACK from the GPS. Or, If I do, the serial monitor fails to display the characters properly.

I can assure you the GPS is functional, because I can already read from it.

Here is a somewhat messy example of the messages I’ve tried sending. Many of them are commented out.

#include "string.h"
// #include "SoftwareSerial.h" //already included in header file
#include "dGPS.h"
------------------------------------

dGPS dgps = dGPS();               // Construct dGPS class

void setup() {
  Serial.begin(9600);
                               // Sets our mandatory bitrate. May change later. Use 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200
  dgps.init();                   // Run initialization routine for dGPS.
  delay(50);
  //dgps.update();    // Calling this updates the GPS data.  The data in dGPS variables stays the same unless
                                  // Update not reserved C++ word.  When this function is called, the data is updated.
     
  delay(1000);
  
  //dgps.update();
  //delay(1000);
  //dgps.update();
  //delay(1000);
  //byte message[] = {0xA0, 0xA1, 0x00, 0x09, 0x08, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0D, 0x0A};
  //Serial.write(message, sizeof(message));


//configure nmea, decimal
uint8_t one = 160;
uint8_t two = 161;
uint8_t three = 0;
uint8_t four = 9;
uint8_t five = 8;
uint8_t six = 0;
uint8_t seven = 0;
uint8_t eight = 0;
uint8_t nine = 1;
uint8_t ten = 0;
uint8_t eleven = 0;
uint8_t twelve = 0;
uint8_t Thirteen = 0;
uint8_t Fourteen = 8;
uint8_t Fifteen = 13;
uint8_t Sixteen = 10;
//Serial.write("160 161 0 9 8 0 0 0 1 0 0 0 0 8 13 10");

Serial.print(one);
delay(100);
Serial.print(two);
delay(100);
Serial.print(three);
delay(100);
Serial.print(four);
delay(100);
Serial.print(five);
delay(100);
Serial.print(six);
delay(100);
Serial.print(seven);
delay(100);
Serial.print(eight);
delay(100);
Serial.print(nine);
delay(100);
Serial.print(ten);
delay(100);
Serial.print(eleven);
delay(100);
Serial.print(twelve);
delay(100);
Serial.print(Thirteen);
delay(100);
Serial.print(Fourteen);
delay(100);
Serial.print(Fifteen);
delay(100);
Serial.print(Sixteen);
delay(2000);

//NMEA (HEX)
//Serial.write(0xA0);
//Serial.write(0xA1);
//Serial.write(0x00);
//Serial.write(0x09);
//Serial.write(0x08);
//Serial.write(0x00);
//Serial.write(0x00);
//Serial.write(0x00);
//Serial.write(0x01);
//Serial.write(0x00);
//Serial.write(0x00);
//Serial.write(0x00);
//Serial.write(0x00);
//Serial.write(0x08);
//Serial.write(0x0D);
//Serial.write(0x0A);
//delay(500);

//Reset Factory Defaults
//Serial.write(0xA0);
//Serial.write(" ");
//Serial.write(0xA1);
//Serial.write(" ");
//Serial.write(0x00);
//Serial.write(" ");
//Serial.write(0x02);
//Serial.write(" ");
//Serial.write(0x04);
//Serial.write(" ");
//Serial.write(0x00);
//Serial.write(" ");
//Serial.write(0x04);
//Serial.write(" ");
//Serial.write(0x0D);
//Serial.write(" ");
//Serial.write(0x0A);

//byte reset[] = {0xA0, 0xA1, 0x00, 0x02, 0x04, 0x01, 0x04, 0x0D, 0x0A};
//Serial.write(reset, sizeof(reset));

////SET FACTORY DEFAULTS (DECIMAL)
//delay(1000);
//Serial.write(160);
//delay(50);
//Serial.write(161);
//delay(50);
//Serial.write(00);
//delay(50);
//Serial.write(02);
//delay(50);
//Serial.write(04);
//delay(50);
//Serial.write(00);
//delay(50);
//Serial.write(04);
//delay(50);
//Serial.write(13);
//delay(50);
//Serial.write(10);
//delay(500);
//Serial.println("The string has been transmitted");



}

void loop() {
 
    delay(100);
    dgps.update();        // this function is called.  When this function is called, the data is updated.   
  Serial.println(""); 
  delay(1000);

//
////Configure Serial Port to COM3 w/ 9600 baud rate w/ update to SRAM &FLASH
//Serial.write(0xA0);
//Serial.write(0xA1);
//Serial.write(0x00);
//Serial.write(0x04);
//Serial.write(0x03);
//Serial.write(0x01);
//Serial.write(0x01);
//Serial.write(0x0D);
//Serial.write(0x0A);
//
//    dgps.update();        // this function is called.  When this function is called, the data is updated.   
//  Serial.println(""); 
//  delay(1000);
//
//    dgps.update();        // this function is called.  When this function is called, the data is updated.   
//  Serial.println(""); 
//  delay(1000);
//
////Configure NMEA messsage to only GLL at 1s intervals
//Serial.write(0xA0);
//Serial.write(0xA1);
//Serial.write(0x00);
//Serial.write(0x09);
//Serial.write(0x08);
//Serial.write(0x00); 
//Serial.write(0x00);
//Serial.write(0x00);
//Serial.write(0x01);
//Serial.write(0x00);
//Serial.write(0x00);
//Serial.write(0x00);
//Serial.write(0x00);
//Serial.write(0x08);
//Serial.write(0x0D);
//Serial.write(0x0A);
//delay(1000);

(I already suspect I shouldn’t loop the messages)
I’ll attach my header and CPP file. I will note that I change the size of “conta” to 2 when I attempt to read the response from the GPS.

Do you know of a message format that effectively configures the GPS?
Do I need a different hardware setup? Or software?

Thank you tremendously for your help.
Alex

Header:

#include "SoftwareSerial.h"
#include "Arduino.h" //As far as I can tell, this allows use of the pinMode() function.
//perhaps Arduino.h can be removed later.

#ifndef dGPS_h
#define dGPS_h

class dGPS
{
  public:
  dGPS();
  void init();
  bool update();



  private:
  char lineA[300];
  int conta;
  char comandoGPR[7];
  
};

#endif

CPP:

#include "dGPS.h"
#include "Arduino.h"
#include "math.h"
#define MAX_STRING_LEN  300

SoftwareSerial gpsSerial = SoftwareSerial (3, 4); //3 = rx, 4 = tx

dGPS::dGPS()
{
  conta = 0;
//  comandoGPR[0] = '$';
//  comandoGPR[1] = 'G';
//  comandoGPR[2] = 'P';
//  comandoGPR[3] = 'R';
//  comandoGPR[4] = 'M';
//  comandoGPR[5] = 'C';
}

void dGPS::init(){
  gpsSerial.begin(9600); //start serial for communication with GPS
 memset(lineA, ' ', sizeof(lineA)); //So, this is copying SPACES to the first "lineA" length of characters
                                    //to the variable "lineA"
                                    //Essentially clearing variable lineA. Not clearing causes double writes
}

bool dGPS::update(){
 while(true){
  int byteGPS=-1;
  byteGPS=gpsSerial.read();      //read a byte from the serial port
  if (byteGPS == -1) {           // See if the port is empty yet
    delay(5); 
  }
  else {
    lineA[conta]=byteGPS;
    conta++;
    if (conta == 50) {
          Serial.print("");
          Serial.print("");  
          Serial.println(lineA);
          conta=0;
          memset(lineA, 0, sizeof(lineA));
           break;  //THIS IS MANDATORY?
    }
  
  }
 } // END WHILE STATEMENT
return true;
}

Hey Alex, this is interesting. The chip, as it ships, will only send out once-per-second string of GPS coordinates in NMEA. We haven’t ever tried to change the output from the chip though. I think you’re trying to dive into the firmware instructions for the chip?

Hi John,
Thank you for your response. I suppose you could ignore the code for now (sorry!). I have some more straightforward questions:

Can you confirm the GPS receives serial data through pin 4?
And I don’t suppose the board has a chip select pin, meaning it can only communicate through UART?
Is http://www.skytraq.com.tw/ the website for the Venus 6 chip manufacturer you use (skytraq)?

Thank you so much,
Alex

Hi @AlexM,

So the GPS you have:

  1. Receives serial data through pin 4.

  2. Transmits serial data through pin 10.


And I don’t suppose the board has a chip select pin, meaning it can only communicate through UART?

No, I don’t think so. @JohnC can you confirm this?

Is http://www.skytraq.com.tw/ the website for the Venus 6 chip manufacturer you use (skytraq)?

That’s correct. The Venus 6 chip is being produced by Skytraq.

Thank you!