Arduino Due serial problem with GPS

Hi folks,

I have recently bought an Arduino Due. I would like to output raw GPS data (NMEA sentences) on the Serial monitor, but it outputs garbage in the Serial Monitor (45,23,85,34,...). The code used looks like that:

void setup()
{
  Serial3.begin(9600);
  Serial.begin(9600);
}

void loop()
{
  while(Serial3.available())
  {
    Serial.println(Serial3.read());
  }
}

This code worked on my Arduino Mega, but doesn't work on the Due.
The creepy thing is that processed data with TinyGPS works on the Due and shows latitude etc. on the Serial Monitor, but raw GPS data seems being untouchable on the Due.

Any idea?

Try Serial.write instead of println.

Pete

read() returns int, you'll have to cast to char to make it a character.

Hi,

I have Skylab SKM53 Gps module working perfectly, almost out of the box, with my arduino due.

I've connected the GPS Rx pin to Tx1 on the Due and the GPS Tx pin to the Rx1 on the due.... Serial1.begin(9600).... and it's done...

Be aware that if you are indoor, the gps may take as long as it takes to show data (maybe more than two hours)... so try it outdoors and you'll begin receiving data in a few minutes after the gps knows where it is..

Try TinyGps++ or TinyGps13 library !!

http://arduiniana.org/2013/09/greater-accuracy-with-tinygps-13/

Good luck and merry Christmas!!!

Thank you very much!

It works with Serial.write(), and I also tried TinyGPSPlus. It's just amazing! ]:smiley:

How did you use tinygps library in Due.Because Tinygps uses softwareserial.h which is not recommended for Due

What prevents you from replacing software serial by e.g. Serial1 ?

... or using NeoGPS? It.s smaller, faster, more accurate and more reliable than all other GPS libraries. Many other libraries' examples are not structured properly, and they break when you modify them. Even if you don't use it, be sure to read the Installation section on Choosing a Serial Port. This can really help your sketch work more reliably.

All the NeoGPS examples will work on the Due, without modification. They expect the GPS to be on Serial1.

NeoGPS is also available from the Arduino Library Manager, under the menu Sketch-> Include Library-> Manage Libraries.