We are currently testing the gps breakout board in multiple cars. But we encounter a deadlock which consists of the modules not giving any output at all, untill we reset the atmega. Is there a workaround for this or do you have any idea what might be causing this?
Note that we use the sleep- and wake-function. So the module is put to sleep when the cars stops and is woke up when the car starts. During all times the module has vin power.
adafruit gps breakout v3.0
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Franklin97355
- Posts: 23911
- Joined: Mon Apr 21, 2008 2:33 pm
Re: adafruit gps breakout v3.0
Could you post your code ? Please use the code button "</>" in the button bar when posting code to the forums.
Also could you post clear pictures of your board, any soldering you did and the connections to it?
Also could you post clear pictures of your board, any soldering you did and the connections to it?
- fleetprobe
- Posts: 6
- Joined: Mon Aug 18, 2014 10:21 am
Re: adafruit gps breakout v3.0
it's a difficult to post code. As its a big project. The soldering is just 2 wires to ground and vin powered by the 5v ldo of the atmega. and the rx and tx are mounted on a header. When the module is not spitting out anymore it doesnt help wiggling the rx tx, there's also no led so the gps module should have a fix and the 5v supply is never interrupted. Would it be possible the module goes into a state where #define PMTK_AWAKE "$PMTK010,002*2D\r\n" is not effective anymore for waking up?
- fleetprobe
- Posts: 6
- Joined: Mon Aug 18, 2014 10:21 am
Re: adafruit gps breakout v3.0
This is the constructor and initialization of the gtop module:
This is the sleep wake code :
This is how we read the output:
Any help would be appreciated.
Code: Select all
#define MTK_OUTPUT_5HZ "$PMTK220,200*2C\r\n"
#define PMTK_SET_NMEA_OUTPUT_RMCGGA "$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n"
#define WAAS_ON "$PMTK301,2*2E\r\n"
#define SBAS_ON "$PMTK313,1*2E\r\n"
#define MTK_DT_SBAS_ENABLED "$PMTK513,1*28\r\n"
#define MTK_SBAS_INTEGRITYMODE "$PMTK319,1*24\r\n"
#define MTK_DT_DGPS_WAAS "$PMTK501,2*28\r\n"
gpslib::gpslib(HardwareSerial *_serial) {
// TODO Auto-generated constructor stub
this->_serial = _serial;
_serial->begin(9600);
delay(2000);
_serial->println(MTK_OUTPUT_5HZ);
_serial->println(PMTK_SET_NMEA_OUTPUT_RMCGGA);
_serial->println(WAAS_ON);
_serial->println(SBAS_ON);
_serial->println(MTK_DT_SBAS_ENABLED);
_serial->println(MTK_SBAS_INTEGRITYMODE);
_serial->println(MTK_DT_DGPS_WAAS);
}
Code: Select all
#define PMTK_STANDBY "$PMTK161,0*28\r\n"
#define PMTK_AWAKE "$PMTK010,002*2D\r\n"
void sleep(){
_serial->println(PMTK_STANDBY);
}
void wake(){
_serial->println(PMTK_AWAKE);
}
Code: Select all
bool gpslib::findGPGGA() {
unsigned long start_time = millis();
memset(message, '\0', GPS_BUFFER_SIZE);
bool startfound = false;
bool endfound = false;
int i = 0;
do {
char c = _serial->read();
if (c != 0xFFFF) {
if (c == '$') {
startfound = true;
memset(message, '\0', GPS_BUFFER_SIZE);
i = 0;
} else if (startfound && c == '\n') {
endfound = true;
}
if (startfound && !endfound) {
message[i++] = c;
}
if (endfound && strstr(message, "$GPGGA") == NULL) {
Serial.println(message);
i = 0;
endfound = false;
startfound = false;
memset(message, '\0', GPS_BUFFER_SIZE);
} else if (endfound && strstr(message, "$GPGGA") != NULL) {
Serial.println(message);
return 1;
}
}
} while (millis() - start_time < 1500UL && i < GPS_BUFFER_SIZE);
return 0;
}
- fleetprobe
- Posts: 6
- Joined: Mon Aug 18, 2014 10:21 am
Re: adafruit gps breakout v3.0
Did anyone have any time to look at this or maybe share some experience in these modules?
- Franklin97355
- Posts: 23911
- Joined: Mon Apr 21, 2008 2:33 pm
Re: adafruit gps breakout v3.0
You have not posted pictures or the code as requested yet. If this is an Arduino sketch it will fit between
Code: Select all
tags just fine.
- fleetprobe
- Posts: 6
- Joined: Mon Aug 18, 2014 10:21 am
Re: adafruit gps breakout v3.0
Attached is a picture of our selfdesigned pcb with the gps module on it. It uses an atmega2560. The gps module is on Serial3. We have noticed that we sometimes get incomplete messages aswell as the deadlock that sometimes happens. As I said it is impossible to give you all the code as it is a big project. But the relevant gps code has been included in the post before.
- Franklin97355
- Posts: 23911
- Joined: Mon Apr 21, 2008 2:33 pm
Re: adafruit gps breakout v3.0
OK, I have no more ideas. Perhaps someone will chime in here.
-
- Posts: 6
- Joined: Fri Jan 10, 2014 11:06 pm
Re: adafruit gps breakout v3.0
Curious as to how you are constructing the sentences with "\n\r" and also sending the command with _serial->println - aren't you essentially sending two "end" sentinels. Are you also sending the LRC?
Does the GPS respond with a good acknowledgement packet?
Does the GPS respond with a good acknowledgement packet?
- fleetprobe
- Posts: 6
- Joined: Mon Aug 18, 2014 10:21 am
Re: adafruit gps breakout v3.0
yes we know we send /n/r/n at the end, it is just to be on the safe side serial.println("command\r") should actually be enough. The LRC is sent in the initialization methods it starts after "*" and has been calculated according to the pmtk spec. For the parsing of messages we also check if the LRC is correct.
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: adafruit gps breakout v3.0
Try dropping the extra end-of-line characters. If the extra characters aren't spec, they aren't a safety margin.
Most text input handling is done with a state machine, and every input character triggers a transition. The input sequence "\n\r\n" will trigger three transitions to the "\n" sequence's one. It's possible that the input lexer is getting stuck in some kind of error state, or a state where it's waiting for a specific character sequence.
Most text input handling is done with a state machine, and every input character triggers a transition. The input sequence "\n\r\n" will trigger three transitions to the "\n" sequence's one. It's possible that the input lexer is getting stuck in some kind of error state, or a state where it's waiting for a specific character sequence.
Please be positive and constructive with your questions and comments.