Pages: [1]   Go Down
Author Topic: Arduino Mega and GPS EM-411 problem  (Read 553 times)
0 Members and 1 Guest are viewing this topic.
Brazil
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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:
here!

IDE 1.0.4, without GPS.available():

Code:
#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:
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

Finally with IDE 0023:

Code:
#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:
$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
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4548
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...

Logged

No, I don't answer questions sent in private messages...

Brazil
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Brazil
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Brazil
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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!  smiley-wink
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2808
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

--> 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

Brazil
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Because GPS is just part of the project, not the project itself! smiley-wink
Logged

Pages: [1]   Go Up
Jump to: