SparkFun Forums 

Where electronics enthusiasts find answers.

Tips and questions relating to the GPS modules from SFE
By tz
#80217
Low Power Mode:

They document it in the data sheet, look for a diode with battery backup. You need to keep power to the clock and SRAM for it to remember the position enough to start in a second or two.

To do a low power mode, you need to maintain VBatt above some low voltage - 1.2-1.5 volts or something, and it takes microamps so it isn't hard. Then shut off 3.3v. It won't track but will restart very quickly.

The problem is that on both SFBoBs VBatt is shorted to 3.3v.

(To Sparkfun - instead of a solder jumper shorted by default, you could put a schottky diode across the two - how expensive is the one they recommend in the data sheet? And do you know how hard it is to find an SMD diode to fit the shorting jumper?).

And Why it might take so long to start:

It needs power to remember the time and position for a fast fix. It doesn't say this but it may take several minutes under a clear sky from a cold start since it has to download all the data from several visible satellites before doing anything.

In "low power mode" it uses two search engines, in enhanced it uses four. If it has no idea of where and when it is, it needs to scan the entire GPS band (remembering doppler) until it hears something, tune and compensate, and when it tunes the signal sufficiently search for another sat while another section downloads the ephemeris, all which can take a while (and it needs a lock - a good signal - to do the download). That is why there have "61 channel" when only at most 14 might ever be used - to scan and do a first fix much faster, i.e. with 60 channels all looking they can each search 1/60th of the band.

This is what AGPS will bypass and why it also needs to know where you are in some cases. The AGPS download is FTP so it might be a problem depending on firewalling or other settings.
By tz
#80231
One other "trick".

You can get the ephemeris for a satellite - it will be valid for an hour or so (actually longer, but the satellite will go over the horizon and have to come back to be visible for it to be useful).

On the GPS Viewer it is called Get Ephemeris, which will save a log file.

There are binary commands to do the same thing.

If you then cold-start it, where it might normally take several minutes to get a fix, it should be able to do so within about 30 seconds.

Once a satellite has locked for a while, the ephemeris will be available and can be stored.

I don't know the format of the AGPS file, but my guess would be that it is a compressed Ephemeris for all satellites.
By tz
#80290
And AGPS should be directly available but it will take some time to decode (anyone want to help? hint hint).

The Eph.dat can be obtained from (.netrc):

machine 60.250.205.31
login skytraq
password skytraq
macdef init
prompt
passive
binary
cd ephemeris
get Eph.dat

Or the equivalent ftp:// url

ftp://skytraq:skytraq@60.250.205.31/ephemeris/Eph.dat

Note ftp://skytraq:skytraq@60.250.205.31/ephemeris shows the directory with other files.

To the GPS, each ephemeris record is 86 bytes (see data sheet), and this file has many sets of 86 byte records. The early fields have satellite number and some kind of time or place value, and the groups are in sequence of satellite number for a given time/place. You will get nearby time values somewhere if you save the ephemeris for the satellites using the utility.

Other files there are for individual satellites at various times, or Eph_4.dat which seems to be a "ready to upload to the chip" file.

"od -tx1 -w86" shows the pattern on a widescreen.

So to convert a cold start (taking 5 minutes with limited signal, or 1-2 minutes even open sky) to a warm/hot start, it might just be uploading the right set of records or copying Eph_4.dat out the serial port to the GPS.

I will probably try to experiment, but others might also want to try.
By tz
#80334
Sort of comfirmed.

"cat Eph_4.dat >/dev/ttyUSB0 ; time nl cat /dev/ttyUSB0"

will get a fix in 15-30 seconds.

Without the Eph_4 (in my room but with good sky view) it takes 50-70 seconds.
By rmw00
#81204
Please forgive my ignorance on the subject... I'd like to connect the Sarantel passive helical to the Venus module. My patch antenna has a very high resistance between the center and ouside of the connector and the Sarantel antenna appears to be almost a dead short. How would I connect the Sarantel instead of the patch? I'd like it connected directly off the edge of the board. (despite my RF ignorance, I can solder well).

Thanks!
By DC REdD
#81407
You would have to remove the DC bias with a blocking capacitor or by removing the DC bias inductor from the venus module first.

Read the "PowerHelix Electrical Integration Guidelines" from Sarantels website it provides everything you need to know.
By DC REdD
#81423
tz,

If you don't have this already it may help!
google "an0011 skytraq"

Its the Dat*sheet for AGPS binary commands, its for the venus 5 but applies to the venus 6

Sparkfun you could add it to the products page as it took me ages to find.
By tz
#81439
Thanks - but not quite. It has some AGPS status commands, there's a pointer to three other commands that do the upload but doesn't document them. But I'll keep looking
By DC REdD
#81482
Yes I still cannot find the magical skytraq api source thats referred to by several of the dat*sheets, however this very handy chap seems to have figured it out or obtained the information from skytraq....

h**p://code.google.com/p/skytraq-datalogger/downloads/list

I'm busy trying to reverse engineer his code for my pic24 project, however I haven't tried his software 'as is' becuase my venus is already attached to my pic.
By DC REdD
#81726
Right to download the AGPS data

Send: 0xA0, 0xA1, 0x00, 0x01, 0x35, 0x35, 0x0D, 0x0A (start DL)
Rec: 0xA0, 0xA1, 0x00, 0x02,0x83, 0x35, 0xB6, 0x0D, 0x0A (ACK)
Send: "BINSIZE = %lu Checksum = %lu \0"
where BINSIZE is the data length and Checksum is the sum of all bytes %256
Rec: "OK\0"
do
Send a block of 8192 bytes of data or whatever is left
Rec: "OK\0"
while (there is more data)
Rec: "END\0" (the Venus seems to send this twice ??)

If the checksum is wrong you will recieve "Error2\0"
If you send too little data the Venus times out and resets disabling AGPS aiding

The example app by skytraq sends 2 checksums (the second is the sum of the first 0x10000 bytes %256) however this seems to be ignored in the venus 6 so I've left it out.

DC REdD
By tz
#82113
You have to preset the baud rate manually or using something else (only tested at 57600 or faster). It enables agps at the end after uploading.

Lots of holes and places to lock if something goes wrong but shows the method in just over 100 lines.

You also need to download Eph.dat

e.g. make sure Eph.dat is not already there (it will download to Eph.dat.1 otherwise) and do
Code: Select all
wget ftp://skytraq:skytraq@60.250.205.31/ephemeris/Eph.dat
Linux/Posix based, adjust as needed.
Code: Select all
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>

static char string[64];
static void readtonull(int fd)
{
    int l;
    char *b = string;
    for (;;) {
        l = read(fd, b, 1);
        if (l <= 0)
            continue;
        if (!*b++)
            break;
    }
    printf("%s\n", string);
}

static unsigned char ephbuf[256 * 1024];
static const unsigned char setagps[8] = { 0xa0, 0xa1, 0x00, 0x01, 0x35, 0x35, 0x0d, 0x0a };
static const unsigned char agpsresp[9] = { 0xa0, 0xa1, 0x00, 0x02, 0x83, 0x35, 0xb6, 0x0d, 0x0a };
static const unsigned char agpsena[9] = { 0xa0, 0xa1, 0x00, 0x02, 0x33, 0x01, 0x32, 0x0d, 0x0a };

int main(int argc, char *argv[])
{
    int fd;
    char *gpsdev = "/dev/ttyUSB0";
    unsigned i;

    fd = open(gpsdev, O_RDWR);
    if (fd < 0)
        return -10;

    struct termios tio;
    if ((tcgetattr(fd, &tio)) == -1)
        return -1;
    cfmakeraw(&tio);
    if ((tcsetattr(fd, TCSAFLUSH, &tio)) == -1)
        return -1;
    // add: find baud rate

    unsigned char *ephdata;
    long ephbytes;

    ephdata = ephbuf;
    int ofd = open("Eph.dat", O_RDONLY);
    if (ofd < 0)
        return -2;
    ephbytes = read(ofd, ephbuf, 256 * 1024);
    if (ephbytes < 65536)
        return -3;

    // checksum
    unsigned char csuma, csumb = 0;
    for (i = 0; i < 0x10000; i++)
        csumb += ephdata[i];
    csuma = csumb;
    for (; i < ephbytes; i++)
        csuma += ephdata[i];

    // AGPS download startup: send command, get ack - maybe put in loop?
    do { // flush input buffer
        i = read(fd, string, 64);
    } while( i == 64 );
    printf( "Startup\n" );
    write(fd, setagps, 8);
    i = 0;
    while ( i < 0 || string[0] != '\xa0')
        i = read(fd, string, 1);
    while (i < 64) {
        i += read(fd, &string[i], 64 - i);
        if (i > 0 && string[i-1] == 0x0a)
            break;
    }
    printf( "Venus Ready\n" );
    if (memcmp(&string[i - 9], agpsresp, 9))
        return -6;
    
    /* start the transmission */
    sprintf(string, "BINSIZE = %ld Checksum = %d Checksumb = %d ", ephbytes, csuma, csumb);
    printf("%s:", string);
    write(fd, string, strlen(string) + 1);
    readtonull(fd);

#define BLKSIZ 8192
    while (ephbytes > 0) {
        printf("%ld left:", ephbytes);
        write(fd, ephdata, ephbytes > BLKSIZ ? BLKSIZ : ephbytes);
        readtonull(fd);        // OK
        ephbytes -= BLKSIZ;
        ephdata += BLKSIZ;
    }
    // Status "END" or "Error2"
    readtonull(fd);            // END

    sleep(1);
    write(fd, agpsena, 9);
    // maybe get ack?
    sleep(1);
    close(fd);
    return 0;
}
By cmcnall
#83066
anyone know if the spi flash chip that SFE has is compatible with the venus module? or more importantly the chips they have in their eagle library?
i just don't want to get screwed using one from the eagle library and have it not work with the gps.
By tz
#83068
The list of compatible flash chips are in the Skytraq/venus datasheet. I know the largest (64Mb) winbond works. It is available from DigiKey.

I don't think the one you refer to is compatible, but it would be nice to have a link to check.
By cmcnall
#83072
I found the SST 32mbit one from mouser has the same pin out as the eagle library. so i am going with that.
Thanks!
By cmcnall
#83076
does anyone have Sarantel eagle files? preferable the Active Sarantel 1010021 antenna?