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