Gamebuino GPS problems

Understanding the language, error messages, etc.

Gamebuino GPS problems

Postby maesoser » Tue Aug 19, 2014 10:20 am

I've recovered a GPS module form an old hexacopter. I've tried to make a simple GPS sketch to the gamebuino but I've a problem that I cannot solve...All the values are 0, even when I know that the GPS module is transmitting GPS locations (lat, lon)

I'm using TinyGPS+ and SoftwareSerial library.

The serial connection is initialized with

Code: Select all
SoftwareSerial ss(RX_PIN, TX_PIN);


where

Code: Select all
#define RX_PIN  A4
#define TX_PIN  A5


The GPS is an U-BLOX NEO-6M mounted on a board called GY-GPS6MV2. It has been tested on a computer by using a Serial-To-Usb chip and a logic level converter (cause the module works at 3.3v)

The GPS and the Gamebuino are connected using one of the I2C ports of the Gamebuino, the port closest to the C button which has this pinout

GND VCC A4 CLK

I have connected the A4 pin to the TX pin on the GPS board.

I've sniffed the communication between TX and A4 and it contains usual NMEA sentences with latitude and longitude (That is, with the location correctly fixed)

This is the code. It's very straight-forward cause I'm only showing the date collected by the Tinygps++ library. That's why I think that the problem is that I'm not correctly using this library. Do you know what I'm doing wrong?

https://github.com/maesoser/Gamebuino_GPS
maesoser
 
Posts: 13
Joined: Wed Mar 26, 2014 11:38 pm

Re: Gamebuino GPS problems

Postby Myndale » Tue Aug 19, 2014 10:51 am

I think the problem is on this line:

Code: Select all
gps.encode(ss.read());


The ss.read() method returns a single character and gps.encode also accepts a single character, but gps.location won't contain valid data until you've read an entire NMEA line. Check for when gps.encode() returns true and only process the data then.

Sometimes all you need is a fresh set of eyes! :)
Myndale
 
Posts: 507
Joined: Sat Mar 01, 2014 1:25 am

Re: Gamebuino GPS problems

Postby maesoser » Tue Aug 19, 2014 3:30 pm

Oh, that makes sense!! Thanks!

But I've the gps.encode(ss.read()) inside the loop so there should be a moment in which this function should return "true" and updates the values (lat, lon, etc...) ¿no?

Despite of that I have tried to change gps.encode() ...

I've written:
Code: Select all
loop(){
if(gb.update)){
if(gps.encode(ss.read())){
//stuff
}


But then the sketch freezes more time than the time needed to send 74 chars at 9600 (That is the maximum length of an NMEA sentence I think)

I've also do a while like

Code: Select all
loop(){
while(!gps.enccode(ss.read())){
gb.display.println("Retrieving data");
}
if(gb.update()){
//stuff
}
}


But it also works either...
maesoser
 
Posts: 13
Joined: Wed Mar 26, 2014 11:38 pm

Re: Gamebuino GPS problems

Postby maesoser » Fri Aug 29, 2014 12:43 pm

If someone was wondering what happens with this problem (or someone has problems with serial communications) here it is the solution:

http://gamebuino.com/forum/viewtopic.php?f=11&t=1057&p=4692#p4692

Thanks for the support!!
maesoser
 
Posts: 13
Joined: Wed Mar 26, 2014 11:38 pm


Return to Programming Questions

Who is online

Users browsing this forum: No registered users and 6 guests