Collecting raw Ublox data with RTKLIB

[Update 2/8/20:  At this point in time, much of this post is out of date. Please see some of my more recent posts for more up to data information. Specifically though:

  • Another RTKLIB choice is my demo5 code which has been optimized for low-cost receivers, especially the u-blox receivers.  This is the code I would recommend now.  The source code is available here and Windows executables are available here]
  • The TRK-MEAS and TRK-SFRBX messages on the most recent version of the M8N are now scrambled, making raw observations unavailable on this receiver. You will need to use either the u-blox M8T, M8P, or F9P receiver, and enable the RXM-RAWX and RXM-SFRBX messages.
  • These days I typically configure the receiver using u-blox u-center and save to flash rather than using the RTKLIB CMD messages, since the user interface is simpler
  • The Embarcadero compiler is now available for free and has been for quite a while]

At this point, we have verified that the GPS hardware and the link to the PC are working properly, and are ready to start using RTKLIB to collect the raw GPS data.

Start by downloading RTKLIB from Github.  Choose either the main branch (2.4.2.11) which is the stable branch or 2.4.3 which is a beta branch (currently at revision b8).

Recent check-ins have all been made on the beta branch, but most or all of the recent work appears to be unrelated to Ublox receivers or the  kinematic mode normally used for low cost receivers, so the functionality of the code should be nearly identical regardless of which branch you choose.  I am using 2.4.3 because I think it may be easier to merge in any future changes.  The repository includes all the executables, so there is no need to build any code before running it.

There are actually two sets of executables built from the same codebase, a GUI set, and a CUI set.  I am using a combination of the two.  For collecting the raw data, and plotting the results, I use the GUI versions (STRSVR and RTKPLOT) for convenience.  For converting the raw data to RTCM and processing the data, I use the CUI versions (CONVBIN and RTKPOST).  This is for two reasons.  First, because making any changes to the GUI versions requires  an Embarcadero/Borland VCL compiler to re-build the code and this compiler is not available for free.

The CUI versions can be rebuilt with the Microsoft Visual C++ compiler, which is free and one I am also much more familiar with.  The second reason I use the CUIs is because I have found it easier to keep track of all the input and output files for each run when using the CUIs.  I use simple Matlab wrappers to call the CUIs which save all the configuration, input, and output information to a separate folder.  Python wrappers would probably work just as well and it is available for free, but I already have Matlab and again am more familiar with it.

Once RTKLIB is downloaded, and the GPS receiver is connected to your PC via USB, start the STRSVR program (strsvr.exe).  It can be found in the rtklib\bin folder.  Set the Input Stream to “Serial” and use the “Opt” button to set the port and baudrate to match your GPS receiver.  If you’ve been communicating to the receiver with U-center or any other application, make sure you have disconnected them from the com ports to avoid any conflicts.

Next we need to configure the receiver to output the raw GPS signals, pseudorange, carrier phase, doppler, and SNR.   For the Neo-M8N receiver this requires us to use the normally undocumented commands TRK-MEAS and TRK-SFRBX.  First select the “Cmd” button for the input stream and copy the following commands into the “Commands at startup” window.

!UBX CFG-GNSS 0 32 32 1 0 10 32 0 1
!UBX CFG-GNSS 0 32 32 1 6 8 16 0 1
!UBX CFG-MSG 3 15 0 1 0 1 0 0
!UBX CFG-MSG 3 16 0 1 0 1 0 0
!UBX CFG-MSG 1 32 0 1 0 1 0 0

Make sure the “Commands at startup” box is selected, then click the “Save” button to save.  STRSVR will send these commands to the receiver at startup.  The third and fourth commands in this list enable the TRK-MEAS and TRK-SFRBX commands to the USB and UART ports.  See pages 9-13 of this document for an explanation of exactly what these numbers do.  The first and second commands are documented commands to configure how many channels the receiver should allocate to GPS and GLONASS.  Details are explained in the M8 Receiver Description under the CFG-GNSS command.  We could have configured these with the Ublox eval software in the last post, but I thought it was easier to do it all in one place, and also more consistent with other references.

strsvr

Next, set Output (1) to “File” and use the “Opt” button to select a file name to save the data to.  I use a “.ubx” extension for this raw binary data.  Finally, click on “Start” to start collecting receiver data.  If everything is working properly, it should look something like this:

strsvr_run

In the next post we will use RTKLIB to convert this Ublox proprietary binary data to a more friendly text version.

91 thoughts on “Collecting raw Ublox data with RTKLIB”

  1. Hi, I have been using the Ublox C94-M8P 2 receiver along with the U-center program for recording of GNSS data. It gives ubx file but when I try to convert the file into RINEX format, it only gives obs file and I can’t see any nav file. I have enabled the RXM SBFRX and RXM RAWX messages but nothing happened.

    Like

    1. Hi Imtiaz. I would suggest opening the ubx file with u-center, opening the packet view, and playing the file. This will give you an independent confirmation if the SFRBX messages are present in the file. If they are there, I don’t know why you would not be getting a nav file, assuming that you have the box next to the nav filename in RTKCONV selected, your ubx file is at least a few minutes long, and your antenna is located outdoors.

      Like

  2. Hi Tim,

    Thanks for sharing such a nice experience with everyone. I need to run RTKPOST through MATLAB, and consequently load a certain configuration file, upload raw files, and so on. Do you have any article discussing that? I would appreciate any assistance.
    Thanks!

    Hassan

    Like

    1. Hi Hassan. From MATLAB it will be much easier to run RNX2RTKP, the CUI version of RTKPOST. The raw data files, config file, etc are all specified as command line parameters. Instructions for using RNX2RTKP are in the RTKLIB manual.

      Like

      1. Thanks Tim for your response, to be honest, I didn’t experience a similar task before in MATLAB, I checked RTKLIB’s manual and checked that part where they even gave some examples about using RNX2RTKP, but when I tried to implement that in MATLAB, I couldn’t do it. Are there any preceding steps before calling this function in MATLAB? Actually, calling RNX2RTKP is being done through specific functions in MATLAB? I would appreciate your answer.

        Like

        1. Hi Hassan. I use the “dos” command in matlab to simply send a command line to the operating system to run one of the RTKLIB CLI apps. For example to run RNX2RTKP, I would use something like: dos(‘rnx2rtkp.exe -k config.conf -o out.pos rover.obs base.obs rover.nav’)

          Like

          1. I’m very very grateful for your assistance, now I can run RTKLIB through MATLAB for mass processing, just need to handle the naming of the inserted files and that’s it. Thank you very much.

            Like

  3. Hi, thank you for the wonderful blog. I am trying to obtain raw data from my ublox-M8N. My firmware version is 2.01. I am trying to get the Raw measurement data but I am not able to get it. I have followed all the instructions. I have used the following command:
    !UBX CFG-GNSS 0 32 32 1 0 10 32 0 1
    !UBX CFG-GNSS 0 32 32 1 6 8 16 0 1
    !UBX CFG-MSG 3 15 0 1 0 1 0 0
    !UBX CFG-MSG 3 16 0 1 0 1 0 0
    !UBX CFG-MSG 1 32 0 1 0 1 0 0
    And after that I got 1 .ubx file but it does not contain any raw data. Please help

    Like

    1. Hi Shubham. Your commands look correct. Is the ROM 2.01 as well as the firmware? If so, I would enable debug in the RTKLIB options, set the level to 4, and then look at the debug file to see if it provides any insight. You should see the commands being sent to the M8N and the M8N responses.

      Like

      1. UBX-MON-VER reports:

        Software version: 2.01 (75331)

        Hardware version: 00080000

        Extension(s):
        PROTVER 15.00
        GPS; SBAS; GLO; BDS; QZSS

        Like

    1. Doing cold start before each measurement session is important for the receiver to receive the current data from the satellites and finaly to get fix solutions in RTKLIB.

      Like

    1. i am studying rtklib source code , i wana know how to decode UBLOX sfrbx data(Navigation original message)。thank you so much

      Like

    1. Hi Niek. My guess is that the power used in computing the solution is small compared to the power used to collect the raw observations but I have not measured these directly.

      Like

  4. Fromy our article: “I set up the F9P rover to output both raw observation and navigation messages (UBX-RXM-RAWX/ UBX-RXM-SFRBX) and solution position messages (UBX-NAV-POSLLH).” I’m new to this GPS world; where should these commands go? I am using ucenter 19.04.

    Like

    1. Hi Em. Both the u-blox M8T and F9P have an on-board flash memory that can be used to save and retain configuration settings even after the module has been powered down. You can save the current settings to flash using the CFG-CFG command as described in the M8T or F9P receiver description document.

      Like

    1. Hi Em. Some of the RTKLIB startup commands are identical between the M8T and the F9P such as the sample rate command. However, others, like the GNSS constellation configuration commands have changed to support the L2 observations, or are new, like the ones to enable the RTCM messages. RTKLIB does not yet fully support these changes in the cmd file options. I suggest using the u-center app from u-blox to configure the F9P receivers and then save the results to the F9P flash using the CFG-CFG command.

      Like

  5. hi, is this way that raw data decoding to ublox?
    please answer me… i’m student studying gps, but it is hard to me..

    Like

    1. Hi Bob. This is one way to configure the u-blox receiver to output raw data messages. Another way would be to use the u-blox u-center app. To actually decode the raw messages for post-processing you would want to use RTKCONV or CONVBIN.

      Like

  6. Great article !
    I’m trying to send the same configurations over the serial port of a raspberry pi, straight from the terminal. Is there a way to configure the receiver on linux without using the RTKLIB CUI ? I’ve had little luck with it.
    I have an Ublox EVK M8T and a Raspberry Pi 3B.

    Like

    1. Hi ChampiX. I describe configuring an M8T from a Raspberry Pi in this post but this was using STR2STR, so may not be what you are looking for. The configuration messages include checksums so you will need to generate those yourself if you are communicating directly to the receiver without RTKLIB. All the message details are described in the M8T receiver description document including how to generate the checksums.

      Like

  7. Hi rtklibexplorer,

    I wish to use UBLOX NEO M8P with RTKGPS+, i need to know the “commands at startup” for this device.

    Like

    1. Hi Thibaudet81. The M8P uses the RXM-MEASX message to output raw observations instead of the RXM-RAWX message that the M8T uses. You can use the u-blox u-center app to set up your receivers to output this message and save to flash or you can look in the u-blox M8 Receiver description document (available online from u-blox) to modify the M8T command files for the M8P.

      Like

      1. However AFAIK:
        1) there is no decoder/parser in RTKLIB/src/rcv/ublox.c for RXM-MEASX.
        2) the RXM-MEASX message does not contain carrier phase measurements, it contains lots of other stuff though which might be useful if one were to add that code to ublox.c
        3) only the timing products officially output raw carrier phase info via the RXM-RAWX message (although the M8N has undocumented messages which contain carrier phase. Maybe the M8P has these as well, the M8T does.)

        Like

        1. Hi Cynfab. Good point. You are right, RTKLIB doesn’t support the RXM-MEASX message. Re-reading the M8P documentation however, I now believe the M8P also supports the RXM-RAWX message. From the NeO-M8P data sheet:

          “The NEO-M8P modules provide raw measurement data for civil L1 band GPS, GLONASS and BeiDou signals
          including pseudo-range and carrier phase, carrier Doppler frequency and message payloads. The data contained
          in the UBX-RXM-RAWX message follows the conventions of a multi-GNSS RINEX 3 observation file and includes
          pseudo-range, carrier phase and Doppler measurements along with measurement quality data.”

          If this is true, then the M8T command files should work with the M8P without modification. I have never worked with the M8P though, maybe someone who has can confirm it supports the RXM-RAWX messages.

          Like

          1. It would be great it the M8P supported RXM-RAWX. I don’t have one either, so I dan’t do a ground truth to find out. But I would trust the data sheet.

            Like

  8. Hi
    I am just about to start my journey in precision GPS and RTKLIB. I have ordered a pair of UBLOX NEO-M8T and have the following questions for setting the base station

    If I am fetching RTCM3 frames from my UBLOX module base station. Can I directly transmit those RTCM3 frames(1005 and 1077 if I am correct) over to the radio link to the router? If not and if there needs to be some processing done to the RTCM3 msg I would like to know the function in the SDK of RTKLIB, I am unable to find one, so that I can implement it on my microcontroller?

    Mine is a strictly embedded project and I need to implement all the coding on microcontrollers. Thank you for patient reading

    Like

    1. Hi Onkar. I believe the M8T only supports RTCM messages in, not out, so if you want to use RTCM messages you will need to translate the raw ublox binary output to RTCM messages. If you are using the RTKLIB STRSVR app, it has an option to do this for you, but otherwise you will have to do the translation yourself or stick to using the USB binary format.

      Like

      1. Thank you for your reply. Yes M8T only accepts RTCM messages as input, I verified it with datasheet. I have thought of sticking to the default USB binary format. In that case which would be the best suitable Serial/TCP command files, and where would I find them, for my UBLOX NEO-M8T base station and rover.

        Thank you once again for your help!

        Like

  9. Hi, can somebody help me. How can I configure it in a NEO-6T ublox module. In the datasheet writed that its module (neo 6t) supported transmiting raw data, and neo 6m is not supported.
    Please say me what commands i must sended to NEO-6T, to became receiving raw data?

    Like

    1. And help please. Where in the program u-blox center I can look what messages are enabled and where I can change composition of this this messages?

      Like

      1. Hi Anton. I have not worked with the 6T modules but there is some information on configuring them here at OpenStreetMap. You can read and configure the messages from u-blox center from the “Messages View” and “Configuration View” accessed from the “View” menu. The details are well documented in the u-center documentation.

        Like

          1. Hi Shigeng. You can save the configuration to flash using the CFG-CFG command and RTKLIB does support this command. You can find a good description of the command details in the u-blox M8 Receiver Description document. It can also be useful to issue the specific form of the command you want to use from the u-center app with the packet window open to see the values used in the command parameters. You can then copy these to the RTKLIB command window but pay attention to the numeric formats.

            Like

  10. Hi Tim,

    I was curious to know if its possible to analyze receiver quality with RTK LIB post processing for example some of the parameters which determine receiver quality including
    – TTFF in Cold, Hot and Warm start
    – Receiver acquisition and tracking sensitivity
    – PDOP
    – Signal re-acquisition

    Please let me know how can we analyze such receiver quality parameters (you can add further) with RTK lib post processing?

    Secondly, do you have any blog post about conducting and planning GNSS receiver testing field survey? (without the need for Signal simulator). How do we determine accuracy and precision in field testing?

    Thank you for your contribution to GNSS.

    Best regards,
    Syed Wajahat

    Like

    1. Hi Syed. Your question is very broad but in general I think the answer is yes, RTKLIB could be used to help with all those tasks. You may RTKLIB “fixed” mode useful in which base and rover positions are both specified and RTKLIB calculates the measurement residuals based on the fixed receiver positions.

      Like

    1. Hi Bob. I believe the M8P can be configured to output RTCM messages but not the M8T. For more common RTCM messages, you can use STRSVR to convert the u-blox binary messages to RTCM, but RTKLIB does not support either 1013 or 1230 messages.

      Like

        1. Hi Shigeng. The cmd files included with the demo5 code download should work with the Lea-M8T. Note that I have recently separated them into different files, one for UART and one for USB. The previous files enabled both interfaces but this was causing throughput issues with the increased amount of data that occurred when I enabled Galileo. If you are having trouble using these files I would suggest enabling the desired messages with the u-blox u-center app and then saving to flash. It is a more interactive interface so that will help let you see exactly what is going on.

          Like

  11. Hi, your blog has been a real help to me but I’m a little stuck. I’m using two u-blox LEA-6T GPS receivers, I have configured them in u-center and have received the desired response but they’re not giving any results in RTKLib, it’s most probably because of the “cmd file”, can you help me understand how to write it? Or if i can get cmd file for LEA 6T somewhere?

    Like

      1. Yes thank you so much, I did found the cmd file.
        I am simply trying to configure LEA-6T for single mode but RTKNAVI is only showing grey colored bars for all the satellites. No coordinates are showing. Initially I thought it was because of the cmd file or config file but I have tried changing them, still it’s the same. Same GPS receiver is giving me complete coordinates, a sky-view having 6 to 7 active satellites in u-center. What could be the reason and how can I simply configure LEA-6T in RTKNAVI for single mode?

        Like

          1. Hi Warda. Gray bars in RTKNAVI normally mean that you are receiving observations but not navigation data. This would most likely be because you have not enabled the navigation messages in the cmd file. You may find it easier to see what is going on if you connect to the receiver with the u-blox u-center app. With it, you can see which messages are enabled and can enable/disable them with the GUI.

            Like

          2. Hey!
            I’m now getting results from RTKNAVI, thanks to you. I didn’t enable the correct messages which were RXM-RAW and SFRB in u-center.

            Best wishes

            Like

  12. Dear rtklibexplorer,

    thanks for your great post. Unfortunately, I spent this night with the problem that my NaviLock NL8002U cannot be motivated to provide RAW data. I got the following information from ucenter – Software Version 2.01 (75331), Hardware Version 8000, Extensions PROTVER 15.00, GPS; SBAS; GLO; BDS; QZSS. For the transmission of the TRK-MEAS_ cmds I used RTKLIB_bin 2.4.2 p11.

    I expect to see the UBX RAW outputs while replaying the recorded data in ucenter, isn’t it? Are there any other parameters I have to configure?

    Thanks again!

    Sebastian

    Like

    1. Hi Sebastian. Did you send the commands to the ublox receiver to enable the TRK_MEAS messages? This is usually done by listing the receiver commands in the “Cmd” box in the RTKLIB apps. Also, the newer u-blox firmware is scrambling the TRK-MEAS messages, it’s possible this is what you are seeing, but you mentioned you are using 2.01 FW which should not have this issue.

      Liked by 1 person

      1. Dear rtklibexplorer,

        thanks for the fast response. Yes, I used both methods (command window in RTKLIB and uCenter “Customer” cmds), but no success. Is there any other precondition for running the TRK_MEAS commands? Do I have to enable the cmd interface?

        I chose all UBX containing protocols for the USB connection of my device: “UBX”, “NMEA + UBX”, “NMEA + UBX + RTCM2”. Any other preconditions?

        Best wishes

        Sebastian

        Like

        1. Hi Sebastian. That should be all you need. I would suggest running RTKNAVI, opening the “RTK Monitor” window, setting it to “Rover”. It will show the output of the receiver … you can specify the format in Hex, Ascii, or UBX messages. You should then be able to see if enabling the TRK_MEAS commands is changing what the receiver is outputting. If you see it does generate binary messages but RTKLIB is unable to decode them, then you may have a module with the new scrambled messages.

          Like

          1. Hello Sebastian,
            Yes I have found a solution, I have Navilock NL-8002U USB 2.0 (I use it to collect a raw data and convert to rinex format) and AShtech Promark 2 (to collect data by Stop and Go converted also to Rinex format), I use also a GNSS Solution http://www.spectraprecision.com/eng/gnss-solutions.html#.WaCUyVHjLcs to process GPS, GLONASS and SBAS survey data, it give me a very good results (centimeter accuracy), so I can make a video for you to explain you more a steps for that,
            Regards.

            Liked by 1 person

          2. Hi Zinou,
            It’s been a long time since you posted but I’m interesting in knowing how you went about logging Rinex observation data with your Navilock NL-8002U USB 2.0 as I just purchased one, thank you !

            Like

  13. Thank you for the posts. I try to acquire more SBAS data from M8N, but I still only have two SBAS satellite by using your configuration (m8n_rover_5hz). By using other receiver, I could obtain more than 3 SBAS satellite. Could you show how to obtain all SBAS data around me ?

    Like

  14. Hi, thank you very much for all your work! I’m looking for a command in order to get the raw measurement rate at 30s (1 measurement every 30 seconds) in order to get smaller files during long duration measurements. Do you know how to do this? I couldn’t find…

    Like

  15. Hi I had the same problem of Pujja. I have two receivers with the latest firmware version. I can not use RTKLIB. Any suggestion?
    How can I configure the M8N modules with the new firmware?

    Like

    1. Hi Dart. The raw measurement outputs of the M8N are scrambled in the latest u-blox firmware and not readable by RTKLIB. You will need to flash them with the older firmware which is available on the u-blox site. I have not done this myself but believe it should be possible.

      Like

      1. By entering the codes.
        To enable RXM-RAW

        B5 62 09 01 10 00 dc 0f 00 00 00 00 00 00 23 cc 21 00 00 00 02 10 27 0 e
        To enable RXM-SFRB

        B5 62 09 01 10 00 08 11 00 00 00 00 00 00 0fcc 21 00 00 00 02 11 42 4d
        In impout * cmd and correctly locate the port in rtknavi I do not get anything, it is only static green

        Like

    1. !HEX B5 62 09 01 10 00 C8 16 00 00 00 00 00 00 97 69 21 00 00 00 02 10 2B 22
      !HEX B5 62 09 01 10 00 0C 19 00 00 00 00 00 00 83 69 21 00 00 00 02 11 5F F0
      !HEX B5 62 06 01 08 00 02 10 00 01 01 01 00 00 24 2F
      !HEX B5 62 06 01 08 00 02 11 00 01 01 01 00 00 25 36
      !UBX CFG-MSG 240 0 0 0 0 1 # NMEA GGA
      !UBX CFG-MSG 240 1 0 0 0 0 # NMEA GLL
      !UBX CFG-MSG 240 2 0 0 0 0 # NMEA GSA
      !UBX CFG-MSG 240 3 0 0 0 0 # NMEA GSV
      !UBX CFG-MSG 240 4 0 0 0 1 # NMEA RMC
      !UBX CFG-MSG 240 5 0 0 0 0 # NMEA VTG
      !UBX CFG-MSG 240 8 0 0 0 0 # NMEA ZDA

      Like

  16. Can I know some further details about this post, because I have tried this several times to get data but I unable to connect to RTK library! Could please send me a reply with pujjaozone@gmail.com or else I’m pleased to contact you too
    thanks

    Like

    1. Hi Puji. I understand … RTKLIB can be quite unforgiving when first getting started. I encourage you to start simple, try to duplicate exactly what I did, or what someone else did, using their code, configuration, and data. Once you have got that working then you can work up one step at a time to your own configuration.

      Like

      1. Hi,
        Do you have any idea to active UBX 03-10 TRK-MEAS and TRK-SFRBX messages both UART and USB at startup? and what is configuration code to activate that! I have tried several times but I couldn’t able to do?

        thanks

        Like

        1. Hi Pujja,

          I’m not sure I understand your question. If you are trying to activate UART and USB output at the same time, I don’t believe that is possible, but I could be wrong.

          If you are trying to use the commmands in this post on an M8N receiver and they are not working, it may be possible that your receiver has the most recent firmware, which I have heard no longer supports the raw data commands.

          Like

          1. Hey,
            I think you are correct I have latest firmware and I can’t configure to UBX TRK-SFRBX and UBX TRK-MEAS. but when I debug the receiver from U-center and disconnect from u center (without unplugging the module), and reconnect to RTKLib gives results. So main thing is to activate those message protocols manually using a command. Do you have any idea to activate that two types or do you have any idea to build up the code?
            thanks

            Like

  17. Hi

    Thanks for your very useful post. i am also using two UBLOX GPS NEO M8T receivers. i am really new to this and trying to use RTKLIB. for some reason i am not able to do the RTKnavi. Could you please help me out?

    Regards,
    Ben

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.