Shop OBEX P1 Docs P2 Docs Learn Events
Javelin and Parallax GPS problems — Parallax Forums

Javelin and Parallax GPS problems

ramman345ramman345 Posts: 24
edited 2007-10-17 06:06 in General Discussion
Hey Guys, I'm using a Javelin with a parallax GPS module. I can retrieve the device info (hw and sw versions), and I can also poll for signal validity. Both of those communications work fine. But once the GPS signal is valid, I get no response from the GPS module on any requests for # sats, time, or heading. Here is an example of my code to get the # sats:

static String GPS_get_sats()
{
GPSio.setDirection(Uart.dirTransmit);

GPSio.sendString("!GPS");
GPSio.sendByte(get_no_sats);

GPSio.setDirection(Uart.dirReceive);

response.clear();
response.append("# Sats: ");
response.append(GPSio.receiveByte());

return response.toString();
}

Again, communication works fine for two functions, but not any "real" info queries.

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-10-17 05:44
    Because you use a Uart object for both directions,
    you must allow the transmitter to finish before
    changing direction.

    static String GPS_get_sats()
    {
    GPSio.setDirection(Uart.dirTransmit);

    GPSio.sendString("!GPS");
    GPSio.sendByte(get_no_sats);
    while (!GPSio.sendBufferEmpty()) ; //wait until transmitter finished and nothing is being sent

    GPSio.setDirection(Uart.dirReceive);

    response.clear();
    response.append("# Sats: ");
    response.append(GPSio.receiveByte());

    return response.toString();
    }


    It is quite possible that due to the wait, you miss the first
    byte(s) of the response, that depends on the response time
    of the GPS device.
    In that case you must use 2 uart objects, one for transmit and one for receive.

    JavRxPin o
    +
    o GPS dataPin
    ··················· |
    JavTxPin o---[noparse][[/noparse]1k]---+

    Because anything sent by the Javelin is now also received
    by the Javelin,·you must filter out these echoes.

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-10-17 06:04
    I found a gps class that I wrote some time ago.
    It is attached for your convenience.

    regards peter
  • ramman345ramman345 Posts: 24
    edited 2007-10-17 06:06
    Thanks a bunch Peter. I'll let you know if it works in the morning.
Sign In or Register to comment.