SoftwareSerial with TinyGPS problems

Hello,
I'm having lots of trouble using SoftwareSerial to communicate with my GPS module (Locosys LS20031). I'm running the example script from the Arduiniana TinyGPS site:

#include <TinyGPS.h>

#include <SoftwareSerial.h>

TinyGPS gps;
SoftwareSerial mySerial(4,5); // RX, TX
long lat, lon;
unsigned long fix_age, time, date, speed, course;

void setup() 
{
  Serial.begin(57600);
    
    mySerial.begin(57600); 
}

 

void loop()
{
  while (mySerial.available())
  {
    int c = mySerial.read();
    if (gps.encode(c))
    {
     
      // process new gps info here
      // retrieves +/- lat/long in 100000ths of a degree
      gps.get_position(&lat, &lon, &fix_age);
      // course in 100ths of a degree
      course = gps.course();

      //Output info via USB
      Serial.print("Latitude=");
      Serial.println(lat);
      
      Serial.print("Longitude=");
      Serial.println(lon);
      
      Serial.print("Age=");
      Serial.println(fix_age);

      Serial.print("Course=");
      Serial.println(course);

    }
  
  }
}

The Serial monitor shows blank. The gps.encode() never returns true meaning I'm not getting good sentences. However if I remove the SoftwareSerial class and just listen to the GPS on pin 0 and print with the Serial class it works fine:

#include <TinyGPS.h>

//#include <SoftwareSerial.h>

TinyGPS gps;
//SoftwareSerial mySerial(4,5); // RX, TX
long lat, lon;
unsigned long fix_age, time, date, speed, course;

void setup() 
{
  Serial.begin(57600);
    
   // mySerial.begin(57600); 
}

 

void loop()
{
  while (Serial.available())
  {
    int c = Serial.read();
    if (gps.encode(c))
    {
      
      // process new gps info here
      // retrieves +/- lat/long in 100000ths of a degree
      gps.get_position(&lat, &lon, &fix_age);
      // course in 100ths of a degree
      course = gps.course();

      //Output info via USB
      Serial.print("Latitude=");
      Serial.println(lat);
      
      Serial.print("Longitude=");
      Serial.println(lon);
      
      Serial.print("Age=");
      Serial.println(fix_age);

      Serial.print("Course=");
      Serial.println(course);

    }
  
  }
}

Before this project is complete I'm going to want to send some control bits back to the GPS, so I can't get by without SoftwareSerial or some other solution. Does anyone have suggestions?

From my experience, I don't think softserial has a chance in h*ll of working well in this situation. See this thread for some recent comments,
http://forum.arduino.cc//index.php?topic=195631.0

OTOH, I'd be plenty happy if someone would actually PROVE me wrong.

Hello Oric_dan

i have gone thru the thread.. as u said we join the "unlucky group" software serial does gives the headache..

Im currently testing something with slight modification of tinygpsplus code which i earlier share in this thread. Will share once it is successfull.

fingers crossed*

:slight_smile:

Hello Guys,

As i mention in the previous post that im working on something. Well my GPS reads perfectly on my Serial Monitor.

IMPORTANT NOTE:
THIS GUIDE IS ONLY FOR MEGA2560 BOARD.

As mention in my thread, i have found a solution to it. Hope you will join me on my thread and give me some feedback..