Go Down

Topic: Arduino Mega and GPS EM-411 problem (Read 722 times) previous topic - next topic

alexbueno85

Hello!

I'm having exactly the same problem described in this topic: http://arduino.cc/forum/index.php?topic=96939.0

The only exception is that I'm using Arduino Mega instead of Uno.

Most curious thing is that it works pretty well with IDE 0023, but doesn't work at all with IDE 1.0.x!

Here are some examples of tests I did:

IDE 1.0.4, using GPS.available():

Code: [Select]
#include <SoftwareSerial.h>
SoftwareSerial GPS(2, 3);
int i = 0;
void setup() {
 Serial.begin(9600);
 GPS.begin(4800);
}

void loop() {
 if (i == 0) {
   Serial.println("here!");
   i = 1;
 }

 if (GPS.available()) {
   Serial.write(GPS.read());
   Serial.println("here! o/");
   i = 0;
 }
}


and the output is (after 15 min waiting):

Code: [Select]
here!

IDE 1.0.4, without GPS.available():

Code: [Select]
#include <SoftwareSerial.h>
SoftwareSerial GPS(2, 3);
void setup() {
 Serial.begin(9600);
 GPS.begin(4800);
}

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


and the output is:

Code: [Select]
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

Finally with IDE 0023:

Code: [Select]
#include <SoftwareSerial.h>

SoftwareSerial GPS = SoftwareSerial(2,3);

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

void loop(){
 Serial.print(GPS.read(), BYTE);
}


and the great output is:

Code: [Select]
$GPRMC,144345.731,V,,,,,,,120313,,,N*49
$GPGGA,144346.742,,,,,0,00,,,M,0.0,M,,0000*57
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,144346.742,V,,,,,,,120313,,,N*4E
$GPGGA,144347.734,,,,,0,00,,,M,0.0,M,,0000*57
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,144347.734,V,,,,,,,120313,,,N*4E
$GPGGA,144348.731,,,,,0,00,,,M,0.0,M,,0000*5D
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,144348.731,V,,,,,,,120313,,,N*44
$GPGGA,144349.744,,,,,0,00,,,M,0.0,M,,0000*5E
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,144349.744,V,,,,,,,120313,,,N*47
$GPGGA,144350.732,,,,,0,00,,,M,0.0,M,,0000*57
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,144350.732,V,,,,,,,120313,,,N*4E
$GPGGA,144351.732,,,,,0,00,,,M,0.0,M,,0000*56
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,144351.732,V,,,,,,,120313,,,N*4F
$GPGGA,144352.744,,,,,0,00,,,M,0.0,M,,0000*54
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,144352.744,V,,,,,,,120313,,,N*4D
$GPGGA,144353.732,,,,,0,00,,,M,0.0,M,,0000*54


I really thought that the problem could be the GPS module, until I find out that it works with IDE 0023.

Anyone could give me any ideas of what to do?

Thanks!
Alex

fungus

Every time I see "SoftwareSerial" I see another project that either doesn't work or works weirdly.

The Mega has four hardware serial ports. Try using one and see what happens...

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

alexbueno85

Code: [Select]
Every time I see "SoftwareSerial" I see another project that either doesn't work or works weirdly.
What should be better?

Code: [Select]
The Mega has four hardware serial ports. Try using one and see what happens...
You mean from 14 to 19?

alexbueno85

Any ideas? I'm still not able to get it working with IDE 1.0.x!

alexbueno85

Problem solved!

The problem really is the ports of Arduino Mega!

Thanks to this topic: http://arduino.cc/forum/index.php?topic=103424.0

Code at IDE 1.0.4:

Code: [Select]
#include <SoftwareSerial.h>

int rxPin = 10; // RX PIN
int txPin = 11; // TX TX

SoftwareSerial ss = SoftwareSerial(rxPin, txPin);

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

void loop() {
  if (ss.available()){
    char c = ss.read();
    Serial.print(c);
  }
}


And really thanks for everyone effort!  ;)

Docedison

Serial1 Pin 19, RXD and Pin 18 TXD works just fine for me with either a Skylabs SKM53 @9600 baudOR a U-Blox-6 @ 4800 baud. Software Serial is for when you don't have spare UARTS... A Mega has 4, one used for the USB serial input leaves 3 free UARTS... Why use software to make a 'Software UART"..?

Bob
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

alexbueno85


Why use software to make a 'Software UART"..?


Because GPS is just part of the project, not the project itself! ;)

Go Up