GPSv2 inaccuracy

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

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

GPSv2 inaccuracy

Post by rhbroberg » Thu Feb 18, 2016 6:20 am

After a full cold start I am able to replicate this problem: I am in the Eastern United States, and the gps coordinates for my location (when the gps has full view of the sky and reports 8 satellites found) are correct for latitude but off by 0.665 (decimal) in longitude (at least 60 miles from where I am). The longitude changes as I move the gps to different locations, but it's always off by this significant amount. I've verified my coordinates with multiple other sources (including Google Maps, Apple maps, my mobile phone, etc.) - it's the rephone gps which is incorrect. I use https://www.fcc.gov/media/radio/dms-decimal to convert the decimal values to degrees minute seconds for comparison to other devices.

Any ideas?

dbelam
Elementary-1
Elementary-1
Posts: 157
Joined: Wed Feb 03, 2016 2:59 am

Re: GPSv2 inaccuracy

Post by dbelam » Thu Feb 18, 2016 5:12 pm

Could you please send some displayed value and raw sensor data, preferably binary values read from the GPS?

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

Re: GPSv2 inaccuracy

Post by rhbroberg » Thu Feb 18, 2016 10:51 pm

The GPS library with the rephone only returns decimal values from the gps - I'm not sure what you mean by raw values, unless you mean the NMEA strings which are captured and converted by the library itself. I will instrument the underlying library to print out those strings directly for comparison

dbelam
Elementary-1
Elementary-1
Posts: 157
Joined: Wed Feb 03, 2016 2:59 am

Re: GPSv2 inaccuracy

Post by dbelam » Thu Feb 18, 2016 11:53 pm

Yeah, I meant that :)
I think it's a float conversion problem, since the CPU has no hardware-FPU. Or just the library has a bug.

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

Re: GPSv2 inaccuracy

Post by rhbroberg » Fri Feb 19, 2016 2:45 am

It looks like the gps NMEA string parsing is done here

https://github.com/WayenWeng/Xadow_GPS_v2.git

The parsing/math in this file is incorrect:

https://github.com/WayenWeng/Xadow_GPS_ ... rces/gps.c

When I run my longitude through the algorithm used in that file, it produces the incorrect decimal representation, as the indexes being traversed for the string are using the wrong range (longitude has three digits of degrees, not two, so grabbing the minutes part should start at index 3, not 2).

I cannot find where/how the code from that library is linked into my .vxp file; I need some guidance from that library maintainer on how to make change to it and deploy it to my part. Is this something compiled into the firmware image?

dbelam
Elementary-1
Elementary-1
Posts: 157
Joined: Wed Feb 03, 2016 2:59 am

Re: GPSv2 inaccuracy

Post by dbelam » Fri Feb 19, 2016 4:31 am

It seems it's the gps module firmware. As soon as I get to a PC I'll check everything.

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

Re: GPSv2 inaccuracy

Post by rhbroberg » Fri Feb 19, 2016 8:10 am

this test code shows the good and bad value being generated; you can confirm by running any constant you use with the website above to convert from that format to the decimal format.

int
main()
{
char *longitude = "07218.57692";

int Data = 0;


// BAD!

for (int i=2; i< 10; i++)
{
if (i == 5) continue;
Data = Data * 10 + longitude - '0';
}

Data = Data * 5 / 3;

printf("%d\n", Data);

Data = 0;

// GOOD!

for (int i=3; i<10; i++)
{
if (i == 5) continue;
Data = Data * 10 + longitude - '0';
}

Data = Data * 5 / 3;

printf("%d\n", Data);
}

Arguably, this parsing code shouldn't live in the firmware, but in the user-space code. I think it would make more sense to have an interface from the firmware which returns the entire NMEA string, and allows user-modifiable code to do the parsing. Plus, there are many existing gps parsing libraries which already exist so they could be leveraged. If this does cause a firmware bump, I'd like to see a follow-on bump which exposes the interface to the gps chip a little more. This could also make it easier to send the gps commands for the different power savings modes more easily.

sheyong5499
Pre-kindergarten
Pre-kindergarten
Posts: 6
Joined: Fri Feb 19, 2016 4:27 pm

Re: GPSv2 inaccuracy

Post by sheyong5499 » Fri Feb 19, 2016 4:35 pm

Thanks for pointing the issue out.

Wondering if there is any possible way to update the GPSv2 firmware without Freescale tool?

jinyuan.weng
Pre-kindergarten
Pre-kindergarten
Posts: 33
Joined: Tue Jan 26, 2016 5:17 pm

Re: GPSv2 inaccuracy

Post by jinyuan.weng » Fri Feb 19, 2016 5:50 pm

Hi,
I found the GPSv2 base on STM32F030, and the develop IDE is Freescale Kinetis Design Studio.
Maye we can build the project with KDS and flash the hex file with a j-link.

dbelam
Elementary-1
Elementary-1
Posts: 157
Joined: Wed Feb 03, 2016 2:59 am

Re: GPSv2 inaccuracy

Post by dbelam » Fri Feb 19, 2016 6:01 pm

sheyong5499 wrote:Thanks for pointing the issue out.
Wondering if there is any possible way to update the GPSv2 firmware without Freescale tool?
So the next task is to find, if it has a bootloader installed :D

Post Reply