# Garbage reading GPS

**URL:** <https://forums.digi.com/t/garbage-reading-gps/9090>\
**Category:** Rabbit\
**Created:** [June 1, 2007, 6:21am UTC](https://forums.digi.com/t/garbage-reading-gps/9090 "2007-06-01T06:21:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xcesmess](https://avatars.discourse-cdn.com/v4/letter/x/c6cbf5/32.png) [@xcesmess](https://forums.digi.com/u/xcesmess)\
**Post date:** [June 1, 2007, 6:21am UTC](https://forums.digi.com/t/garbage-reading-gps/9090/1 "2007-06-01T06:21:44Z")

</div>

I finally got my GPS unit in but I’m having a heck of a time getting it to connect. It is a Garmin GPS15 and has 0-3.3v CMOS serial output (two wire).

I’m using a 3100 on the prototype board and I’ve tried hooking it up to RxC/TxC on J5 and then I’ve also hooked it up to PC2/PC3 on the headers but all I typically get is garbage when I manually read the port (not even sure I’m doing that right!) I’ve tried the sample GPS application and all I get is the sample distance (LA to whatever) and then it just sits.

The GPS is running at 4800bps fixed. The datasheet on the GPS is here: [http://www8.garmin.com/manuals/GPS15\_TechnicalSpecification.pdf](http://www8.garmin.com/manuals/GPS15_TechnicalSpecification.pdf)

Any help would be appreciated!

Thanks!  
Kelly Koehn

---

<div class="post-metadata">

**Author:** ![xcesmess](https://avatars.discourse-cdn.com/v4/letter/x/c6cbf5/32.png) [@xcesmess](https://forums.digi.com/u/xcesmess)\
**Post date:** [June 2, 2007, 2:35am UTC](https://forums.digi.com/t/garbage-reading-gps/9090/2 "2007-06-02T02:35:55Z")

</div>

Well I’ve decided to contact support on this issue. I’ve been working with some folks on the Yahoo Rabbit group with no success. However I have done some testing here on my own.

I have verified the GPS is working. I built a CMOS to RS-232 converter and hooked it up to my laptop. I am able to read the ASCII output from the GPS.

I’m suspecting that I’ve got a possible prototyping board problem as I can switch core modules out (I have a 3100 and 3110 both) and both units mimic the same problem (scrambled ascii output). I’ve switched the ports to port B and C (Rx obviously) and still receive nothing but scrambled text.

What is the likelihood that the serial port(s) on this board could be toast?

I’ll attach a copy of my code to the bottom of this. It is merely just the GPS\_SAMPLE program with a small printf command to show me the raw data coming in.

Any help or advice would be appreciated… starting to get desperate here!

Thanks  
Kelly

Here is a small sample of what the Rabbit gives me in STDIO:  
����y��q\_qYS��������������������������������������������������������������[u��  
��e��e��\_e�Y���}���������������������������\_q������������Q��������������q\_qY}�}  
������������������������������������������y��q\_qYS������������������������������

Here is a sample of what SHOULD be giving:  
$GPRMC,012616,A,3747.8016,N,09718.3226,W,0.0,20.2,020607,5.0,E\*5A  
$GPGGA,012616,3747.8016,N,09718.3226,W,1,05,2.1,427.3,M,-27.0,M,_74  
$GPGSA,A,3,03,10,13,16,27,2.3,2.1,1.0_33

Here is the code that I’m using on the Rabbit:

#class auto

#use “gps.lib”

#define BINBUFSIZE 127  
#define BOUTBUFSIZE 127

#define MAX\_SENTENCE 100

// names of days of week  
const char dayname[7][4] = {“Sun”,“Mon”,“Tue”,“Wed”,“Thu”,“Fri”,“Sat”};  
const char monthname[12][4] = {“Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”,  
“Jul”, “Aug”, “Sep”, “Oct”, “Nov”, “Dec”};

GPSPosition current\_pos;  
struct tm current\_time;

void main()  
{  
char sentence[MAX\_SENTENCE];  
int input\_char;  
int string\_pos;  
char dir\_string[2];

```
//calculate distance from known coordinates
GPSPosition la_loc, sf_loc;

la_loc.lat_degrees = 34;
la_loc.lat_minutes = 00.0;
la_loc.lat_direction = 'N';
la_loc.lon_degrees = 118;
la_loc.lon_minutes = 15.0;
la_loc.lon_direction = 'W';

sf_loc.lat_degrees = 37;
sf_loc.lat_minutes = 45.0;
sf_loc.lat_direction = 'N';
sf_loc.lon_degrees = 122;
sf_loc.lon_minutes = 27.0;
sf_loc.lon_direction = 'W';

serBopen(9600);
string_pos = 0;
dir_string[1] = 0;

//printf("SF to LA:%f km

```

", gps\_ground\_distance(&sf\_loc, &la\_loc));

```
//receive and parse GPS data
while(1)
{
	input_char = serBgetc();
  printf("%c", input_char);

	if(input_char == '\r' || input_char == '

```

‘)  
{  
sentence[string\_pos] = 0; //add null  
printf("%s  
", sentence);  
if(gps\_get\_position(&current\_pos, sentence) == 0)  
{  
dir\_string[0] = current\_pos.lat\_direction;  
printf("Latitude: %d %f’ %s  
",  
current\_pos.lat\_degrees, current\_pos.lat\_minutes,  
dir\_string);  
dir\_string[0] = current\_pos.lon\_direction;  
printf("Longitude: %d %f’ %s  
",  
current\_pos.lon\_degrees, current\_pos.lon\_minutes,  
dir\_string);

```
		}
		if(gps_get_utc(&amp;current_time, sentence) == 0)
		{
			printf("UTC: %s %d-%s-%d %02d:%02d:%02d

```

",  
dayname[current\_time.tm\_wday],  
current\_time.tm\_mday,  
monthname[current\_time.tm\_mon - 1],  
1900 + current\_time.tm\_year,  
current\_time.tm\_hour,  
current\_time.tm\_min,  
current\_time.tm\_sec );  
}  
string\_pos = 0;  
}  
else if(input\_char \> 0)  
{  
sentence[string\_pos] = input\_char;  
string\_pos++;  
if(string\_pos == MAX\_SENTENCE)  
string\_pos = 0; //reset string if too large  
}  
}

}

---

<div class="post-metadata">

**Author:** ![xcesmess](https://avatars.discourse-cdn.com/v4/letter/x/c6cbf5/32.png) [@xcesmess](https://forums.digi.com/u/xcesmess)\
**Post date:** [June 2, 2007, 5:56am UTC](https://forums.digi.com/t/garbage-reading-gps/9090/3 "2007-06-02T05:56:12Z")

</div>

Well I’ve discovered the mystery to why reading a GPS was such a hassle… and possibly why my PWM’s quit functioning. Something on teh prototyping board has went awry. I took the core off the board and only used the voltage regulators on the board… hooking all my jumpers directly to the core… and everything works flawlessly. I can read text from the GPS, motor controllers work… just like it should.

I wonder if anyone else has experienced this kind of failure on the 3x series board…

I guess a call to the reseller and/or manufacturer is on the way…

Kelly
