I've been trying *really* hard to change the update rate of my ultimate GPS connected to my Raspberry Pi.
It is connected through a USB to TTL adapter cable to /ttyUSB0.
I have tried many methods, including the code posted at the bottom of this thread:
viewtopic.php?f=19&t=39589
Code: Select all
#!/usr/bin/python
from serial import Serial
import time
#38400
serialPort = Serial("/dev/ttyAMA0", 38400, timeout=2)
if (serialPort.isOpen() == False):
serialPort.open()
outStr = ''
inStr = ''
serialPort.flushInput()
serialPort.flushOutput()
#for i, a in enumerate(range(33, 126)):
# outStr += chr(a)
#outStr = '$PMTK605*31\r\n'
#outStr = '$PMTK447*35\r\n'
#outStr = '$PMTK220,100*2F\r\n'
outStr = '$PMTK220,200*2C\r\n'
#outStr = '$PMTK220,1000*1F\r\n'
#outStr = '$PMTK220,10000*2F\r\n'
#outStr = '$PMTK314,1,1,1,1,1,5,0,0,0,0,0,0,0,0,0,0,0,0,0*2C\r\n'
#outStr = '$PMTK251,38400*27\r\n'
serialPort.write(outStr)
time.sleep(0.1)
inStr = serialPort.read(serialPort.inWaiting())
#inStr = serialPort.readall()
print "inStr = " + inStr
print "outStr = " + outStr
#if(inStr == outStr):
# print "WORKED! for length of %d" % (i+1)
#else:
# print "failed"
serialPort.close()
I also tried directly from the shell using the command
echo -e "\$PMTK251,38400*27\r\n" > /dev/ttyUSB0
to change the baud, and
echo -e "\$PMTK220,1000*2F\r\n" > /dev/ttyUSB0
to change the rate, but it didn't solve things..
In fact, once I changed the baud via that command I couldn't connect back to the GPS through the RPi. I was able to connect to the GPS on a windows machine with a different GPS program by specifying a 38400 baud rate, so the changes must have taken effect.
Is there some kind of setup where if connected through the serial adapter, you have to run at 9600?
Would love some help with this!