Home › Forums › Forums › Technical Support for BerryGPS and BerryGPS-IMU › Update rate resets after ~15 seconds
- This topic has 9 replies, 2 voices, and was last updated 2 years, 11 months ago by PeterP.
- June 24, 2020 at 12:04 pm #15942
I’ve been following https://ozzmaker.com/berrygps_imu-faq/ to change the NMEA sentence update rate, but it appears to reset/lose the settings after about 10-15 seconds.
I have a python script using the standard gps lib, and it initially reports a correct BPS of 115200 for the device, but shortly after it goes back to 9600. Anything obvious I should be doing differently?June 24, 2020 at 2:52 pm #15944
im not sure what it is doing that.
you could try this to set this speed to see if it makes a difference
sudo gpsctl -s 115200 -D 1 -t u-blox /dev/serial0June 24, 2020 at 3:47 pm #15945
Maybe I’m chasing the wrong thing. I tried that command, and while it seems to “stick” for a bit longer, it actually doesn’t seem to help. I used https://ozzmaker.com/using-python-with-a-gps-receiver-on-a-raspberry-pi/ as a reference, and added some timing reports. Without having a time.sleep at all, the loop consistently reports the following for how long gpsd.next() takes:
Adding to about 1000ms…like clockwork. I know there is some overhead in pulling from gpsd, but the pattern is just weird to me. Ultimately what I’m trying to achieve is running the GPS at 10hz, and being able to sample it with ~30ms response time at most.June 25, 2020 at 1:13 pm #15949
Okay, starting to understand it a little better. The majority of the delay seems to be when there is a SKY report…which consistently takes 600-620ms. There is also an occasional GST report, and I’ve noticed that sometimes the 3D TPV reports take 100-200ms.
For my use-case, I really only need a 2D TPV report (I’m only measuring speed). Is there any way to cut down on all this “noise” so I can get those (since they take 30-50ms on average)?June 25, 2020 at 1:56 pm #15950
I also tried a very simple script that connects to the serial port directly and reads the raw data…it’s printing out the speed at 1hz. If I change the baud rate in my code, it no longer connects/spits out data – it has to be 9600, even if I try using all the commands (including the one you provided) to change the baud rate of the gps and serial port.June 25, 2020 at 3:07 pm #15952
Try using python threading;
Here is how you can disable some of the sentences
echo -e -n "\$PUBX,40,GSA,0,0,0,0*4E\r\n" > /dev/serial0
echo -e -n "\$PUBX,40,RMC,0,0,0,0*47\r\n" > /dev/serial0
echo -e -n "\$PUBX,40,GLL,0,0,0,0*5c\r\n" > /dev/serial0
echo -e -n "\$PUBX,40,ZDA,0,0,0,0*44\r\n" > /dev/serial0
echo -e -n "\$PUBX,40,GGA,0,0,0,0*5A\r\n" > /dev/serial0
echo -e -n "\$PUBX,40,GSV,0,0,0,0*59\r\n" > /dev/serial0
echo -e -n "\$PUBX,40,VTG,0,0,0,0*5E\r\n" > /dev/serial0June 26, 2020 at 5:05 am #15954
The threading definitely helped with the script itself, but the GPS is still only refreshing the values 1/sec, i.e. if I sleep for .1 seconds, the same speed is reported 10 times. Is there any way to truly confirm if the rate changes are “sticking”? None of the commands report errors unless I do something explicitly wrong (e.g. if I try echoing to the serial port while gpsd is running, or if I try using the gpsd command when it’s not running).June 26, 2020 at 11:40 am #15957
Have you tried to stop GPSD and see what happens? I think it mighty be GPSD changing it back to 9600.
1. Stop GPSD
sudo systemctl stop gpsd.socket
2.change the speed on the GPS module to 115200
echo -e -n "\xB5\x62\x06\x00\x14\x00\x01\x00\x00\x00\xD0\x08\x00\x00\x00\xC2\x01\x00\x07\x00\x03\x00\x00\x00\x00\x00\xC0\x7E" > /dev/serial0
3.change the baud rate on Pi Serial
stty -F /dev/serial0 115200
4. check that you can still see the NMEA data at the new speed
5. change update rate to 10Hz
echo -e "\xB5\x62\x06\x08\x06\x00\x64\x00\x01\x00\x01\x00\x7A\x12" > /dev/serial0echo -e "\xB5\x62\x06\x08\x06\x00\x64\x00\x01\x00\x01\x00\x7A\x12" > /dev/serial0
6. wait and see if it changes backJune 26, 2020 at 11:57 am #15958
Welp…you indirectly solved it. The command for 10hz on the FAQ page has \B5 instead of \xB5…didn’t notice until you pasted a copy of the command here. After fixing that, I can now use GPSD and am getting 10hz updates!June 26, 2020 at 12:09 pm #15959
great!… and I feel a little guilty. I noticed the error on the FAQ page just before I posted and got someone to update it. Sorry for the “run around”
- You must be logged in to reply to this topic.