Javelin and Parallax GPS problems
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.
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
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
It is attached for your convenience.
regards peter