ubxtool-examples.adoc 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113
  1. :Author: Gary E. Miller
  2. :Email: <gem@rellim.com>
  3. :Date: 11 June 2020
  4. :Description: U-blox GNSS receiver configuration examples
  5. :keywords: u-blox, examples, configuration
  6. = ubxtool recipes
  7. WARNING: This document assumes you are using gpsd version 3.20 or higher. Not
  8. all u-blox 9 examples work in version 3.20. Using older gpsd versions
  9. will fail in strange ways.
  10. == Introduction
  11. The u-blox GNSS receivers have a huge number of configuration options.
  12. Most users will be perfectly happy running their receiver in its default
  13. configuration, but there are often times when users get the itch to
  14. change settings to see what happens. Sometimes even for good reasons.
  15. IMPORTANT: Feel free to jump around this document to recipes that
  16. interest you, but be sure to first read all of, and comply with, the
  17. section on Initial Setup.
  18. Many of the recipes repeat text from other recipes so that recipes can
  19. stand alone. Except all recipes require the Initial Setup section.
  20. == Initial Setup
  21. All the examples here assume that gpsd is running on the local host and
  22. that cgps is showing current and valid data from the receiver.
  23. If cgps is not showing any data, then do not bother to continue reading
  24. this document.
  25. You also need a copy of the "Interface Description" for your exact
  26. u-blox device. The examples here will refer to a lot of messages and
  27. variables that are defined in that document. Keep it open while reading
  28. this document and refer to it often.
  29. === Protocol Version
  30. All the examples below require that you know the protocol version of
  31. your u-blox receiver.
  32. ----
  33. $ ubxtool -p MON-VER
  34. ----
  35. Buried in the data will be a data block that similar one of these
  36. examples.
  37. A u-blox 6, assume protocol version 12
  38. ----
  39. UBX-MON-VER:
  40. swVersion 6.02 (36023)
  41. hwVersion 00040007
  42. ----
  43. A u-blox 8, protocol version 15
  44. ----
  45. UBX-MON-VER:
  46. swVersion 2.01 (75331)
  47. hwVersion 00080000
  48. extension PROTVER 15.00
  49. extension GPS;SBAS;GLO;BDS;QZSS
  50. ----
  51. The shortcut to find the PROTVER for u-blox 8 and up:
  52. ----
  53. $ ubxtool -p MON-VER | fgrep PROT
  54. extension PROTVER=18.00
  55. ----
  56. The above shows the protocol version is 18.00.
  57. The ubxtool program needs to know the protocol version (PROTVER) of
  58. the connected receiver to send commands matched to your exact receiver's
  59. needs. Use the "-P XX" option for this, where XX is your version. This
  60. is easy to forget, and annoying to type repeatedly, so add it to your
  61. environment and ubxtool will use it. For example if you have an early
  62. u-blox 8:
  63. ----
  64. $ export UBXOPTS="-P 15"
  65. ----
  66. You can add "-v 2" for a little more verbosity.
  67. ----
  68. $ export UBXOPTS="-P 18 -v 2"
  69. ----
  70. === Default Configuration
  71. A common problem when dealing with a u-blox GNSS receiver is left over
  72. configuration from earlier experiments. The u-blox receivers are very
  73. picky about competing configuration options, and may fail to warn the
  74. unwary of conflicts. Best to always revert to factory defaults before
  75. starting a new configuration.
  76. ----
  77. $ ubxtool -p RESET
  78. ----
  79. After a few seconds the receiver will only be sending NMEA, you will
  80. want to enable u-blox binary messages, and disable NMEA messages. Best
  81. to do it in that order so the receiver does not go totally silent. This
  82. is one place where the "-P", set in UBXOPTS, is critically important, to
  83. get the correct messages for your firmware.
  84. ----
  85. $ ubxtool -e BINARY
  86. $ ubxtool -d NMEA
  87. ----
  88. == Dynamic Platform Model
  89. The most common variable mis-configured in a u-blox receiver is the
  90. Dynamic Platform Model. The receiver uses noisy measurements of
  91. satellite signals and attempts to interpret those as single PVT fix.
  92. By default the receiver assumes the receiver is "Portable" and not
  93. experiencing large accelerations. Place that receiver in a car or
  94. airplane, and the smoothing will act perversely on the fix. Take a
  95. moment now to read the section on Platform Settings in your u-blox
  96. documentation. Different receivers support different models, so no
  97. generic recommendations are possible.
  98. Check your current Dynamic Platform Model:
  99. ----
  100. $ ubxtool -p CFG-NAV5
  101. UBX-CFG-NAV5:
  102. mask 0xffff dynModel 0 fixmode 3 fixedAlt 0 FixedAltVar 10000
  103. minElev 5 drLimit 0 pDop 250 tDop 250 pAcc 100 tAcc 350
  104. staticHoldThresh 0 dgpsTimeOut 60 cnoThreshNumSVs 0
  105. cnoThresh 0 res 0 staticHoldMaxDist 0 utcStandard 0
  106. reserved x0 0
  107. dynModel (Portable) fixMode (Auto 2D/3D) utcStandard (Default)
  108. mask (dyn minEl posFixMode drLim posMask timeMask staticHoldMask
  109. dgpsMask cnoThreshold utc)
  110. ----
  111. That shows the receiver is in the default Portable model.
  112. To change the active model to Automotive (4), and check it again,
  113. is simply:
  114. ----
  115. $ ubxtool -p MODEL,4
  116. [...]
  117. $ ubxtool -p CFG-NAV5
  118. UBX-CFG-NAV5:
  119. mask 0xffff dynModel 4 fixmode 3 fixedAlt 0 FixedAltVar 10000
  120. minElev 5 drLimit 0 pDop 250 tDop 250 pAcc 100 tAcc 350
  121. staticHoldThresh 0 dgpsTimeOut 60 cnoThreshNumSVs 0
  122. cnoThresh 0 res 0 staticHoldMaxDist 0 utcStandard 0
  123. reserved x0 0
  124. dynModel (Automotive) fixMode (Auto 2D/3D) utcStandard (Default)
  125. mask (dyn minEl posFixMode drLim posMask timeMask staticHoldMask
  126. dgpsMask cnoThreshold utc)
  127. ----
  128. === Changing Dynamic Platform Model with Configuration Items
  129. If the receiver is a 9-series one then you can change the model using
  130. Configuration Items. These allow you to get, set and delete individual
  131. settings in the receiver. before continuing this section, read the
  132. ubxtool man page on Configuration Items.
  133. The CFG-NAVSPG Configuration Item group includes the CFG-NAV5 items
  134. of interest here. So take a look at them, in the ram layer:
  135. ----
  136. # ubxtool -g CFG-NAVSPG,0
  137. [...]
  138. UBX-CFG-VALGET:
  139. version 1 layer 0 position 0
  140. layers (ram)
  141. item CFG-NAVSPG-18/0x10110012 val 0
  142. item CFG-NAVSPG-INIFIX3D/0x10110013 val 0
  143. item CFG-NAVSPG-20/0x10110014 val 1
  144. item CFG-NAVSPG-21/0x10110015 val 1
  145. item CFG-NAVSPG-22/0x10110016 val 1
  146. item CFG-NAVSPG-24/0x10110018 val 1
  147. item CFG-NAVSPG-USE_PPP/0x10110019 val 0
  148. item CFG-NAVSPG-27/0x1011001b val 0
  149. item CFG-NAVSPG-ACKAIDING/0x10110025 val 0
  150. item CFG-NAVSPG-70/0x10110046 val 1
  151. item CFG-NAVSPG-82/0x10110052 val 0
  152. item CFG-NAVSPG-83/0x10110053 val 0
  153. item CFG-NAVSPG-USE_USRDAT/0x10110061 val 0
  154. item CFG-NAVSPG-129/0x10110081 val 0
  155. item CFG-NAVSPG-130/0x10110082 val 0
  156. item CFG-NAVSPG-131/0x10110083 val 0
  157. item CFG-NAVSPG-FIXMODE/0x20110011 val 3
  158. item CFG-NAVSPG-26/0x2011001a val 18
  159. item CFG-NAVSPG-UTCSTANDARD/0x2011001c val 0
  160. item CFG-NAVSPG-32/0x20110020 val 100
  161. item CFG-NAVSPG-DYNMODEL/0x20110021 val 1
  162. item CFG-NAVSPG-34/0x20110022 val 0
  163. item CFG-NAVSPG-35/0x20110023 val 0
  164. item CFG-NAVSPG-36/0x20110024 val 1
  165. item CFG-NAVSPG-38/0x20110026 val 0
  166. item CFG-NAVSPG-66/0x20110042 val 2
  167. item CFG-NAVSPG-67/0x20110043 val 3
  168. item CFG-NAVSPG-68/0x20110044 val 1
  169. item CFG-NAVSPG-69/0x20110045 val 1
  170. item CFG-NAVSPG-81/0x20110051 val 0
  171. item CFG-NAVSPG-INFIL_MINSVS/0x201100a1 val 3
  172. item CFG-NAVSPG-INFIL_MAXSVS/0x201100a2 val 32
  173. item CFG-NAVSPG-INFIL_MINCNO/0x201100a3 val 6
  174. item CFG-NAVSPG-INFIL_MINELEV/0x201100a4 val 5
  175. item CFG-NAVSPG-INFIL_NCNOTHRS/0x201100aa val 0
  176. item CFG-NAVSPG-INFIL_CNOTHRS/0x201100ab val 0
  177. item CFG-NAVSPG-CONSTR_DGNSSTO/0x201100c4 val 60
  178. item CFG-NAVSPG-213/0x201100d5 val 0
  179. item CFG-NAVSPG-SIGATTCOMP/0x201100d6 val 0
  180. item CFG-NAVSPG-WKNROLLOVER/0x30110017 val 2029
  181. item CFG-NAVSPG-OUTFIL_PDOP/0x301100b1 val 250
  182. item CFG-NAVSPG-OUTFIL_TDOP/0x301100b2 val 250
  183. item CFG-NAVSPG-OUTFIL_PACC/0x301100b3 val 100
  184. item CFG-NAVSPG-OUTFIL_TACC/0x301100b4 val 350
  185. item CFG-NAVSPG-OUTFIL_FACC/0x301100b5 val 150
  186. item CFG-NAVSPG-USRDAT_DX/0x40110064 val 0.0
  187. item CFG-NAVSPG-USRDAT_DY/0x40110065 val 0.0
  188. item CFG-NAVSPG-USRDAT_DZ/0x40110066 val 0.0
  189. item CFG-NAVSPG-USRDAT_ROTX/0x40110067 val 0.0
  190. item CFG-NAVSPG-USRDAT_ROTY/0x40110068 val 0.0
  191. item CFG-NAVSPG-USRDAT_ROTZ/0x40110069 val 0.0
  192. item CFG-NAVSPG-USRDAT_SCALE/0x4011006a val 0.0
  193. item CFG-NAVSPG-CONSTR_ALT/0x401100c1 val 0
  194. item CFG-NAVSPG-CONSTR_ALTVAR/0x401100c2 val 10000
  195. item CFG-NAVSPG-209/0x401100d1 val 0
  196. item CFG-NAVSPG-210/0x401100d2 val 0
  197. item CFG-NAVSPG-211/0x401100d3 val 0
  198. item CFG-NAVSPG-USRDAT_MAJA/0x50110062 val 6378137.0
  199. item CFG-NAVSPG-USRDAT_FLAT/0x50110063 val 298.257223563
  200. ----
  201. We can now use CFG-NAVSPG-DYNMODEL to change the model back to
  202. Pedestrian, and then confirm the setting:
  203. ----
  204. $ ubxtool -z CFG-NAVSPG-DYNMODEL,0
  205. [...]
  206. $ ubxtool -z CFG-NAVSPG-DYNMODEL,0
  207. [...]
  208. UBX-CFG-VALGET:
  209. version 1 layer 0 position 0
  210. layers (ram)
  211. item CFG-NAVSPG-DYNMODEL/0x20110021 val 0
  212. ----
  213. == Rate Settings
  214. There can be a good need to change the rate at which your receiver take
  215. measurements, or how many measurements it uses to compute its navigation
  216. solution (fix). Slow down the measurement rate to save power. Or speed
  217. it up in fast moving dynamic environments. Using several measurements
  218. sets for each fix computation may remove some noise. No one size
  219. fits all.
  220. NOTE: Not all u-blox can take measurements faster than 1 Hz.
  221. The current configuration can be seen this way:
  222. ----
  223. $ ubxtool -p CFG-RATE
  224. [...]
  225. UBX-CFG-RATE:
  226. measRate 1000 navRate 1 timeRef 1 (GPS)
  227. ----
  228. To change to a 10 Hz measurement and fix rate, then check your work:
  229. ----
  230. $ ubxtool -p RATE,100
  231. [...]
  232. $ ubxtool -p CFG-RATE
  233. [...]
  234. UBX-CFG-RATE:
  235. measRate 000 navRate 1 timeRef 1 (GPS)
  236. ----
  237. === Rate Settings with Configuration Items
  238. If the receiver is a 9-series one then you can change the rate at which
  239. the receiver takes measurements and/or computes the navigation solution
  240. (fix) using Configuration Items. These allow you to get, set and delete
  241. individual settings in the receiver. before continuing this section,
  242. read the ubxtool man page on Configuration Items.
  243. The CFG-NAVSPG Configuration Item group includes the CFG-NAV5 items
  244. of interest here. So take a look at them, in the ram layer:
  245. ----
  246. # ubxtool -g CFG-RATE,0
  247. [...]
  248. UBX-CFG-VALGET:
  249. version 1 layer 0 position 0
  250. layers (ram)
  251. item CFG-RATE-TIMEREF/0x20210003 val 1
  252. item CFG-RATE-MEAS/0x30210001 val 1000
  253. item CFG-RATE-NAV/0x30210002 val 1
  254. ----
  255. You can change the measurement rate to 0.1 Hz, and check it, this way:
  256. ----
  257. $ ubxtool -z CFG-RATE-MEAS,10000,1
  258. sent:
  259. UBX-CFG-VALSET:
  260. version 0 layer 0x1 transaction 0x0 reserved 0
  261. layers (ram) transaction (Transactionless)
  262. item CFG-RATE-MEAS/0x30210001 val 10000
  263. UBX-ACK-ACK:
  264. ACK to Class x06 (CFG) ID x8a (VALSET)
  265. [...]
  266. $ ubxtool -g CFG-RATE-MEAS,1
  267. [...]
  268. UBX-CFG-VALGET:
  269. version 1 layer 0 position 0
  270. layers (ram)
  271. item CFG-RATE-MEAS/0x30210001 val 10000
  272. ----
  273. == Logging
  274. Sometimes you want your GNSS receiver to be able to log PVT fixes for
  275. later retrieval. This allows the host to go into sleep mode to save
  276. power. Logs are stored in external flash memory. Some GNSS receivers,
  277. like the NEO-M8B, allow the receiver to go into sleep mode between fixes
  278. to save even more power.
  279. Be sure you have performed all the steps in Initial Setup before
  280. proceeding to the following logging specific steps.
  281. === Logging Prerequisites
  282. For Logging, you need:
  283. 1. u-blox 7, 8 or 9 GNSS receiver (protocol version 15+)
  284. 2. External SQI flash memory with a valid Flash Information Structure (FIS).
  285. By default EVK boards and other commercial products with flash will
  286. already have a valid FIS. Added or replaced flash will need to have
  287. an FIS created. If your receiver has flash, but no valid FIS, you can
  288. create a new FIS with u-center.
  289. If you do not meet the above prerequisites, then you can stop reading
  290. this section now.
  291. The easy way to see if your firmware supports logging is to ask it:
  292. ----
  293. $ ubxtool -p LOG-INFO
  294. ----
  295. There are three possible results.
  296. One, the receiver does not return ACK-ACK, ACK-NAK, or any UBX-LOG-INFO
  297. message. That means your receiver does not support logging. Game over,
  298. your receiver does not support logging.
  299. Two, the receiver returns something similar to this:
  300. ----
  301. UBX-LOG-INFO:
  302. version 1 reserved1 x0 x0 filestoreCapacity 0 reserved2 x0 x0
  303. currentMaxLogSize 0 currentLogSize 0 entryCount 0
  304. oldestYear 0 oldestMonth 0 oldestDay 0
  305. oldestHour 0 oldestMin 0 oldestSec 0 reserved3 x0
  306. newestYear 0 newestMonth 0 newestDay 0
  307. newestHour 0 newestMin 0 newestSec 0 reserved4 x0
  308. status x10 reserved5 x0 x0
  309. ----
  310. The filestoreCapacity of zero means you have no flash for logging to
  311. use. Game over, your receiver does not support logging.
  312. Three, the receiver returns something similar to this:
  313. ----
  314. UBX-LOG-INFO:
  315. version 1 reserved1 x0 x0 filestoreCapacity 487680 reserved2 x9600 x24900
  316. currentMaxLogSize 134400 currentLogSize 61 entryCount 0
  317. oldestYear 0 oldestMonth 0 oldestDay 0
  318. oldestHour 0 oldestMin 0 oldestSec 0 reserved3 x0
  319. newestYear 0 newestMonth 0 newestDay 0
  320. newestHour 0 newestMin 0 newestSec 0 reserved4 x0
  321. status x20 reserved5 x0 x0
  322. ----
  323. That means your receiver has almost 500 kB of flash, and about 134 kB is
  324. available for logging. Congratulations, your receiver supports logging.
  325. Proceed to the next section on configuration.
  326. === Logging Configuration
  327. Be sure you have completed the instructions in the section
  328. Initial Setup before continuing here.
  329. Erase any exiting log:
  330. ----
  331. $ ubxtool -p LOG-ERASE
  332. [...]
  333. sent:
  334. UBX-LOG-ERASE:
  335. Erase Logged Data
  336. UBX-ACK-ACK:
  337. ACK to Class x21 (LOG) ID x03 (ERASE)
  338. ----
  339. Create new log:
  340. ----
  341. $ ubxtool -p LOG-CREATE
  342. [...]
  343. sent:
  344. UBX-LOG-CREATE:
  345. version 0 logCfg x1 reserved1 x0 logSize 0
  346. userDefinedSize 0
  347. UBX-ACK-ACK:
  348. ACK to Class x21 (LOG) ID x07 (CREATE)
  349. ----
  350. Start logging:
  351. ----
  352. $ ubxtool -e LOG
  353. [...]
  354. sent:
  355. UBX-CFG-LOGFILTER:
  356. version 1 flags x5 minInterval 0 timeThreshold 0
  357. speedThreshold 0 positionThreshold 0
  358. UBX-ACK-ACK:
  359. ACK to Class x06 (CFG) ID x47 (LOGFILTER)
  360. ----
  361. Wait, then verify that the receiver is logging data:
  362. ----
  363. $ ubxtool -p LOG-INFO -v 2
  364. UBX-LOG-INFO:
  365. version 1 reserved1 x0 x0 filestoreCapacity 487680 reserved2 x9600 x24900
  366. currentMaxLogSize 134400 currentLogSize 88 entryCount 8
  367. oldestYear 2020 oldestMonth 5 oldestDay 22
  368. oldestHour 22 oldestMin 33 oldestSec 56 reserved3 x0
  369. newestYear 2020 newestMonth 5 newestDay 22
  370. newestHour 22 newestMin 26 newestSec 41 reserved4 x0
  371. status x28 reserved5 x0 x0
  372. status (recording circular)
  373. ----
  374. Add a string:
  375. ----
  376. $ ubxtool -p LOG-STRING -v 2
  377. [...]
  378. UBX-ACK-ACK:
  379. ACK to Class x21 (LOG) ID x04 (STRING)
  380. ----
  381. Wait for a few more fixes to be logged, then turn off logging.
  382. ----
  383. $ ubxtool -d LOG -v 2
  384. [...]
  385. sent:
  386. UBX-CFG-LOGFILTER:
  387. version 1 flags x0 minInterval 0 timeThreshold 0
  388. speedThreshold 0 positionThreshold 0
  389. flags ()
  390. UBX-ACK-ACK:
  391. ACK to Class x06 (CFG) ID x47 (LOGFILTER)
  392. ----
  393. Verify that logging is indeed off:
  394. ----
  395. $ ubxtool -p LOG-INFO -v 2
  396. [...]
  397. UBX-LOG-INFO:
  398. version 1 reserved1 x0 x0 filestoreCapacity 487680 reserved2 x9600 x24900
  399. currentMaxLogSize 134400 currentLogSize 288 entryCount 33
  400. oldestYear 2020 oldestMonth 5 oldestDay 22
  401. oldestHour 22 oldestMin 33 oldestSec 56 reserved3 x0
  402. newestYear 2020 newestMonth 5 newestDay 22
  403. newestHour 22 newestMin 34 newestSec 11 reserved4 x0
  404. status x20 reserved5 x0 x0
  405. status (circular)
  406. ----
  407. Retrieve log data:
  408. ----
  409. $ ubxtool -p LOG-RETRIEVE -v 2
  410. [...]
  411. UBX-LOG-RETRIEVEPOS:
  412. entryIndex 12 lon -1213142510 lat 440688770 hMSL 1128900 hAcc 7000
  413. gSpeed 90 heading 28500000 version 0 fixType 3
  414. year 2020 month 5 day 22 hour 22 min 34 sec 2
  415. reserved1 x0 numSV 7 reserved2 x0
  416. fixType (3D Fix)
  417. UBX-LOG-RETRIEVEPOSEXTRA:
  418. entryIndex 13 version 0 reserved1 x0
  419. year 2020 month 5 day 22 hour 22 minute 34 seconds 2
  420. reserved2 x0 0 distance 1252489 reserved3 x0 0 0
  421. UBX-LOG-RETRIEVESTRING:
  422. entryIndex 14 version 0 reserved2 x0
  423. year 2020 month 5 day 22 hour 22 min 34 sec 2
  424. reserved2 x0 byteCount 2
  425. bytes "Hi"
  426. UBX-LOG-RETRIEVEPOS:
  427. entryIndex 15 lon -1213142470 lat 440688690 hMSL 1128600 hAcc 7000
  428. gSpeed 240 heading 26300000 version 0 fixType 3
  429. year 2020 month 5 day 22 hour 22 min 34 sec 3
  430. reserved1 x0 numSV 8 reserved2 x0
  431. fixType (3D Fix)
  432. [...]
  433. ----
  434. Erase and clear existing log, before you can enable log again:
  435. ----
  436. $ ubxtool -p LOG-ERASE
  437. $ ubxtool -p LOG-CREATE
  438. ----
  439. == Batching
  440. U-blox batching is like logging, but logging is saved in flash memory,
  441. and batching is saved in RAM memory. Not all u-blox receivers have RAM
  442. available for batching.
  443. Be sure you have performed all the steps in Initial Setup before
  444. proceeding to these batching specific steps.
  445. === Batching Prerequisites
  446. For batching, you need:
  447. 1. u-blox 8 or 9 GNSS receiver (protocol version 23.01+)
  448. 2. RAM memory
  449. If you do not meet the above prerequisites, then you can stop reading
  450. now.
  451. The easy way to see if your firmware supports batching is to ask it:
  452. ----
  453. $ ubxtool -p MON-BATCH
  454. ----
  455. If the receiver does not ACK, or NAK, that request, then it does not
  456. support batching. Game over, do not bother to continue with this
  457. example.
  458. If your receiver does support batching, you will see something
  459. similar to this:
  460. ----
  461. $ ubxtool -p MON-BATCH
  462. ubxtool: poll MON-BATCH
  463. sent:
  464. UBX-MON-BATCH:
  465. Poll request
  466. UBX-MON-BATCH:
  467. version 0 reserved1 0 0 0 fillLevel 128
  468. dropsAll 65535 dropsSinceMon 4 nextMsgCnt 166
  469. ----
  470. Check your u-blox documentation for what UBX-MON-BATCH just told you.
  471. === Batching Configuration
  472. Be sure you have completed the instructions in the section
  473. Initial Setup before continuing here.
  474. Enable batching:
  475. ----
  476. $ ubxtool -e BATCH
  477. ----
  478. Wait, then verify:
  479. ----
  480. $ ubxtool -p CFG-BATCH -p MON-BATCH -v 2
  481. [...]
  482. UBX-CFG-BATCH:
  483. version 0 flags xd bufsize 128 notifThrs 0
  484. pioId 0 reserved1 0
  485. flags (enable extraPvt extraOdo)
  486. UBX-ACK-ACK:
  487. ACK to Class x06 (CFG) ID x93 (BATCH)
  488. UBX-MON-BATCH:
  489. version 0 reserved1 0 0 0 fillLevel 128
  490. dropsAll 321 dropsSinceMon 15 nextMsgCnt 38
  491. [...]
  492. ----
  493. Wait a while, for some fixes to be saved in the BATCH. Then check
  494. UBX-MON-BATCH and get all the batch entries:
  495. ----
  496. $ ubxtool -p LOG-RETRIEVEBATCH -v 2
  497. [...]
  498. UBX-MON-BATCH:
  499. version 0 reserved1 0 0 0 fillLevel 128
  500. dropsAll 65535 dropsSinceMon 1310 nextMsgCnt 166
  501. UBX-LOG-BATCH:
  502. version 0 contentValid x3 msgCnt 166 iTow 510334000
  503. year 2020 month 5 day 22 hour 21 min 45 sec 16 valid x37
  504. tAcc 30 fracSec 104291 fixType 3 flags x11 flags2 xa numSV 5
  505. lon -1213142428 lat 440690573 height 1130139 hMSL 1151489
  506. hAcc 9541 vAcc 11092
  507. vel N 288 E 111 D -29 gSpeed 274 headMot 2104222 sAcc 786 headAcc 4232547
  508. pdep 432 reserved1 x0 distance 1249842 totalDistance 1249842
  509. distanceStd 4880 reserved2 x0
  510. contentValid (extraPvt extraOdo) valid (validDate validTime)
  511. fixType (3D Fix)
  512. flags (gnssFixOK) psmState (Power Optimized Tracking)
  513. ----
  514. There will be a number of UBX-LOG-BATCH with each of the individual
  515. batches fixes.
  516. End batching:
  517. ----
  518. $ ubxtool -d BATCH
  519. ----
  520. == Survey-In and RTCM
  521. Sometimes your GNSS antenna is fixed and instead of having your receiver
  522. compute its position, you want it to use the known position to provide a
  523. more accurate PPS. Or to compute the errors it sees in the signals it
  524. measures. Then transmit those corrections to a nearby receiver.
  525. The receiver with the fixed antenna is called the base, and the nearby
  526. receiver is a rover. The corrections are usually in one of the many
  527. RTCM2 or RTCM3 variants.
  528. Some u-blox receivers with protocol versions of 20 or greater output
  529. RTCM3 corrections. None output RTCM2 corrections.
  530. Be sure you have completed the instructions in the section Initial Setup
  531. before continuing here. To understand the following example you should
  532. have read the Survey-in section from the u-blox documentation for your
  533. receiver.
  534. === Survey-In and RTCM Prerequisites
  535. For base mode, you need a u-blox receiver that supports UBX-CFG-TMODE2
  536. or UBX-CFG-TMODE3. This is usually limited to Time & Frequency Sync, Time
  537. Sync, or High Precision products.
  538. Your receiver supports the High Precision messages if it answers the
  539. UBX-NAV-SVIN message:
  540. ----
  541. $ ubxtool -p NAV-SVIN -P 27.11
  542. ubxtool: poll NAV-SVIN
  543. sent:
  544. UBX-NAV-SVIN:
  545. Poll request
  546. [...]
  547. UBX-NAV-SVIN:
  548. version 0 reserved1[0 0 0] iTOW 256297000 dur 100
  549. meanX -238605675 meanY -392219737 meanZ 441436428
  550. meanXHP -30 meanYHP 9 meanZHP -14 reserved2 0 meanAcc 199922
  551. obs 101 valid 1 active 0
  552. ----
  553. Your receiver supports the Timing messages if it answers the
  554. UBX-TIM-SVIN message:
  555. ----
  556. # ubxtool -p TIM-SVIN -P 22
  557. ubxtool: poll TIM-SVIN
  558. sent:
  559. UBX-TIM-SVIN:
  560. Poll request
  561. [...]
  562. UBX-TIM-SVIN:
  563. dur 30 meanX -238607642 meanY -392219170 meanZ 441436506 meanV 163464256
  564. obs 31 valid 0 active 0
  565. ----
  566. If your receiver responds to neither request, then you can use Survey-in.
  567. === Survey-In Configuration
  568. If your receiver responded to UBX-NAV-SVIN, then you start the default
  569. survey this way:
  570. ----
  571. # ubxtool -e SURVEYIN3 -P 27
  572. ubxtool: enable SURVEYIN3
  573. sent:
  574. UBX-CFG-TMODE3:
  575. version 0 reserved1 0 flags x1
  576. ecefXOrLat 0 ecefYOrLon 0 ecefZOrAlt 0
  577. ecefXOrLatHP 0 ecefYOrLonHP 0 ecefZOrAltHP 0
  578. reserved2 0 fixedPosAcc 0 svinMinDur 300 svinAccLimit 500000
  579. reserved3 0 0
  580. UBX-ACK-ACK:
  581. ACK to Class x06 (CFG) ID x71 (TMODE3)
  582. ----
  583. For receivers that responded to UBX-TIM-SVIN, simply change SURVEYIN3 to
  584. SURVEYIN. You can optionally provide the svinMinDur and svinAccLimit
  585. variables on the command line. For example, to survey-in for 60 seconds
  586. and 20 meters accuracy:
  587. ----
  588. $ ubxtool -e SURVEYIN3,60,200000 -v 2 -P 27
  589. ubxtool: enable SURVEYIN3,60,200000
  590. [...]
  591. ----
  592. To check the progress of your survey:
  593. ----
  594. $ ubxtool -p NAV-SVIN -P 27
  595. ubxtool: poll NAV-SVIN
  596. sent:
  597. UBX-NAV-SVIN:
  598. Poll request
  599. [...]
  600. UBX-NAV-SVIN:
  601. version 0 reserved1[0 0 0] iTOW 257578000 dur 23
  602. meanX -238605582 meanY -392219750 meanZ 441436474
  603. meanXHP -46 meanYHP -48 meanZHP -50 reserved2 0 meanAcc 392629
  604. obs 23 valid 0 active 1
  605. ----
  606. Replace NAV-SVIN with TIM-SVIN above for Timing products. "active 1"
  607. tells you a survey-in is in progress, but "valid 0" tells you it is
  608. not complete. It may never complete if it cannot reach the position
  609. accuracy requested.
  610. Your survey is complete when valid is 1. At that point NAV-PVT will
  611. show a fixType of 5 to show you it has entered fixed base mode.
  612. ----
  613. $ ubxtool -p NAV-SVIN -P 27
  614. [...]
  615. UBX-NAV-SVIN:
  616. version 0 reserved1[0 0 0] iTOW 260515000 dur 300
  617. meanX -238605429 meanY -392219715 meanZ 441436264
  618. meanXHP -39 meanYHP 17 meanZHP -14 reserved2 0 meanAcc 328065
  619. obs 301 valid 1 active 0
  620. UBX-NAV-PVT:
  621. iTOW 260516000 time 2020/6/3 0:21:38 valid x37
  622. tAcc 26 nano -29221 fixType 5 flags x1 flags2 xea
  623. numSV 19 lon -1213140873 lat 440688410 height 1109817
  624. hMSL 1131166 hAcc 26786 vAcc 18941
  625. velN 0 velE 0 velD 0 gSpeed 0 headMot 33945561
  626. sAcc 10 headAcc 16986464 pDOP 9999 reserved1 0 26042 11331
  627. headVeh 2900837 magDec 0 magAcc 0
  628. valid (validDate ValidTime fullyResolved) fixType (Surveyed)
  629. flags (gnssFixOK)
  630. flags2 (confirmedAvai confirmedDate confirmedTime)
  631. psmState (Not Active)
  632. carrSoln (None)
  633. ----
  634. === RTCM3 Configuration
  635. This RTCM3 example currently only works on the USB port of a 9-series
  636. Time, Frequency and Time, or High Precision device. It generates a
  637. LOT of data.
  638. To enable the RTCM 3 output on the USB port:
  639. ----
  640. $ ubxtool -e RTCM3 -P 27 -v 2
  641. ubxtool: enable RTCM3
  642. sent:
  643. UBX-CFG-PRT:
  644. PortID 3 (USB) reserved1 0 txReady 0x0
  645. reserved2 [0 0]
  646. inProtoMask 0x23 outProtoMask 0x23
  647. reserved3 0 reserved4 0
  648. inProtoMask (UBX NMEA RTCM3)
  649. outProtoMask (UBX NMEA RTCM3)
  650. sent:
  651. UBX-CFG-MSG:
  652. Rate set Class xf5 (RTCM) ID x05 (1005) Rate 1
  653. [A lot of RTCM3 messages are enabled ...]
  654. RTCM3 packet: type 1077
  655. [A ton of RTCM3 messages are output ...]
  656. ----
  657. To be able to do anything else, you must disable the RTCM3:
  658. ----
  659. $ ubxtool -d RTCM3 -P 27 -v 2
  660. ubxtool: disable RTCM3
  661. [...]
  662. ----
  663. === Exiting Survey-in
  664. To restore your receiver to normal mode:
  665. ----
  666. $ ubxtool -d SURVEYIN3
  667. ubxtool: disable SURVEYIN3
  668. sent:
  669. UBX-CFG-TMODE3:
  670. version 0 reserved1 0 flags x0
  671. ecefXOrLat 0 ecefYOrLon 0 ecefZOrAlt 0
  672. ecefXOrLatHP 0 ecefYOrLonHP 0 ecefZOrAltHP 0
  673. reserved2 0 fixedPosAcc 0 svinMinDur 300 svinAccLimit 50000
  674. reserved3 0 0
  675. UBX-ACK-ACK:
  676. ACK to Class x06 (CFG) ID x71 (TMODE3)
  677. ----
  678. Or for a Timing product:
  679. ----
  680. $ ubxtool -d SURVEYIN2
  681. ubxtool: disable SURVEYIN2
  682. [...]
  683. ----
  684. == Constellations
  685. For unknown reasons, one of the first things newbies want to play with
  686. is the constellation settings. If you are headed to the polar regions,
  687. into space, or to Asia, then these settings will be of interest to you.
  688. Otherwise, unless you have a Rubidium atomic clock handy, or run 12-hour
  689. experiments with gpsprof, it will be hard for you to improve on the
  690. defaults. If you still must fiddle, then read on, after completing the
  691. above section on Initial Setup.
  692. === Changing Constellations
  693. First you must understand what your GNSS receiver is capable of. Find
  694. this out with the UBX-MON-GNSS message.
  695. ----
  696. $ ubxtool -p MON-GNSS
  697. ----
  698. If your receiver does not return an ACK-ACK message, then it is 7-series
  699. or earlier, and only receives from GPS satellites. Owners of 7-series,
  700. or older receivers can stop reading this section now.
  701. A u-blox 8 may return something like this:
  702. ----
  703. UBX-MON-GNSS:
  704. version 0 supported 0x7 defaultGnss 0x3 enabled 0x3
  705. simultaneous 2 reserved1 0 0 0
  706. supported (GPS Glonass Beidou)
  707. defaultGnss (GPS Glonass)
  708. enabled (GPS Glonass)
  709. ----
  710. That 8 can support GPS, GLONASS, and BeiDou, but only two at a time.
  711. A u-blox 9 might return something like this:
  712. ----
  713. UBX-MON-GNSS:
  714. version 0 supported 0xf defaultGnss 0xf enabled 0xd
  715. simultaneous 4 reserved1 0 0 0
  716. supported (GPS Glonass Beidou Galileo)
  717. defaultGnss (GPS Glonass Beidou Galileo)
  718. enabled (GPS Beidou Galileo)
  719. ----
  720. That 9 can support GPS, GLONASS, BeiDou, and Galileo, and all at the same
  721. time. But in that case, GLONASS is turned off.
  722. There are more details to see with UBX-CFG-GNSS. A u-blox 8 might
  723. show:
  724. ----
  725. $ ubxtool -p CFG-GNSS -v 2
  726. [...]
  727. UBX-CFG-GNSS:
  728. msgVer 0 numTrkChHw 32 numTrkChUse 32 numConfigBlocks 5
  729. gnssId 0 TrkCh 8 maxTrCh 16 reserved 0 Flags x01010001
  730. GPS L1C/A enabled
  731. gnssId 1 TrkCh 1 maxTrCh 3 reserved 0 Flags x01010001
  732. SBAS L1C/A enabled
  733. gnssId 3 TrkCh 8 maxTrCh 16 reserved 0 Flags x01010000
  734. BeiDou B1I
  735. gnssId 5 TrkCh 0 maxTrCh 3 reserved 0 Flags x01010001
  736. QZSS L1C/A enabled
  737. gnssId 6 TrkCh 8 maxTrCh 14 reserved 0 Flags x01010001
  738. GLONASS L1 enabled
  739. ----
  740. That shows 5 constellations, not 2. Since GPS, SBAS and QZSS all use
  741. the same frequency and modulation, they were lumped together by MON-GNSS
  742. as simply GPS.
  743. An L2 capable 9-series may look like this:
  744. ----
  745. UBX-CFG-GNSS:
  746. msgVer 0 numTrkChHw 60 numTrkChUse 60 numConfigBlocks 5
  747. gnssId 0 TrkCh 8 maxTrCh 16 reserved 0 Flags x11110001
  748. GPS L1C/A L2C enabled
  749. gnssId 2 TrkCh 10 maxTrCh 18 reserved 0 Flags x21210001
  750. Galileo E1 E5b enabled
  751. gnssId 3 TrkCh 4 maxTrCh 5 reserved 0 Flags x11010001
  752. BeiDou B1I enabled
  753. gnssId 5 TrkCh 0 maxTrCh 3 reserved 0 Flags x11110001
  754. QZSS L1C/A L2C enabled
  755. gnssId 6 TrkCh 8 maxTrCh 12 reserved 0 Flags x11110001
  756. GLONASS L1 L2 enabled
  757. ----
  758. There are several things to note. SBAS is not shown. Outside of FAA
  759. requirements, SBAS no longer has any value to the user, and is simply
  760. not supported. Multiple signals per constellation are shown, and can be
  761. individually enabled.
  762. === Changing Constellations
  763. The 9-series receives a large number of signals in parallel, so other than
  764. for testing, there is no need to change the defaults that listen to
  765. everything.
  766. Stepping back a bit, the 8-series is more problematic. Many of them
  767. can only listen to two out of the three possible frequency bands: GPS,
  768. GLONASS and BeiDou. Most default to GPS and GLONASS, but GPS and Beidou
  769. may work better. This is partly because most GPS-only antenna can
  770. receiver BeiDou, but fail to receive GLONASS. Partly because BeiDou and
  771. GLONASS sats cover different regions of the earth.
  772. If we first try to enable BeiDou, that will fail, as that would enable
  773. 3 constellations when only 2 are supported. So disable GLONASS, then
  774. enable BeiDou, then check. Always check as u-blox does not reliably report
  775. errors.
  776. ----
  777. $ ubxtool -d GLONASS
  778. [...]
  779. $ ubxtool -e BEIDOU
  780. [...]
  781. $ ubxtool -p CFG-GNSS
  782. [...]
  783. UBX-CFG-GNSS:
  784. msgVer 0 numTrkChHw 32 numTrkChUse 32 numConfigBlocks 5
  785. gnssId 0 TrkCh 8 maxTrCh 16 reserved 0 Flags x01010001
  786. GPS L1C/A enabled
  787. gnssId 1 TrkCh 1 maxTrCh 3 reserved 0 Flags x01010001
  788. SBAS L1C/A enabled
  789. gnssId 3 TrkCh 2 maxTrCh 16 reserved 0 Flags x01010001
  790. BeiDou B1I enabled
  791. gnssId 5 TrkCh 0 maxTrCh 3 reserved 0 Flags x01010001
  792. QZSS L1C/A enabled
  793. gnssId 6 TrkCh 8 maxTrCh 14 reserved 0 Flags x01010000
  794. GLONASS L1
  795. ----
  796. After a few minutes, if you are in a location which BeiDou covers, then
  797. you should start to see BeiDou sats in the cgps sat list. The 8-series
  798. has many other constraints on setting CFG-GNSS, the masochistic will
  799. need to spend a lot of quality time with the u-blox documentation to
  800. lean the many ways to shoot yourself in the foot.
  801. While the need for changing what the 9-series listens for is less, the
  802. complexity of doing so is increased. Not only must the constellation
  803. be selected, but also the signals within the constellation.
  804. Let us disable GLONASS on a ZED-F9P, then enable it, and check the
  805. results:
  806. ----
  807. $ ubxtool -d GLONASS
  808. [...]
  809. $ ubxtool -e GLONASS
  810. [...]
  811. $ ubxtool -p CFG-GNSS
  812. [...]
  813. UBX-CFG-GNSS:
  814. msgVer 0 numTrkChHw 60 numTrkChUse 60 numConfigBlocks 5
  815. gnssId 0 TrkCh 8 maxTrCh 16 reserved 0 Flags x11110001
  816. GPS L1C/A L2C enabled
  817. gnssId 2 TrkCh 10 maxTrCh 18 reserved 0 Flags x21210001
  818. Galileo E1 E5b enabled
  819. gnssId 3 TrkCh 4 maxTrCh 5 reserved 0 Flags x11010001
  820. BeiDou B1I enabled
  821. gnssId 5 TrkCh 0 maxTrCh 3 reserved 0 Flags x11110001
  822. QZSS L1C/A L2C enabled
  823. gnssId 6 TrkCh 8 maxTrCh 12 reserved 0 Flags x11110000
  824. GLONASS L1 L2
  825. ----
  826. Note that GLONASS is still disabled. Determining why is left as an
  827. exercise to the reader. The receiver must be told to enable both
  828. frequencies before it complies:
  829. ----
  830. $ ubxtool -e GLONASS,2
  831. [...]
  832. $ ubxtool -p CFG-GNSS
  833. [...]
  834. UBX-CFG-GNSS:
  835. msgVer 0 numTrkChHw 60 numTrkChUse 60 numConfigBlocks 5
  836. gnssId 0 TrkCh 8 maxTrCh 16 reserved 0 Flags x11110001
  837. GPS L1C/A L2C enabled
  838. gnssId 2 TrkCh 10 maxTrCh 18 reserved 0 Flags x21210001
  839. Galileo E1 E5b enabled
  840. gnssId 3 TrkCh 4 maxTrCh 5 reserved 0 Flags x11010001
  841. BeiDou B1I enabled
  842. gnssId 5 TrkCh 0 maxTrCh 3 reserved 0 Flags x11110001
  843. QZSS L1C/A L2C enabled
  844. gnssId 6 TrkCh 8 maxTrCh 12 reserved 0 Flags x11110001
  845. GLONASS L1 L2 enabled
  846. ----
  847. Another reason to always check your work when using ubxtool.
  848. === Changing Constellations with Configuration Items
  849. The astute will have noticed that the canned ubxtool commands, like
  850. "-e GLONASS", send one or binary messages that may change a handful
  851. or variables at once. The 9-series avoids this mess with Configuration
  852. Items. These allow you to get, set and delete individual settings in
  853. the receiver. before continuing this section, read the ubxtool
  854. man page on Configuration Items.
  855. The CFG-SIGNAL Configuration Item group includes the CFG-GNSS items
  856. of interest here. So take a look at them, in the ram layer:
  857. ----
  858. $ ubxtool -g CFG-SIGNAL,0
  859. [...]
  860. UBX-CFG-VALGET:
  861. version 1 layer 0 position 0
  862. layers (ram)
  863. item CFG-SIGNAL-GPS_L1CA_ENA/0x10310001 val 1
  864. item CFG-SIGNAL-GPS_L2C_ENA/0x10310003 val 1
  865. item CFG-SIGNAL-GAL_E1_ENA/0x10310007 val 1
  866. item CFG-SIGNAL-GAL_E5B_ENA/0x1031000a val 1
  867. item CFG-SIGNAL-BDS_B1_ENA/0x1031000d val 1
  868. item CFG-SIGNAL-BDS_B2_ENA/0x1031000e val 0
  869. item CFG-SIGNAL-QZSS_L1CA_ENA/0x10310012 val 1
  870. item CFG-SIGNAL-QZSS_L2C_ENA/0x10310015 val 1
  871. item CFG-SIGNAL-GLO_L1_ENA/0x10310018 val 1
  872. item CFG-SIGNAL-GLO_L2_ENA/0x1031001a val 1
  873. item CFG-SIGNAL-GPS_ENA/0x1031001f val 1
  874. item CFG-SIGNAL-GAL_ENA/0x10310021 val 1
  875. item CFG-SIGNAL-BDS_ENA/0x10310022 val 1
  876. item CFG-SIGNAL-QZSS_ENA/0x10310024 val 1
  877. item CFG-SIGNAL-GLO_ENA/0x10310025 val 1
  878. item CFG-SIGNAL-39/0x10310027 val 1
  879. [...]
  880. ----
  881. Notice that the BeiDou B2 signal is not enabled. That might be because
  882. when the firmware was written there were not B2 signals from space to
  883. test. Or maybe not, who knows, but we want to enable it to see if
  884. anything changes. So we will use the "-z" command to enable it, and
  885. the "-g" command to check it in layer 0.
  886. ----
  887. $ ubxtool -z CFG-SIGNAL-BDS_B2_ENA,1
  888. [...]
  889. $ ubxtool -g CFG-SIGNAL-BDS_B2_ENA,0
  890. [...]
  891. UBX-CFG-VALGET:
  892. version 1 layer 0 position 0
  893. layers (ram)
  894. item CFG-SIGNAL-BDS_B2_ENA/0x1031000e val 1
  895. ----
  896. // vim: set syntax=asciidoc: