Trying to set gps baud rate problem, serial communication problems

Hi, Im trying to communicate with a Skylab Gm25 GPS module (Datasheet: http://www.componex-electronics.com/files/SkyNav_GM25_DS.pdf) using my arduino uno.
My purpose to communicate with the module is to set the baud rate to 9600 (by default is 4800)

This code works fine for reading the pin 5 in the GPS module (NMEA data). Code:

#include <SoftwareSerial.h>
SoftwareSerial GPS = SoftwareSerial(3,2);

void setup(){
  GPS.begin(4800);
  Serial.begin(9600);
}

void loop(){
  if(GPS.available()){
    Serial.write(GPS.read());
  }
}

Adding a write statement to the code produces an undesired input. Code:

#include <SoftwareSerial.h>
SoftwareSerial GPS = SoftwareSerial(3,2);

void setup(){
  GPS.begin(4800);
  Serial.begin(9600);
}

void loop(){
  if(GPS.available()){
    Serial.write(GPS.read());
  }
  GPS.write("$PGRMCE");
}

Result:
éÕÔTLLLL??.0±Åå?Âr?bÅ éÓ?'&&K??,00,YÁ±?ª²dÔ? É )KKË??
$PbSLA???Âä? éÓ?NML?«?0,0XjÁ¹?b?ªdÌ? É&SSP\bAb??r?bÅ éÓ?’&&K??,00,¹Áb?ª²dÔ? É )?d¦&$G?±Á???rb?ä ÙÓ?NML?«,0,0XuÁ¹?b?²d¬? É ?Âäé ÕÔT&LLLL?000,9p¹ÅÊ¢bÅ éÓ?'&&K??,00,¹rÄ!rrÅÒÕ(%LLLL2.00,rÉár?ÊÂbÅ éÓ?’&&K??,00,¹ÁbÔ?TäNA?????bÅ éÓ?'&&K??,00,¹Á±?ª²dÔ? É )%?)&:?uu*?S&¦LM??00,12\Åå¢brbr?tÅ ?&KLMM??bä?A Å?rbÅ éÓ?'&&K??,00,¹Á³?ª²dÔ? É %¦M?1

“PGRMCE” doesn’t appear anywhere on the datasheet you posted a link to. What do you think that writing that string to the GPS ON EVERY PASS THROUGH LOOP() is doing?

Is the normal module output protocol rs232 or TTL?

Sorry for not explaining that pgrmc ( http://home.mira.net/~gnb/gps/nmea.html#pgrmc) is an nmea standard sentence with which im trying to set the baud rate with. In the datasshet for the gps module says the format is X,N,8,1 stading for X Baud rate, No parity, 8 bits and 1 stop bit.

So I tried before the PGMRC GPS.write("9600,N,8,1"), but the baud rate didnt changed, so i thought my format was incorrect. So im trying both, but right now i think my problem is setting the comunication because with the code that includes the GPS.write I get unreadable characters when i try to read in the Serial Monitor with the Rx pin.

Seems that in some way the Tx is interfering with the Rx, or the GPS. write is interfering with the GPS.read

zoomkat:
Is the normal module output protocol rs232 or TTL?

All serial connections are at 3V CMOS logic levels

But my problem is when i add the GPS.write. Beacuase the code that doesnt use it can read NMEA sentences (which is what im looking for)

That data sheet is nearly useless. Telling you that you can change the baud rate, without telling you how, is useless.

I’d fire off a e-mail/snail mail/fax/whatever, and tell them what I thought of the piss-poor documentation.

PaulS:
That data sheet is nearly useless. Telling you that you can change the baud rate, without telling you how, is useless.

I’d fire off a e-mail/snail mail/fax/whatever, and tell them what I thought of the piss-poor documentation.

I agree with you, but i have many modules of these that have to configure so I cant throw away this money. And Im trying to contact the tech support and they dont answer neither via email nor phone. I woul really appreciate if you guys could help me so I wont be loosing this money.

Ill be trying to use NMEA sentences and other formats to set the baud rate, but first my problem right now I think is with the GPS.write beacause when I try to read and write Im not getting any readable information. Also I tested connecting pin 2 to pin 3 to see if the arduino could read the information being sent (the string “$PGMRCE”) and the serial monitor doesnt display any information.

The problem is not with the GPS.write(). The problem is that you haven't a clue what to write (and, neither do I). And, you should NOT be doing the write in loop().

Assuming that, by some miracle, you stumble on the magic incantation to make it change baud rates, where do you change the baud rate you are listening at?

PaulS:
The problem is not with the GPS.write(). The problem is that you haven't a clue what to write (and, neither do I). And, you should NOT be doing the write in loop().

Assuming that, by some miracle, you stumble on the magic incantation to make it change baud rates, where do you change the baud rate you are listening at?

The pin 4 is used to configure the pin 5. Both pins are in the GPS module

But my problem right now is not that i dont know which is the command, the problem is what function should I use to talk to the pin 4 (in the gps module)? I thought GPS.write(string) would work, but i cant even read it in the pins of the arduino

Should i repost the question in a different forum? Since right now my problem is not with the GPS module, is about the communication with the arduino because the arduino cant even read its own data with my code

is about the communication with the arduino

Communication implies a sender and a receiver. The Arduino is the receiver. What is sending it data, besides the GPS?

because the arduino cant even read its own data

This doesn't make sense. What data is is failing to read? How do you know?

Sorry forget my comment about the arduino failing to read its own data

This is how im tyring to read the information
Situation 1:

Connections:
Arduino GND pin---->> Skylab GM25 GND
Arduino pin 9 —> Skylab GM25 pin 5 //In the code pin 9 is the RX pin, in the Skylab gm25 pin 5 is TX that outputs NMEA senteces

Code:

#include <SoftwareSerial.h>
SoftwareSerial GPS(9,8);; //RX,TX
int ck=1;

void setup(){
  Serial.begin(4800);
  GPS.begin(4800);
}

void loop(){
  ck=1;
  while(GPS.available()>0){
     Serial.write(GPS.read()); 
  }
    //GPS.write("$PGRMCE");
}

Output (Good output):
$GPGSA,A,1,1E
$GPRMC,000629.000,V,1928.1984,N,07043.9630,W,N
63
$GPGSV,1,1,00,*79
$GPGGA,000630.000,1928.1984,N,07043.9630,W,0,00,50.0,156.64,M,0.00,M,*45
$GPGSA,A,1,1E
$GPRMC,000630.000,V,1928.1984,N,07043.9630,W,N
6B
$GPGSV,1,1,00,*79
$GPGGA,000631.000,1928.1984,N,07043.9630,W,0,00,50.0,156.64,M,0.00,M,*44
$GPGSA,A,1,1E
$GPRMC,000631.000,V,1928.1984,N,07043.9630,W,N
6A
$GPGSV,1,1,00,*79
$GPGGA,000632.000,1928.1984,N,07043.9630,W,0,00,50.0,156.64,M,0.00,M,*47
$GPGSA,A,1,1E
$GPRMC,000632.000,V,1928.1984,N,07043.9630,W,N
69
$GPGSV,1,1,00,*79
$GPGGA,000633.000,1928.1984,N,07043.9630,W,0,00,50.0,156.64,M,0.00,M,*46
$GPGSA,A,1,*1E

Situation 2:

Connections:
Arduino GND pin---->> Skylab GM25 GND
Arduino pin 9 —> Skylab GM25 pin 5 //In the code pin 9 is the RX pin, in the Skylab gm25 pin 5 is TX that outputs NMEA senteces
Arduino pin 8–> Not connected

Code (The only diference with the code on situation 1 is that i uncommented the GPS. write statement, everything else stays the same):

#include <SoftwareSerial.h>
SoftwareSerial GPS(9,8);; //RX,TX
int ck=1;

void setup(){
  Serial.begin(4800);
  GPS.begin(4800);
}

void loop(){
  ck=1;
  while(GPS.available()>0){
     Serial.write(GPS.read()); 
  }
    GPS.write("$PGRMCE");
}

Output (Seems there is some problem):

ÛÔT&LLL??.000,1928.198X9±Áº?¢??tÅ © ? ?)©??&&fKSK??42
HAMb
b?bbbbbbbbbbbÄÄ?I)©T!¤jª©???100.Á±3±ÅÊÂr?Ê¢brb?º?¢?rÊ?tÅÄ????ÓT!¤ÕÔ2¥LKLK??,,XYÝåjRüÒÕÔ(KLÌLÌ??.Á±?Ê?Â?É? ÙÓ?)tÅ ??&KLMM??4,M,0.00,M,hU5)":?u5Å)?&???R¦¨CBÒ¨©MC,0bÁÁÑr??bÅÂr?Ê¢brb??r?tÅÄ???ÉJÉIT!¤TKLK?00,X©ÝÊjRü:?uu?¦&LLMK??0,rIá¹?ÊÂbrb?º?¢?rʲ??bÅ ?&¥LMM??4,M,\ÁÁbjÆ?I??S!¤ªÔU(¥PKLK??,1E
$GP??±Á???dÅ?ÂrÊä? éÓ?’&&K??,N
6A
$GPGSXű?b??č?IéYSá?A???²b?Ê?Âä? ÙÓ?n&&K%LKL??50.0bÕÙr²¢bjb ©??IÓSH?éÕÔU(¥PKLK??,*1E
?AI5
????b²b??rb???bºbÄ???É?SS!¤TU??,1,0,*79
éÕÔ(KLLLL??.000,1928båá¢brbº???bºÆ?bT-©É?©??&¥SKK??6
$ M±?bÄ???I)©TH?é?ª©(%LLLL??.000,V,1dá¹?Ê¢ä? éÓ3g&&K??,TÙájRD:?um)?)? ???Ié)¤ø

Notice that there seems to be some interference because it starts writing the NMEA sentence, but it breaks after that

Try this loop code. Maybe you are sending that command too often. If you are going to try to set some parameter in the GPS, it should be done in setup.

void loop(){
  ck=1;
  while(GPS.available()>0){
     Serial.write(GPS.read()); 
  }
  Serial.println("\r\nSending $PGRMCE"); 
   GPS.write("$PGRMCE");
}

Once you have changed ( or hoped to have changed ) the GPS Baud-Rate you have to include the code:GPS.begin( newBAUD-rate)

Otherwise there is a mismatch between arduino RX and the NMEA data-speed.

Once you have changed ( or hoped to have changed ) the GPS Baud-Rate you have to include the code:...Otherwise there is a mismatch between arduino RX and the NMEA data-speed.

Which should make it obvious that trying to change the baud rate in loop() doesn't make sense.

Of course, trying to write to the GPS when you haven't got the transmit (from Arduino) to receive (on GPS) connected doesn't make sense, eitherl

I know there are many connections that doesnt make sense, but what Im trying to do by giving you that information without sense is so you could maybe detect some connection mistakes Im doing.

Changed the code to:

#include <SoftwareSerial.h>
SoftwareSerial GPS(9,8);; //RX,TX
int ck=1;

void setup(){
  Serial.begin(4800);
  GPS.begin(4800);
  Serial.println("Esprando 10");
  delay(5000);
  Serial.println("Esprando 5");
  delay(5000);
  Serial.println("Empece");
  GPS.write("PGRMCE*0E");  
}

void loop(){
  while(GPS.available()>0){
     Serial.write(GPS.read()); 
  }
}

This code doesnt try to change the baud rate it is asking the GPS for its sensor information (http://home.mira.net/~gnb/gps/nmea.html#garminreceived) including its actual baudrate, also notice that is not in the loop function anymore. The ouput is:

Esprando 10
Esprando 5
Empece
SS? ))?Âr?Ê¢brb?º?¢?rʲ??bºb?b??bª?r?b?ª²r²¢bjb?r??bjbbR¢$GPGGA,151503.000,1928.1984,N,07043.9630,W,0,00,50.0,156.64,M,0.00,M,*43
$GPGSA,A,1,1E
$GPRMC,151503.000,V,1928.1984,N,07043.9630,W,N
6D
$GPGSV,1,1,00,*79

The weirdest thing about this is that i can get this ouput withouth connecting the GND pin, that makes me think im doing something wrong in the connections. I forgot to mention Im using a voltage divider from arduino tx to gps rx since arduino works in 5v and gps module a 3.3v.

So wires go the following way:

Arduino pin 9 (Software serial TX)---->Voltage divider (Input 5V, output 3.3v)---->Skylab GM25 pin 4 (RXD0)
Arduino pin 8(Software Serial RX)---->Skylab GM25 pin 5 (TXD0)

I know im suppossed to connect:
Arduino GND-----> GPS module GND
But i got the ouput without it, so I think mistake or the problem could be relate to this.
I tried both ways connecting GND and without connecting them and got the same output