Collecting raw Ublox data with RTKLIB

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


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:


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


27 thoughts on “Collecting raw Ublox data with RTKLIB”

  1. 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!



    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.


      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



        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.


  2. 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 ?


  3. 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…


  4. 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?


    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.


      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


    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


  5. 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 or else I’m pleased to contact you too


    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.


      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?



        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.


          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?


  6. 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?



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s