Read issue on Nano + Ublox NEO 6M

Hi,

First of all I'm beginner on Arduino :slight_smile:

I'm working with a Nano connected to a GPS Ublox Neo 6M, it seems to be used a lot by the community, I read a lot of topics all the day but nothing help me to fix my issue.

Nano to Neo connexion :

Nano VCC -> 5V
Nano GND -> GND
TX -> D6
RX -> D5

My sketch :

#include <SoftwareSerial.h>

static const int RXPin = 6, TXPin = 5;
static const uint32_t GPSBaud = 9600;
// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);


void setup()
{

    Serial.begin(9600);
    Serial.print("coucou");
    ss.begin(GPSBaud);
}

void loop()
{
   
     while (ss.available() > 0){
        
        Serial.println(ss.read());
     }

}

My issue is the following one :

In my Serial Monitor I can well see the "coucou", then only the bad character : 0⸮ in infinite loop.

Even if I disconnect the GPS module, the infinite loop continue... So i'm not sure the ss.availablea() is working. I already tried different baudrate just in case, but same issue (should be 9600).

If you need any information just ask, and thank you in advance for your support

I hooked up my NEO6M to an Uno and slightly modified your code (see comments).

#include <SoftwareSerial.h>

static const int RXPin = 6, TXPin = 5;
static const uint32_t GPSBaud = 9600;
// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);


void setup()
{

   Serial.begin(9600);
   Serial.println ("coucou");  // changed print to println
   ss.begin(GPSBaud);
}

void loop()
{

   while (ss.available() > 0)
   {

      Serial.print(char(ss.read()));  // change println to print and cast the read to char 
   }

}

And I get:

coucou
$GPRMC,162213.00,V,,,,,,,181119,,,N*79
$GPVTG,,,,,,,,,N*30
$GPGGA,162213.00,,,,,0,03,2.25,,,,,,*55
$GPGSA,A,1,21,10,29,,,,,,,,,,2.46,2.25,1.00*0D
$GPGSV,2,1,08,10,53,284,23,13,03,035,,14,00,206,,15,31,048,18*7F
$GPGSV,2,2,08,16,11,263,08,20,67,344,22,21,73,063,27,29,17,164,21*73
$GPGLL,,,,,162213.00,V,N*4F
$GPRMC,162214.00,V,,,,,,,181119,,,N*7E
$GPVTG,,,,,,,,,N*30

Make sure the GPS RX goes to pin 5 of the Nano and the GPS TX goes to Nano pin 6. Are you sure that the serial monitor is baud rate is set to 9600?

What do you get now?

Oh, and good job with code tags on your first post. Most new members do not bother to read the rules. Karma for you.

Thank you very much for your feedback, making some test it seems that I broke my nano...

avrdude: verification error, first mismatch at byte 0x00e9
0xa0 != 0xe0
avrdude: verification error; content mismatch
avrdude: verification error; content mismatch

I'll investigate this issue, and try your solution when my board will work again ^^

Ok so I made some more tests.

Your solution is working well ! The issue came from my Nano that is dead in fact, I tried with an other one and everything is working well. Except that position never fix but i'm inside so maybe coming from bad reception.

LosRegenados:
Except that position never fix but i'm inside so maybe coming from bad reception.

You may get a fix if the GPS is right next to a window or under a skylight. Otherwise, you'll need to take it outside somewhere with a good view of the sky.