Update rate resets after ~15 seconds

Home Forums Forums Technical Support for BerryGPS and BerryGPS-IMU Update rate resets after ~15 seconds

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #15942
    pi_user
    Participant

    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?

    #15944
    PeterP
    Participant

    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/serial0

    Peter --OzzMaker.com --

    #15945
    pi_user
    Participant

    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:

    ~290 ms

    ~530 ms

    ~52ms

    ~35ms

    ~82ms

    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.

    #15949
    pi_user
    Participant

    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)?

    #15950
    pi_user
    Participant

    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.

    #15952
    PeterP
    Participant

    Try using python threading;
    http://www.danmandle.com/blog/getting-gpsd-to-work-with-python/

    Here is how you can disable some of the sentences
    GSA
    echo -e -n "\$PUBX,40,GSA,0,0,0,0*4E\r\n" > /dev/serial0
    RMC
    echo -e -n "\$PUBX,40,RMC,0,0,0,0*47\r\n" > /dev/serial0
    GLL
    echo -e -n "\$PUBX,40,GLL,0,0,0,0*5c\r\n" > /dev/serial0
    ZDA
    echo -e -n "\$PUBX,40,ZDA,0,0,0,0*44\r\n" > /dev/serial0
    GGA
    echo -e -n "\$PUBX,40,GGA,0,0,0,0*5A\r\n" > /dev/serial0
    GSV
    echo -e -n "\$PUBX,40,GSV,0,0,0,0*59\r\n" > /dev/serial0
    VTG
    echo -e -n "\$PUBX,40,VTG,0,0,0,0*5E\r\n" > /dev/serial0

    Peter --OzzMaker.com --

    #15954
    pi_user
    Participant

    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).

    #15957
    PeterP
    Participant

    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
    cat /dev/serial0

    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 back

    Peter --OzzMaker.com --

    #15958
    pi_user
    Participant

    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!

    #15959
    PeterP
    Participant

    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”

    Peter --OzzMaker.com --

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.

Blip, blop, bloop…