GPSv2 inaccuracy

Moderators: lily.li, violet, jessie, chao.zhang

rhbroberg
Pre-kindergarten
Pre-kindergarten
Posts: 27
Joined: Thu Feb 04, 2016 12:20 pm

Re: GPSv2 inaccuracy

Post by rhbroberg » Fri Mar 04, 2016 3:39 am

I can confirm that flashing the GPS xadow board following the process defined in this other forum post:

http://www.seeedstudio.com/forum/viewto ... =71&t=6722

worked properly for me; my code changes I submitted above have addressed the longitude string parsing error.

The process is straightforward, assuming you have an 8266 board sitting around. Soldering 2 wires to the bottom pads of the GPS xadow part is required.

However, I have a new problem with the GPS code. It was true even before the flash of the fixed code. Every once in a while, the string returned for latitude or longitude is off by 2 orders of magnitude (e.g., 7200.ab rather than 72.yz). It's not just a shift of the digits (as if the decimal place was in the wrong location).

More as I dig deeper

haugen.steinar
Pre-kindergarten
Pre-kindergarten
Posts: 7
Joined: Sun Jan 17, 2016 10:10 am

Re: GPSv2 inaccuracy

Post by haugen.steinar » Fri Mar 04, 2016 5:01 am

Same bug seen here also, one of ten telegram are wrong
I debug-print the I2C data coming from the Xadow GPS module, so the error must be in the parsing software in the module

3936332E343035353336
GPS latitude is N:63.405537
5A3031302E333137323733
GPS longitude is E:10.317273

39363332342E33323931
GPS latitude is N:6324.329102
5A30313031392E30333531
GPS longitude is E:1019.035095

So, digging here also ;-)
-Steinar

rhbroberg
Pre-kindergarten
Pre-kindergarten
Posts: 27
Joined: Thu Feb 04, 2016 12:20 pm

Re: GPSv2 inaccuracy

Post by rhbroberg » Fri Mar 04, 2016 5:15 am

I'm pretty sure the problem is a race condition.

The gps.c file consumes 1 byte at a time from the UART polling, and parses it (ultimately calling the gps_data_convert() function which was fixed). However, the i2c callback (i2c_slave_callback) is invoked whenever the rePhone Wire library asks for some data, and there is nothing to protect the data field GPS_RMC_Data from being read by i2c at the same time it is being rewritten by gps_data_convert(). The default gps frequency is 1Hz, so that string is being rewritten every second.

Given that the string in GPS_RMC_Data is both the source *and* the destination for gps_data_convert() makes it especially problematic. I think if different strings were used, at least if i2c_slave_callback() was reading the string while it was in the middle of being written by gps_data_convert(), it wouldn't be as incorrect.

I believe the correct fix is to change gps_data_convert() to write out its converted string to a different buffer, the buffer which i2c_slave_callback() reads, rather than re-using the buffer which is initialized from the UART data. That's an easy fix, achievable by creating 2 GPS_RMC_Data static variables, updating the gps_data_convert() to read from the existing one, and write out to the new one, and let the i2c callback read from the new one.

-----

A better, but more involved fix would be to move all of the NMEA string parsing to the RePhone side of things, and change the gps driver logic on the GPS board to simply have a buffer to hold each of the 6 NMEA string values, which it overwrites as each new one comes in, and use a standard arduino gps parsing library at the RePhone side.

rhbroberg
Pre-kindergarten
Pre-kindergarten
Posts: 27
Joined: Thu Feb 04, 2016 12:20 pm

Re: GPSv2 inaccuracy

Post by rhbroberg » Sat Mar 05, 2016 12:22 am

I can confirm that using a different structure to hold onto the 'converted' data from the initial structure appears to have eliminated the problem for me - I ran with the modified firmware last night for an 8 hour stretch with no order-of-magnitude latitude or longitude data values.

I will fork and post my changes to github so they can be pulled into the maintainer's repo for something official.

In the meantime, here is my updated hexfile with the changes

getmemot
Pre-kindergarten
Pre-kindergarten
Posts: 20
Joined: Tue Feb 09, 2016 10:28 pm

Re: GPSv2 inaccuracy

Post by getmemot » Sat Mar 05, 2016 2:49 am

I can seem to to get the program on the ESP8266 i have the following error below

I have a arduino uno i have connected the follow

I have removed the chip from the UNO and connected it up the following

Arduino UNO ESP8266(ESP-12F)
RX -----------> RX (Logic Level Shifter Converter)
TX -----------> TX
3.3v -----------> VCC
GND -----------> GND
3.3v -----------> CH_EN

and im getting the following error

Code: Select all

warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
Image

I'm not sure what am doing wrong.

rhbroberg
Pre-kindergarten
Pre-kindergarten
Posts: 27
Joined: Thu Feb 04, 2016 12:20 pm

Re: GPSv2 inaccuracy

Post by rhbroberg » Tue Mar 08, 2016 2:29 am

I used a Adafruit 8266 Huzzah part. This series of web pages is a great introduction

https://learn.adafruit.com/adafruit-huz ... t/overview

You may want to look at this page in there

https://learn.adafruit.com/adafruit-huz ... odemcu-lua

showing the right way to connect USB to your 8266

bconstructive
Pre-kindergarten
Pre-kindergarten
Posts: 22
Joined: Tue Feb 02, 2016 6:18 am

Re: GPSv2 inaccuracy

Post by bconstructive » Wed Mar 23, 2016 12:03 am

My GPS modules return coordinates that are about twenty miles off. After reading this post from the beginning it isn't clear to me what I need to do to fix this issue.
Would someone kindly point me in the right direction?
I see the .hex file above. Does it fix the GPS module's inaccuracy? If so, what does one do with that file?

Thanks for taking the time to answer.

rhbroberg
Pre-kindergarten
Pre-kindergarten
Posts: 27
Joined: Thu Feb 04, 2016 12:20 pm

Re: GPSv2 inaccuracy

Post by rhbroberg » Tue Mar 29, 2016 8:13 am

Someone needs to make a complete how-to. The problem is that there is flashed code in the xadow gps board and there is no easy way to re-flash it from the existing development environment.

I've posted a hex file which fixes both the inaccuracy as well as the race condition. The race condition can be seen by a random misplaced decimal point in the latitude or longitude. The inaccuracy is due to a boundary condition on a loop starting in the wrong string location for parsing.

You need a soldering iron, some small wires (i use wires I take from a cat/5 cable), an Arduino 8266 part, and (optionally) a breadboard (makes the various connections simpler), the Arduino IDE, and a little patience.

You have to solder two wires to the SWCLK and SWIO pins on the bottom of the GPS board, then hook up those 2 pins (and vdd and gnd) to another Arduino part to re-flash.

I took an Adafruit 8266 huzzah board, installed the board into my Arduino IDE, then loaded the arduinio code pointed to by the previous poster's URL (looks like ardunio code). You map 2 gpio pins from the 8266 onto the the 2 soldered pins from the GPS board and run the little flashing program (for me on my part, gpio#0 and gpio#1). It takes just a minute or 2 for the actual flashing to occur.

That's the overview. Going back and looking at previous posts and the URLs might make a little more sense now. The true error is not that there is a bug in the code; the issue is that no provision was made to more easily update the code on the gps part. Hopefully a future version of the part will allow you to bridge a few connections on the GPS part and allow the hex file to go across the little xadow connector from the 2502 (rephone) part; either that, or use the GPS part which Linkit has done all the work for already for the 2502 part; or change the driver to be much simpler and only provide a i2c mechanism to the UART on the GPS chip.

ariel_e_flores
Pre-kindergarten
Pre-kindergarten
Posts: 3
Joined: Sun Mar 29, 2015 12:48 pm

Re: GPSv2 inaccuracy

Post by ariel_e_flores » Sun May 22, 2016 8:25 am

I have the same problem and do not understand the process to solve it. I think seeed should provide a How-To or replace parts per RMA.

mirolima
Pre-kindergarten
Pre-kindergarten
Posts: 1
Joined: Tue Jul 12, 2016 7:54 am

Re: GPSv2 inaccuracy

Post by mirolima » Wed Jul 20, 2016 3:37 am

I' m facing the same issue, has anyone fixed it and have the step-by-step to get my xadow GPS v2 module updated?

Post Reply