Go Down

Topic: Need Help Debugging Arduino MEGA 2560 and GPS Shield (Read 1 time) previous topic - next topic

tmonteit

I have an Arduino mega that is connected to a CIROCOMM GPS Shield

Background:  I made this work once using example code from the internet.  However it recently stopped working and has never worked since.  I don't believe this is equipment problems because I have both a spare Mega and a spare GPS Shield.  The symptoms are the same regardless of what combination of equipment I use.   I really do not know what is going on or how to debug this system.    Can someone please help explain some techniques that will allow me to debug this?

Problem:   The problem appears to be in the Serial3 connection.  Serial3.available() never returns true.    How can I figure out what is going on here? 

//////  BEGIN CODE  ///////

// WIRING:
//   1. GPS is powered and Grounded.  After about 20 seconds the GPS achieves lock.
//       GPS lock is indicted by a solid red light.
//   2. GPS TX (blue wire) is connected to Mega 14 (Tx3)
//       GPS RX (yellow wire) is connected to Mega 15 (Rx3)


#include <TinyGPS.h>
#define GPSBAUD 4800
TinyGPS gps;
void getgps(TinyGPS &gps);

void setup()
{
  Serial.begin(115200);
  Serial3.begin(GPSBAUD);
  Serial.println("GPS TEST CODE ");
}


void loop()
{
Serial.println("entering loop");
if(Serial3.available()) {   // PROBLEM IS HERE!!!  -  Never is available
    Serial.println("serial3 available");   // THIS LINE NEVER PRINTS
} else {
    Serial.println("serial3 not-available");    // THIS LINE ALWAYS PRINTS
}

delay(1000);
while(Serial3.available())     // While there is data on the RX pin...
{
     int c = Serial3.read();    // load the data into a variable...
     if(gps.encode(c))      // if there is a new valid sentence...
     {
       getgps(gps);         // then grab the data.
     }
}
}

//////  END CODE  ///////

SurferTim

Without seeing a datasheet on the device you are using, I would question this:
Quote
// WIRING:
//   1. GPS is powered and Grounded.  After about 20 seconds the GPS achieves lock.
//       GPS lock is indicted by a solid red light.
//   2. GPS TX (blue wire) is connected to Mega 14 (Tx3)
//       GPS RX (yellow wire) is connected to Mega 15 (Rx3)

Normally the Tx on one device is connected to the Rx on the other device.

tmonteit

Correction:

Below is wiring:

// WIRING:
//   1. GPS is powered and Grounded.  After about 20 seconds the GPS achieves lock.
//       GPS lock is indicted by a solid red light.
//   2. GPS RX (blue wire) is connected to Mega 14 (Tx3)
//       GPS TX (yellow wire) is connected to Mega 15 (Rx3)

SurferTim

#3
Jun 11, 2012, 12:07 pm Last Edit: Jun 11, 2012, 12:12 pm by SurferTim Reason: 1
If the wiring is correct, then I would check the GPS Tx line with my o-scope for timing and voltage levels.

add: I would change the code temporarily to just read the GPS output and send it directly to the serial monitor.

Code: [Select]
void loop()
{
while(Serial3.available())     // While there is data on the RX pin...
{
     int c = Serial3.read();    // load the data into a variable...
     Serial.write(c);
}
}

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy