Software Serial buffer overflow with Garmin GPS18x LVC

Folks - newbie to Arduino yet used to write C and C++ years ago quite fluently. Brushing the dust off. And running into a confusing situation. Never was all too fond of serial communication - seems to have quirks often. Yet then again one cannot escape it so might as well immerse in it. Help please?

Here's the deal - I connected a Garmin GPS18x LVC (4800 baud device) through a MAX232A chip (using the 0.1uF caps suggested in the data sheet) to my Arduino Mega 2560. I have a SeeedStudio SD card board attached and jumpered appropriately to make that work. This config restricts the Rx in for serial to a subset of pins - basically pins 10, 11, 12, 13, 50, 51, 52, 53 are tied up so restricted to those remaining in the 60s. I've tried a couple of the available pins (63 and this sketch uses 69)- yet although I get communication I see frequent buffer overflows and therefore I'm missing critical GPS messages.

Ideas on what may be causing this overflow situation and more importantly what to do to correct?

Here's the basic code (stripped down from a already simple public domain sketch):

/*
 Receives from the hardware serial, sends to software serial.
 
 Note:
 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, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69
 
 baseline sketch by Tom Igoe
 which was based on Mikal Hart's example
 
 This example code is in the public domain.
 
 */
#include <SoftwareSerial.h>

SoftwareSerial gpsSerial(69, 16); // RX, TX - Mega 2560 with SeeedStudio SD v3 attached - move Rx to pin 69

void setup()  
{
  // Open serial communications and wait for port to open:
  Serial.begin(115200);

  // set the data rate for the SoftwareSerial port
  gpsSerial.begin(4800);

  Serial.println("Demonstrate serial buffer overflow with Garmin GPS18x LVC");

  for (int i = 0; i<30; i++)
  {
    if (gpsSerial.overflow())
    {
      Serial.print(F("OVERFLOW "));
    }
    if (gpsSerial.available())
    {
      Serial.print(F("Rx message: \""));
      Serial.write(gpsSerial.read());
      Serial.println("\"");
    }
  }
}

void loop() // run over and over
{
}

Here's the output:

Demonstrate serial buffer overflow with Garmin GPS18x LVC
Rx message: "f"
Rx message: "?"
Rx message: "?"
Rx message: ","
Rx message: ","
Rx message: ","
Rx message: "1"
Rx message: "."
Rx message: "8"
Rx message: ","
OVERFLOW Rx message: "1"
OVERFLOW Rx message: "."
OVERFLOW Rx message: "0"
OVERFLOW Rx message: ","
OVERFLOW Rx message: "1"
OVERFLOW Rx message: "."
OVERFLOW Rx message: "5"
OVERFLOW Rx message: "*"
OVERFLOW Rx message: "3"
OVERFLOW Rx message: "A"
OVERFLOW Rx message: "
"
Rx message: "
"
Rx message: "$"
Rx message: "G"
Rx message: "P"
Rx message: "G"
Rx message: "S"
Rx message: "V"
Rx message: ","
Rx message: "3"

Why software serial when u got a lot of hardware serial ports ?

Great question! I started with an Uno and I believe the SD card reader stomped on me. So my baseline was software serial.

Also - I'm VERY new to Arduino (less than a week in my hands) so am unfortunately obliviously unaware of the capabilities.

So looks like I should use attachInterrupt() and add a service routine to handle the serial input from the GPS? Sorry for fumbling around - yet a bit more guidance (aka code I could copy) would help me move forward and learn fast I think! Thanks for your question and any further help!

:blush:
OK - Serial1.whatever. Gotcha. Tried to make it overly complex. Thanks for the guidance!