Solved: Pin issue with Micro & NEO-6m GPS

Hi all,

I have been messing around with the new Neo-6m GPS module I picked up and I'm having a bit of a strange issue with the Micro. Only pins 12 though to 8 seem to work with the module on the Micro. I have no issues on the Nano I first tried it with.

I spent ages thinking there was a code error or Tx/Rx mix up as I was using Pins lower down. Eventually I used 12 & 11 and it finally started spitting out co-ords. So assuming I had messed up somewhere I moved the jumpers down the board one by one until I got to pins 7 & 8 and it stopped working. No idea why.

Any help would be appreciated. I mean I guess it is working with the Micro, I just don't understand why it won't work with pins <8?

There is nothing else on the board other than the GPS.

The code is the standard library example....

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
/*
   This sample sketch demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) object.
   It requires the use of SoftwareSerial, and assumes that you have a
   4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/
static const int RXPin = 8, TXPin = 9;
static const uint32_t GPSBaud = 9600;

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

void setup()
{
  Serial.begin(9600);
  ss.begin(GPSBaud);

  Serial.println(F("DeviceExample.ino"));
  Serial.println(F("A simple demonstration of TinyGPS++ with an attached GPS module"));
  Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
  Serial.println(F("by Mikal Hart"));
  Serial.println();
}

void loop()
{
  // This sketch displays information every time a new sentence is correctly encoded.
  while (ss.available() > 0)
    if (gps.encode(ss.read()))
      displayInfo();

  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
    Serial.println(F("No GPS detected: check wiring."));
    while(true);
  }
}

void displayInfo()
{
  Serial.print(F("Location: ")); 
  if (gps.location.isValid())
  {
    Serial.print(gps.location.lat(), 6);
    Serial.print(F(","));
    Serial.print(gps.location.lng(), 6);
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F("  Date/Time: "));
  if (gps.date.isValid())
  {
    Serial.print(gps.date.month());
    Serial.print(F("/"));
    Serial.print(gps.date.day());
    Serial.print(F("/"));
    Serial.print(gps.date.year());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F(" "));
  if (gps.time.isValid())
  {
    if (gps.time.hour() < 10) Serial.print(F("0"));
    Serial.print(gps.time.hour());
    Serial.print(F(":"));
    if (gps.time.minute() < 10) Serial.print(F("0"));
    Serial.print(gps.time.minute());
    Serial.print(F(":"));
    if (gps.time.second() < 10) Serial.print(F("0"));
    Serial.print(gps.time.second());
    Serial.print(F("."));
    if (gps.time.centisecond() < 10) Serial.print(F("0"));
    Serial.print(gps.time.centisecond());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.println();
}

From https://www.arduino.cc/en/Reference/softwareSerial

Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

UKHeliBob! You are brilliant and have saved my sanity. Thank you very much :slight_smile:

GaryRH:
Any help would be appreciated. I mean I guess it is working with the Micro, I just don't understand why it won't work with pins <8?

Because not all pins on the micro support software serial.

Its mentioned in the software serial documentation;

GaryRH:
UKHeliBob! You are brilliant and have saved my sanity. Thank you very much :slight_smile:

When all else fails then RTFM

UKHeliBob:
When all else fails then RTFM

:smiley:

Every day is a learning day :slight_smile:

The Arduino reference pages are always worth a look when you have a problem or question.

You get answers quicker there than waiting for the forum to respond.

srnet:
The Arduino reference pages are always worth a look when you have a problem or question.

You get answers quicker there than waiting for the forum to respond.

Thanks srnet :slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.