Pages: [1]   Go Down
Author Topic: Need Help Debugging Arduino MEGA 2560 and GPS Shield  (Read 1219 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  ///////
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 140
Posts: 5874
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 140
Posts: 5874
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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);
 }
}
« Last Edit: June 11, 2012, 05:12:19 am by SurferTim » Logged

Pages: [1]   Go Up
Jump to: