help for adafruit gps shield

by aqwzsx on Mon Feb 25, 2013 1:33 pm

hello!
so now I have a problem, I own one aruino uno, and a shield for gps chip of adafruit: http://www.adafruit.com/products/98
with EM 406A GPS chip. but it's the version without resistances but with the pic 74AHC125
The code I use is as follows:
Code: Select all
// Ladyada's logger modified by Bill Greiman to use the SdFat library

// this is a generic logger that does checksum testing so the data written should be always good
// Assumes a sirf III chipset logger attached to pin 2 and 3

#include <SD.h>
#include <avr/sleep.h>
#include "GPSconfig.h"

// If using Arduino IDE prior to 1.0,
// make sure to install newsoftserial from Mikal Hart
// http://arduiniana.org/libraries/NewSoftSerial/
#if ARDUINO >= 100
 #include <SoftwareSerial.h>
#else
 #include <NewSoftSerial.h>
#endif

// power saving modes
#define SLEEPDELAY 0
#define TURNOFFGPS 0
#define LOG_RMC_FIXONLY 0

// what to log
#define LOG_RMC 1 // RMC-Recommended Minimum Specific GNSS Data, message 103,04
#define LOG_GGA 0 // GGA-Global Positioning System Fixed Data, message 103,00
#define LOG_GLL 0 // GLL-Geographic Position-Latitude/Longitude, message 103,01
#define LOG_GSA 0 // GSA-GNSS DOP and Active Satellites, message 103,02
#define LOG_GSV 0 // GSV-GNSS Satellites in View, message 103,03
#define LOG_VTG 0 // VTG-Course Over Ground and Ground Speed, message 103,05



// Use pins 2 and 3 to talk to the GPS. 2 is the TX pin, 3 is the RX pin
#if ARDUINO >= 100
 SoftwareSerial gpsSerial =  SoftwareSerial(2, 3);
#else
 NewSoftSerial gpsSerial =  NewSoftSerial(2, 3);
#endif
// Set the GPSRATE to the baud rate of the GPS module. Most are 4800
// but some are 38400 or other. Check the datasheet!
#define GPSRATE 4800

// Set the pins used
#define powerPin 4
#define led1Pin 5
#define led2Pin 6
#define chipSelect 10


#define BUFFSIZE 90
char buffer[BUFFSIZE];
uint8_t bufferidx = 0;
uint8_t fix = 0; // current fix data
uint8_t i;
File logfile;

// read a Hex value and return the decimal equivalent
uint8_t parseHex(char c) {
  if (c < '0')
    return 0;
  if (c <= '9')
    return c - '0';
  if (c < 'A')
    return 0;
  if (c <= 'F')
    return (c - 'A')+10;
}

// blink out an error code
void error(uint8_t errno) {
/*
  if (SD.errorCode()) {
    putstring("SD error: ");
    Serial.print(card.errorCode(), HEX);
    Serial.print(',');
    Serial.println(card.errorData(), HEX);
  }
  */
  while(1) {
    for (i=0; i<errno; i++) {
      digitalWrite(led1Pin, HIGH);
      digitalWrite(led2Pin, HIGH);
      delay(100);
      digitalWrite(led1Pin, LOW);
      digitalWrite(led2Pin, LOW);
      delay(100);
    }
    for (; i<10; i++) {
      delay(200);
    }
  }
}

void setup() {
  WDTCSR |= (1 << WDCE) | (1 << WDE);
  WDTCSR = 0;
  Serial.begin(9600);
  Serial.println("\r\nGPSlogger");
  pinMode(led1Pin, OUTPUT);
  pinMode(led2Pin, OUTPUT);
  pinMode(powerPin, OUTPUT);
  digitalWrite(powerPin, LOW);

  // make sure that the default chip select pin is set to
  // output, even if you don't use it:
  pinMode(10, OUTPUT);
 
  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card init. failed!");
    error(1);
  }

  strcpy(buffer, "GPSLOG00.TXT");
  for (i = 0; i < 100; i++) {
    buffer[6] = '0' + i/10;
    buffer[7] = '0' + i%10;
    // create if does not exist, do not open existing, write, sync after write
    if (! SD.exists(buffer)) {
      break;
    }
  }

  logfile = SD.open(buffer, FILE_WRITE);
  if( ! logfile ) {
    Serial.print("Couldnt create "); Serial.println(buffer);
    error(3);
  }
  Serial.print("Writing to "); Serial.println(buffer);
 
  // connect to the GPS at the desired rate
  gpsSerial.begin(GPSRATE);
 
  Serial.println("Ready!");
 
  gpsSerial.print(SERIAL_SET);
  delay(250);

#if (LOG_DDM == 1)
     gpsSerial.print(DDM_ON);
#else
     gpsSerial.print(DDM_OFF);
#endif
  delay(250);
#if (LOG_GGA == 1)
    gpsSerial.print(GGA_ON);
#else
    gpsSerial.print(GGA_OFF);
#endif
  delay(250);
#if (LOG_GLL == 1)
    gpsSerial.print(GLL_ON);
#else
    gpsSerial.print(GLL_OFF);
#endif
  delay(250);
#if (LOG_GSA == 1)
    gpsSerial.print(GSA_ON);
#else
    gpsSerial.print(GSA_OFF);
#endif
  delay(250);
#if (LOG_GSV == 1)
    gpsSerial.print(GSV_ON);
#else
    gpsSerial.print(GSV_OFF);
#endif
  delay(250);
#if (LOG_RMC == 1)
    gpsSerial.print(RMC_ON);
#else
    gpsSerial.print(RMC_OFF);
#endif
  delay(250);

#if (LOG_VTG == 1)
    gpsSerial.print(VTG_ON);
#else
    gpsSerial.print(VTG_OFF);
#endif
  delay(250);

#if (USE_WAAS == 1)
    gpsSerial.print(WAAS_ON);
#else
    gpsSerial.print(WAAS_OFF);
#endif
}

void loop() {
  //Serial.println(Serial.available(), DEC);
  char c;
  uint8_t sum;

  // read one 'line'
  if (gpsSerial.available()) {
    c = gpsSerial.read();
#if ARDUINO >= 100
    //Serial.write(c);
#else
    //Serial.print(c, BYTE);
#endif
    if (bufferidx == 0) {
      while (c != '$')
        c = gpsSerial.read(); // wait till we get a $
    }
    buffer[bufferidx] = c;

#if ARDUINO >= 100
    //Serial.write(c);
#else
    //Serial.print(c, BYTE);
#endif
    if (c == '\n') {
      //putstring_nl("EOL");
      //Serial.print(buffer);
      buffer[bufferidx+1] = 0; // terminate it

      if (buffer[bufferidx-4] != '*') {
        // no checksum?
        Serial.print('*');
        bufferidx = 0;
        return;
      }
      // get checksum
      sum = parseHex(buffer[bufferidx-3]) * 16;
      sum += parseHex(buffer[bufferidx-2]);

      // check checksum
      for (i=1; i < (bufferidx-4); i++) {
        sum ^= buffer[i];
      }
      if (sum != 0) {
        //putstring_nl("Cxsum mismatch");
        Serial.print('~');
        bufferidx = 0;
        return;
      }
      // got good data!

      if (strstr(buffer, "GPRMC")) {
        // find out if we got a fix
        char *p = buffer;
        p = strchr(p, ',')+1;
        p = strchr(p, ',')+1;       // skip to 3rd item

        if (p[0] == 'V') {
          digitalWrite(led1Pin, LOW);
          fix = 0;
        } else {
          digitalWrite(led1Pin, HIGH);
          fix = 1;
        }
      }
      if (LOG_RMC_FIXONLY) {
        if (!fix) {
          Serial.print('_');
          bufferidx = 0;
          return;
        }
      }
      // rad. lets log it!
      Serial.print(buffer);
      Serial.print('#');
      digitalWrite(led2Pin, HIGH);      // sets the digital pin as output

      // Bill Greiman - need to write bufferidx + 1 bytes to getCR/LF
      bufferidx++;

      logfile.write((uint8_t *) buffer, bufferidx);
      logfile.flush();
      /*
      if( != bufferidx) {
         putstring_nl("can't write!");
         error(4);
      }
      */

      digitalWrite(led2Pin, LOW);

      bufferidx = 0;

      // turn off GPS module?
      if (TURNOFFGPS) {
        digitalWrite(powerPin, HIGH);
      }

      delay(SLEEPDELAY * 1000);
      digitalWrite(powerPin, LOW);
      return;
    }
    bufferidx++;
    if (bufferidx == BUFFSIZE-1) {
       Serial.print('!');
       bufferidx = 0;
    }
  } else {

  }

}

void sleep_sec(uint8_t x) {
  while (x--) {
     // set the WDT to wake us up!
    WDTCSR |= (1 << WDCE) | (1 << WDE); // enable watchdog & enable changing it
    WDTCSR = (1<< WDE) | (1 <<WDP2) | (1 << WDP1);
    WDTCSR |= (1<< WDIE);
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);
    sleep_enable();
    sleep_mode();
    sleep_disable();
  }
}

SIGNAL(WDT_vect) {
  WDTCSR |= (1 << WDCE) | (1 << WDE);
  WDTCSR = 0;
}

/* End code */

So my problem is that when I use the serial monitor to see who will frame the SD card I get this error message:
" GPSlogger
Card init. failed! "

what is the prpobleme ? if you want i can take picture of my installation :) thanks for help, and i'm french so if my english was'nt very goog that's normally :)
Last edited by adafruit_support_bill on Tue Feb 26, 2013 6:58 am, edited 1 time in total.
Reason: Please use the 'code' button when submitting code
aqwzsx
 
Posts: 4
Joined: Mon Feb 25, 2013 1:18 pm

Re: help for adafruit gps shield

by adafruit_support_mike on Tue Feb 26, 2013 2:57 am

That problem usually happens when there's a bad solder joint to the card holder.

aqwzsx wrote:if you want i can take picture of my installation

Please do. I'll take a look at the joints and see if I notice anything.

aqwzsx wrote:thanks for help, and i'm french so if my english was'nt very goog that's normally :)

Pas de probleme.. je parle seulment le Francais de l'ecole secondaire. Et mal. ;-)
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7068
Joined: Thu Feb 11, 2010 1:51 pm

Re: help for adafruit gps shield

by aqwzsx on Tue Feb 26, 2013 4:40 am

First of all, thank you for taking the time to answer me. and the photo:
Image

Image

Image

Image

Image

Image

if it was'nt good for the pictures I take other :)
aqwzsx
 
Posts: 4
Joined: Mon Feb 25, 2013 1:18 pm

Re: help for adafruit gps shield

by adafruit_support_mike on Tue Feb 26, 2013 6:06 pm

Good pictures.

You have a lot of good joints, but there are a few that could use some work:

Image

The ones in the green box to the right are excellent. That's exactly how good solder joints should look. Many of the others look just as good, but those were the easiest to point out.

The one with the red oval looks like it might not be making a connection with the pin. All the other joints in that row have solder going all the way to the edge of the SD card holder, but that one seems to fall short. Try heating that one up again.

Also reheat the joints outlined in orange. Some of them are teardrop-shaped and may not be making a good connection to the pad beneath them, some have the dull finish and strange shape of 'cold joints'. Those happen when either the lead or the pad didn't get hot enough to bond with the solder, or if something moved while the solder was cooling down.

The joints outlined in purple are the right shape, but they aren't shiny like the really good ones in the green box. They're probably good, but it wouldn't hurt to reheat them too.

You probably don't need to add any more solder, but do use plenty of flux. Flux is like soap for metal.. it lowers the surface tension, allows it to flow more smoothly, and gets under any dirt or gunk that might cause problems.

Try to make all the joints look like those good ones in the green box, and don't feel self-conscious about going back to redo joints now and then. Everyone does, all the time. Experience doesn't prevent bad joints, it just teaches you to find them and fix them before letting anyone else see the board. ;-)
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7068
Joined: Thu Feb 11, 2010 1:51 pm

Re: help for adafruit gps shield

by aqwzsx on Wed Feb 27, 2013 7:12 am

thanks for answer. and the photo wit new joints :

Image

So i don't think it was the joints which makes defaults, probably it was the PIC ? For the pic i have take an adaptator to don't hurt the PIC (74HC125N) when i have make the joints. may be the mistake come of that ? :? Plus it was this PIC xho make the relay behind the SD card and the GPS.
aqwzsx
 
Posts: 4
Joined: Mon Feb 25, 2013 1:18 pm

Re: help for adafruit gps shield

by adafruit_support_mike on Wed Feb 27, 2013 11:54 pm

Those joints look good.

It's possible that the 74AHC125 is causing problems, but you can test the chip by pulling it out of the socket and putting it in a breadboard. It's a simple chip that just copies input from one pin to another. Here's a datasheet that explains it: http://www.nxp.com/documents/data_sheet ... HCT125.pdf

Figure 4 tells you everything you need to know.

I wanted to take another look at the top of the shield to make sure all the components are in the right place, but can't connect to the server that holds the pictures right now.

Just to double check though: take a magnifying glass and look at the parts marked Q1 and IC1. Q1 should have 2907 written on it. IC1 should have 1700-3302E written on it. If those are exchanged, the circuit won't work.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7068
Joined: Thu Feb 11, 2010 1:51 pm

Re: help for adafruit gps shield

by aqwzsx on Fri Mar 01, 2013 7:37 pm

yes that's the good number on the Q1 and 1C1, but i have make some test on the CMOS and apparently does'nt work.
*
Image

Image

normally i should have a value into 2 and 5V ?
aqwzsx
 
Posts: 4
Joined: Mon Feb 25, 2013 1:18 pm

Re: help for adafruit gps shield

by adafruit_support_mike on Mon Mar 04, 2013 4:04 pm

Yes, something is wrong there.

Pull the chip out of the socket and take the same measurement. You should get a reading of 3.3v.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7068
Joined: Thu Feb 11, 2010 1:51 pm