No GPS signal via SoftwareSerial on Mega... but works on Uno.

I’m having a problem with GPS connectivity on a Mega. After looking through the Google (or whatever the young people are calling it these days), I came across a thread on this subforum about how someone else wasn’t able to get the GPS signal off of their Arduino. It was a different GPS, but it worked when the sketch below was uploaded.

I’m trying to get a program I saw in this post:

wildbill:
Compiled, not tested:

#include <SoftwareSerial.h>

SoftwareSerial gps(3, 4);

void setup()
{
Serial.begin(9600);  // Whatever rate you like; better be higher than the gps rate though. Set serial monitor to match
gps.begin(4800); // Or whatever rate the GPS uses
}

void loop()
{
if(gps.available()>0)
  {
  char ch=gps.read();
  Serial.print(ch); 
  }
}

to work on my Mega. I’ve had problems using GPS in another sketch and I am trying to strip down to the bare basics of what I need to run in order to get a GPS signal. I was originally using the TinyGPS++ library.

I am currently running the GPS (a USGlobalSat EM-406A) through a SparkFun CAN-Bus shield on a Mega 2560. I’ve tried changing the pins from 4,3 on the SoftwareSerial line to 5,4 and 4,5 but nothing really happens. The code you see above will work with the exact same setup (minus the Mega) on an Uno R3.

A picture of the current setup is attached. I’ve got jumpers going to pins 50-53 from 10-13 for compatibility reasons.

I don't know of this might be the cause of your problems, but from the page on SoftwareSerial:

Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).

1 Like

dannable:
I don’t know of this might be the cause of your problems, but from the page on SoftwareSerial:

Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).

Hmmmm… if that’s the case, how do I get around that? More jumpers (from 3/4/5 to one of the ones listed)?

If you must jumper to somewhere, use hardware serial.

Shouldn't be too hard, no? The Mega has plenty. Would I just go from digital pins 3/4 to a pair of the pins used for RX/TX (14 and 15, perhaps)?

The solution was to jumper pins 4 and 5 (as is indicated on the shield as the RX/TX pins for the GPS) to pins 14 and 15 on the Mega as indicated in the last post in this thread: