I tried putting your code in my transmitters code void setup loop,
I'm not sure what that means...
The code snippet I provided should go in the setup routine:
void setup()
{
Serial.begin(9600);
Serial.println("Start");
gpsPort.begin( 9600 );
gps.send_P( &gpsPort, F("PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0") ); // RMC_GGA
delay( 100 );
gps.send_P( &gpsPort, F("PGCMD,33,0") ); // No antenna status messages needed
delay( 100 );
gps.send_P( &gps_port, F("PMTK251,19200") ); // set baud rate
gps_port.flush(); // wait for the command to go out
delay( 100 ); // wait for the GPS device to change speeds
gps_port.end(); // empty the input buffer, too
gps_port.begin( 19200 ); // use the new baud rate
gps.send_P( &gps_port, F("PMTK220,200") ); // set the GPS update interval
//set all motor pins to output
pinMode(DriveF, OUTPUT);
pinMode(DriveB, OUTPUT);
pinMode(SteerR, OUTPUT);
pinMode(SteerL, OUTPUT);
pinMode(SWITCH, INPUT);
mag.begin();
}
Could you please help me understand this a bit more?
The GPS device sends NMEA sentences to the Arduino. The Arduino parses them (with NeoGPS) to get various GPS data members (lat, lon, alt, etc.).
The Arduino can send configuration commands to the GPS. The GPS device parses them to set various modes of its own operation:
* which sentences it should send (RMC and GGA only),
* whether it should send antenna status sentences to the Arduino (NO),
* what baud rate it should use (19200, not the default 9600),
* how often it should send sentences (5 times per second = 200ms interval between updates).
I hoped the comments after each send_P would describe that.
You might try 2Hz update first. Change that last command to have 500 instead of 200.
I changed the baud rate on the serial monitor and tried messing around with it, but it doesn't seem to do much.
These commands were supposed to change the baud rate of the Arduino-GPS link (the Serial2 variable). They have nothing to do with the Serial Monitor speed (i.e., Arduino-PC link, via the Serial variable).
If you still cannot get any data from the GPS device, try the NMEAdiagnostic.ino example. You must the edit the GPSport.h file to use your Serial2 port:
#ifndef GPSport_h
#define GPSport_h
#define gpsPort Serial2
#define GPS_PORT_NAME "Serial2"
#define DEBUG_PORT Serial
#endif
That is the entire file. Delete everything else.
Have you read the Digilent datasheet?
PeteYeah, I saw this but I couldn't make sense out of it. Could you please explain a bit as to how its supposed to work?
The Digilent GPS module uses the MediaTek 3329 chip. If you look for the "Output Sentences", you will see that it can send RMC, GGA, GSA, GSV and VTG sentences. Your code sends a command that makes it send only RMC and GGA.
The Digilent PMod spec says to see the MediatTek PMTK command spec for the configuration commands you can send to the GPS device.
The MediaTek PMTK documentation says that a PMTK251 command can be used to change the baud rate, and a PMTK220 command can be used to change the update interval.
El_supremo points out that the Digilent document says that a PMTK226 command can be used to change the baud rate. I can find no other documents that list a PMTK226 command. The "3,30" parameters don't seem related to 10Hz, so that's a little confusing, too. You could try sending "PMTK226,3,30" instead of "PMTK251,500", but I'm a little skeptical. I think "PMTK251" is the correct command.