Hardware GPS

From OpenTom

Jump to: navigation, search

The GPS unit is attached to the second UART of the S3C2410 (RxD1 and TxD1 on chip or ttyS1 in linux).

However, in order to power it (and the RF sub-assembly) up, you need to play a bit with GPIO. Please read the driver source for more information.

Also note that it is possible to update the GPS firmware over the serial port, if you set a specific GPIO pin.

The GPS is NMEA compatible.

There is a partnumber on top of the antenna that can be tracked back to a GPS receiver unit. Don't have it here on hand. Afaik it's SIRF2 - you might want to check the Hardware Variants Table.

TomTom Classic, 300, 500 and 700 use a SiRFstarIIe/LP Chip Set. See http://www.sirf.com/products-ss2eLP.html Reference: Users Guide, Appendix A: Specifications --> GPS receiver For application information of SiRFstarIIe/LP Chp Set see:

http://www.royaltek.com/manuals/RGM-3000%20Series%20Operation%20Manual%20V1.8.pdf http://www.royaltek.com/manuals/software%20interface%201.1(SIRF).pdf

TomTom One and Rider use SIRF3 Units.

Some source-code available in the trunk(s) ..../drivers/Barcelona/GPS/

The driver is accessible from the linux char device (preferred name 'gps') with major device number 243.

Example

Here is an example of how to get NMEA data from the TomTom ONE GPS Unit :

First, we have to power the GPS on :

 static int gpsfd = -1;
 gpsfd = open("/dev/gps", O_RDWR);
 if (gpsfd < 0)
 {
   printf("GPS unit: Failed to open '/dev/gps'.\n");
   gpsfd = -1;
   exit (1);
 }

Then, we open the serial port at 115200 bauds (ttySAC2 for most, ttySAC1 for Tomtom GO Classic and Rider):

 #include <termios.h>
 #include <fcntl.h>
 #include <stdio.h>
 
 char buffer[83];
 struct termios options;
 static int ttyfd = -1;
 ttyfd = open("/dev/ttySAC2", O_RDWR | O_NOCTTY | O_NONBLOCK);
 if (ttyfd < 0)
 {
   printf("TTY1 unit: Failed to open '/dev/ttySAC2'.\n");
   ttyfd = -1;
   exit (1);
 }
 // Get the current options for the port...
 tcgetattr(ttyfd, &options);
 // Set the baud rates to 115200...
 cfsetispeed(&options, B115200);
 cfsetospeed(&options, B115200);
 // Enable the receiver and set local mode...
 options.c_cflag |= (CLOCAL | CREAD);
 // Set the new options for the port...
 tcsetattr(ttyfd, TCSANOW, &options);

Now we can get the NMEA data :

 int read_len;
 int nl=0;
 while (nl < 50)
 {
   read_len = read(ttyfd, &buffer, sizeof (buffer));
   if (read_len > 0)
   {
      buffer[read_len-1] = 0;
      printf ("%s\n",buffer);
      nl++;
   }
 }

And we close the devices :

 close (ttyfd);
 close (gpsfd);


Note that for other TomTom models, you may have to use another serial port (probably /dev/ttySAC1)

This is an example of the NMEA data of the TomTom One :

 $GPGGA,074347.000,4338.1504,N,00658.6430,E,1,05,2.8,263.5,M,48.5,M,,0000*5D
 $GPGSA,A,3,01,30,05,25,06,,,,,,,,3.7,2.8,2.5*3D
 $GPGSV,2,1,08,06,77,241,14,30,66,073,32,05,38,095,18,25,38,305,30*72
 $GPGSV,2,2,08,01,25,276,27,02,21,046,23,14,17,234,,21,14,176,*73
 $GPRMC,074347.000,A,4338.1504,N,00658.6430,E,0.00,130.17,300106,,*06


How to decode Nmea Sentences

Personal tools