ubxtool.adoc 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. = ubxtool(1)
  2. Gary E. Miller <gem@rellim.com>
  3. :author: Gary E. Miller
  4. :date: 25 February 2021
  5. :email: <gem@rellim.com.>
  6. :keywords: gps, gpsd, ubxtool, u-blox
  7. :manmanual: GPSD Documentation
  8. :mansource: GPSD, Version {gpsdver}
  9. :robots: index,follow
  10. :sectlinks:
  11. :toc: macro
  12. :type: manpage
  13. :webfonts!:
  14. include::../www/inc-menu.adoc[]
  15. == NAME
  16. ubxtool - u-blox tool
  17. == SYNOPSIS
  18. *ubxtool* [OPTIONS} [server[:port[:device]]]
  19. *ubxtool* -h
  20. *ubxtool* -V
  21. == DESCRIPTION
  22. *ubxtool* is a tool for u-blox GPS. If you do not have a u-blox GPS then
  23. can stop reading now.
  24. This tool operates with your u-blox GPS at a very low level. To
  25. understand *ubxtool* you must first be familiar with your u-blox GPS and
  26. the documentation for the u-blox binary protocol. The u-blox protocol
  27. varies greatly depending on GPS model and firmware revision. Use the
  28. u-blox documentation for your model and firmware.
  29. *ubxtool* can decode common u-blox binary messages, poll the GPS status,
  30. enable and disable GPS features, and send user generated commands to the
  31. GPS. It can read binary messages from a file. It can read and write
  32. directly through a serial device, or through a running *gpsd* instance.
  33. *ubxtool* does not require root privileges, except maybe to access the
  34. serial port in direct mode. It will run fine as root. Running under
  35. sudo will cause loss of functionality.
  36. == OPTIONS
  37. The program accepts the following options:
  38. *-?*, *-h*, *--help*::
  39. Makes *ubxtool* print a usage message and exit. Use with *-v 2* to see
  40. all enable/disable and preset values. Use with *-v 3* to
  41. additionally see all configuration items (long).
  42. *-c COMMAND*, *--command COMMAND*::
  43. Send a command to the GPS. Accepts one parameter, COMMAND, a
  44. comma-separated list of hexadecimal bytes specifying the class, the
  45. ID, and any needed payload. The header, length, and checksum are added
  46. automatically.
  47. *--device DEVICE*::
  48. The DEVICE on the *gpsd* to connect to. Defaults to all.
  49. *-d OPTION*, *--disable OPTION*::
  50. Disable an option in the GPS. Accepts one parameter, OPTION, the
  51. option to disable. Run "ubxtool -h -v 2" to see all possible OPTIONs. A few
  52. possible OPTIONs are:
  53. BEIDOU;;
  54. Disable use of the BeiDou (COMPASS) constellation.
  55. BINARY;;
  56. Disable sending of the basic binary messages.
  57. ECEF;;
  58. Disable sending of ECEF binary messages.
  59. GALILEO;;
  60. Disable use of the GALILEO constellation.
  61. GLONASS;;
  62. Disable use of the GLONASS constellation.
  63. GPS;;
  64. Disable use of the GPS and QZSS constellations.
  65. NED;;
  66. Disable sending of NED binary messages. UBX-NAV-VELNED and
  67. UBX-NAV-RELPOSNED.
  68. NMEA;;
  69. Disable sending basic NMEA messages. The messages are GBS, GGA, GSA,
  70. GGL, GST, GSV, RMC, VTG, and ZDA.
  71. PPS;;
  72. Disable TIMEPULSE 0.
  73. RAWX;;
  74. Disable sending of the UBX-RXM-RAWX messages.
  75. SBAS;;
  76. Disable use of the SBAS constellation.
  77. SFRBX;;
  78. Disable use of the SFRBX messages.
  79. SURVEYIN;;
  80. Disable survey-in mode with TMODE2.
  81. TP;;
  82. Disable sending UBX-TIM-TP.
  83. *-e OPTION*, *--enable OPTION*::
  84. Enable an option in the GPS. Accepts one parameter, OPTION, the option
  85. to enable. *-e* accepts the same OPTIONs as *-d*, except the
  86. action is to enable the option.
  87. *-f FILE*, *--file FILE*::
  88. Connect to a file or device. Accepts one parameter, FILE, the file or
  89. device to open. Files are opened read-only. Character devices are
  90. opened read/write, unless the *-r* parameter is given. Requires the
  91. pyserial module.
  92. *-g ITEM,LAYER,POSITION,END*, *--getitem ITEM,LAYER,POSITION,END*::
  93. Get the value of ITEM from LAYER, starting at POSITION, up to END
  94. key/value pairs (UBX-CFG-VALGET). All parameters past ITEM are
  95. optional and decimal. If LAYER is absent, then layers 0, 1, 2 and 7
  96. are all requested. See the section on CONFIGURATION ITEMS
  97. *--host HOST*::
  98. Connect to the *gpsd* on HOST (server). Defaults to localhost.
  99. *-i port*, *--portid port*::
  100. Specifies port ID # (interface) for port-related commands such as
  101. UBX_CFG-PRT.
  102. *-p PRESET*, *--preset PRESET*::
  103. Send a preset command the GPS. Usually accepts one parameter, PRESET,
  104. the name of the command to send. A few PRESETS, like LOG-FINDTIME,
  105. accept additional comma separated parameters. More than one -p may be
  106. used.
  107. Only the common PRESETS are shown here. To see the full list,
  108. including optional parameters, run "ubxtool -h -v 2".
  109. COLDBOOT;;
  110. Coldboot the GPS (UBX-CFG-RST).
  111. HOTBOOT;;
  112. Hotboot the GPS (UBX-CFG-RST).
  113. MODEL,model;;
  114. Configure the Dynamic Platform Model to model. (UBX-CFG-NAV5). Model
  115. is the decimal number of the desired mode.
  116. PMS;;
  117. Set power management settings (UBX-CFG-PMS). "PMS,pow" where pow is
  118. powerSetupValue.
  119. RATE;;
  120. Set measurement and nav rate (UBX-CFG-RATE). "RATE,meas,nav" meas is
  121. the measRate in milli seconds. The nav argument is the navRate in
  122. cycles and defaults to 1.
  123. RESET;;
  124. Reset configuration to defaults (UBX-CFG-CFG).
  125. SAVE;;
  126. Save current configuration (UBX-CFG-CFG).
  127. MON-RESETODO;;
  128. Reset the odometer (UBX-MON-RESETODO).
  129. MON-VER;;
  130. Poll GPS version (UBX-MON-VER).
  131. WARMBOOT;;
  132. Warmboot the GPS (UBX-CFG-RST).
  133. Most PRESET parameters are simple poll commands. They merely poll the
  134. GPS to respond with the associated message. For example "ubxtool -p
  135. CFG-GNSS" asks the GPS to respond with a UBX-CFG-GNSS message
  136. describing the current GNSS configuration. Increase the verbosity of
  137. the output by adding the "-v 2" or "-v 3" options.
  138. *--port PORT*::
  139. Use PORT to connect to *gpsd*. Defaults to 2947.
  140. *-P protver*, *--protver protver*::
  141. Sets the protocol version to use for sending commands. Minimum 6
  142. (Antaris 4). Use "ubxtool -p MON-VER" to see the version your receiver
  143. supports. Many newer u-blox receivers will fail silently or oddly if
  144. this is not set correctly. Default 10 (u-blox 5).
  145. *-r*, *-readonly*::
  146. Read only. Do not send anything to the GPS.
  147. *-R RAW*, *--rawfile RAW*::
  148. Save all raw serial data received from the GPS into the file RAW.
  149. *-s SPEED*, *--inspeed SPEED*::
  150. Set local serial port speed to SPEED bps. Default 9,600 bps.
  151. *-S SPEED*, *--setspeed SPEED*::
  152. Set the GPS serial port speed to SPEED bps.
  153. *-t*, *--timestamp*::
  154. Timestamp decoded messages with seconds since the epoch. Use it twice
  155. and also get UTC time.
  156. *-v VERBOSITY*, *--verbosity VERBOSITY*::
  157. Set verbosity level to VERBOSITY. Verbosity can be from 0 (very
  158. quiet), 2 (decode messages), to 4 (very noisy). Default 1.
  159. *-V*, *--version*::
  160. Print *ubxtool* version and exit.
  161. *-w WAIT*, *--wait WAIT*::
  162. Wait for WAIT seconds before exiting. Default 2 seconds.
  163. *-x ITEM,LAYERS*, *--delitem ITEM,LAYERS*::
  164. Delete the value of ITEM name from LAYERS. The bit map LAYERS is
  165. optional. By default, delete in both the BBR and FLASH layers in the
  166. receiver (UBX_CFG-VALDEL). Returning to the reciver default for that
  167. item. See the section on CONFIGURATION ITEMS
  168. *-z ITEM,VAL,LAYERS*, *--setitem ITEM,VAL,LAYERS*::
  169. Set the value of ITEM name to VAL in LAYERS in the GPS
  170. (UBX-CFG-VALSET). VAL and the bit mask LAYERS are decimal. ",LAYERS"
  171. is optional. The default LAYERS are RAM and FLASH. See the section on
  172. CONFIGURATION ITEMS
  173. == ARGUMENTS
  174. By default, clients collect data from the local *gpsd* daemon running
  175. on localhost, using the default GPSD port 2947. The optional argument
  176. to any client may override this behavior: *[server[:port[:device]]]*
  177. For further explanation, and examples, see the *ARGUMENTS* section in
  178. the *gps*(1) man page
  179. [[configitems]]
  180. == CONFIGURATION ITEMS
  181. Configuring u-blox GPS with the traditional configuration messages is
  182. fraught with problems. Many configuration messages interact in odd ways.
  183. Something as simple as changing the serial port speed requires you to
  184. read the current configuration using UBX-CFG-PRT for the proper port,
  185. merging in the change, the writing back the changed UBX-CFG-PRT message.
  186. Or just guessing at the current configuration and overwriting it all.
  187. The u-blox 9 series, protocol version 27+, tries, but does not
  188. completely succeed, to solve the problem with Configuration Items. If
  189. your GPS does not support protocol version 27+, then this section does
  190. not apply to you.
  191. Most of the configuration variables in the GPS have been assigned a
  192. 32-bit Key ID. Each Key references one specific value. A typical
  193. receiver may have over 1,100 Key IDs. Each Key ID has been assigned a
  194. Key Name. Most of the Key Names are documented by u-blox and supported
  195. by *ubxtool*. To see all the Key Name understood by *ubxtool* run: "ubxtool
  196. -h -v 3".
  197. To get the value related to an item, use "-g ITEM".
  198. To reset the value related to an item to it default value, use "-x
  199. ITEM".
  200. To set an ITEM name to a value, use "-z ITEM,VAL".
  201. If you only want to set an ITEM in one layer, use "-z ITEM,VAL,LAYER".
  202. See the EXAMPLES section for concrete examples.
  203. == EXAMPLES
  204. All examples assume that UBXOPTS is set with the protocol version of
  205. your receiver. Be sure to replace the "-P 18" with your correct
  206. prototype version.
  207. ----
  208. export UBXOPTS="-P 18"
  209. ----
  210. Dump configuration and status of the GNSS recceiver. The "-w 4" is to
  211. provide extra time for the operations to complete.
  212. ----
  213. ubxtool -p CONFIG -p STATUS -w 4 -v 2
  214. ----
  215. Decode raw log file:
  216. ----
  217. ubxtool -r -f ublox-neo-m8n.log
  218. ----
  219. Change GPS port speed of device on /dev/ttyAMA0 to 230,400 bps:
  220. ----
  221. ubxtool -S 230400 -f /dev/ttyAMA0
  222. ----
  223. Watch entire GPS reset cycle, include $GPTXT messages:
  224. ----
  225. ubxtool -p COLDBOOT -w 20 -v 2
  226. ----
  227. Poll Enabled Constellations:
  228. ----
  229. ubxtool -p CFG-GNSS
  230. ----
  231. Dump *gpsd* data from a remote server named x.example.com:
  232. ----
  233. ubxtool -w 5 x.example.com
  234. ----
  235. === CFG-TP5
  236. Some of the "-p" and "--preset" commands can take multiple options. One of
  237. these is "--preset CFG-TP5".
  238. Synopsis:
  239. ----
  240. -p CFG-TP5,[tpIdx = 0],[antCableDelay = 2],[rfGroupDelay = 0],[freqPeriod = 1000000],[freqPeriodLock = 1000000],[pulseLenRatio = 0],[pulseLenRatioLock = 100000],[userConfigDelay = 0],[flags = 0x77]
  241. ----
  242. Leave a positional parameter empty for it to take the default value.
  243. To set the pulse period to 0.25 s and its length to 0.1 s:
  244. ----
  245. $ ubxtool -p CFG-TP5,,,,250000,250000,100000,100000
  246. ----
  247. To set the pulse period to 0.1 s and length to 0.1 s in the presence of lock:
  248. ----
  249. $ ubxtool -p CFG-TP5,,,,,100000,,50000
  250. ----
  251. === Version 27+ examples
  252. The following examples require a GPS supporting protocol 27 or greater.
  253. Be sure to set your protocol version first:
  254. ----
  255. export UBXOPTS="-P 32"
  256. ----
  257. To check the current dynamic model, change it to 6 (AIR1, Airborne with
  258. <1g acceleration), revert to the default setting, and verify the faults
  259. was restored.
  260. ----
  261. $ ubxtool -g CFG-NAVSPG-DYNMODEL
  262. [...]
  263. UBX-CFG-VALGET:
  264. version 1 layer 0 reserved 0,0
  265. layers (ram)
  266. item CFG-NAVSPG-DYNMODEL/0x20110021 val 2
  267. [...]
  268. $ ubxtool -z CFG-NAVSPG-DYNMODEL,6
  269. [...]
  270. UBX-ACK-ACK:
  271. ACK to Class x6 (CFG) ID x8a (VALSET)
  272. [...]
  273. $ ubxtool -g CFG-NAVSPG-DYNMODEL
  274. [...]
  275. UBX-CFG-VALGET:
  276. version 1 layer 0 reserved 0,0
  277. layers (ram)
  278. item CFG-NAVSPG-DYNMODEL/0x20110021 val 6
  279. [...]
  280. $ ubxtool -x CFG-NAVSPG-DYNMODEL
  281. [...]
  282. UBX-ACK-ACK:
  283. ACK to Class x6 (CFG) ID x8c (VALDEL)
  284. [...]
  285. $ ubxtool -g CFG-NAVSPG-DYNMODEL
  286. [...]
  287. UBX-CFG-VALGET:
  288. version 1 layer 0 reserved 0,0
  289. layers (ram)
  290. item CFG-NAVSPG-DYNMODEL/0x20110021 val 6
  291. ----
  292. Notice that the current DYNMODEL stayed at 6 (AIR1). The "-x" only
  293. affects the saved setting, not the current setting. To change the
  294. current setting you must set it with "-z".
  295. Getting all the Configuration Items in a group one by one could be very
  296. tedious. VAL-GET allows you to wild card the item number and dump all
  297. the items in a group. To get all the CFG-TP items in ram, the currently
  298. active ones, you can do this:
  299. ----
  300. $ ubxtool -g CFG-TP,0
  301. [...]
  302. UBX-CFG-VALGET:
  303. version 1 layer 0 position 0
  304. layers (ram)
  305. item CFG-TP-TP1_ENA/0x10050007 val 1
  306. item CFG-TP-SYNC_GNSS_TP1/0x10050008 val 1
  307. item CFG-TP-USE_LOCKED_TP1/0x10050009 val 1
  308. [...]
  309. ----
  310. The truly masochistic can dump all the Configuration Items by
  311. wildcarding the group. Dumping all 1,000+ of them, 64 at a time, could
  312. still be tedious. The -g parameter optionally allows you to specify the
  313. starting position to get from, as well as the ending position. To get
  314. all the known, and unknown, items supported by the receiver that are
  315. currently in ram:
  316. ----
  317. $ ubxtool -g CFG,0,0,1200 | fgrep "item CFG-"
  318. item CFG-1-1/0x10010001 val 0
  319. item CFG-1-1/0x10010101 val 0
  320. item CFG-4-1/0x10040001 val 1
  321. item CFG-4-2/0x10040002 val 0
  322. item CFG-4-3/0x10040003 val 0
  323. item CFG-4-4/0x10040004 val 0
  324. item CFG-4-9/0x10040009 val 0
  325. item CFG-TP-TP1_ENA/0x10050007 val 1
  326. item CFG-TP-SYNC_GNSS_TP1/0x10050008 val 1
  327. [...]
  328. ----
  329. Changing +CFG,0,0,1200+ to +CFG,7,0,1200+ would instead dump all the
  330. configuration defaults, from the Default layer (7).
  331. == ENVIRONMENT
  332. Options can be placed in the UBXOPTS environment variable. UBXOPTS is
  333. processed before the CLI options.
  334. == RETURN VALUES
  335. *0*:: on success.
  336. *1*:: on failure
  337. == SEE ALSO
  338. *ubxtool* is written to conform to the official u-blox documentation for
  339. the u-blox binary protocol.
  340. https://www.u-blox.com/en/product-resources[]
  341. *gpsd*(8), *gpsctl*(1), *gps*(1)
  342. == RESOURCES
  343. *Project web site:* {gpsdweb}
  344. == COPYING
  345. This file is Copyright 2013 by the GPSD project +
  346. SPDX-License-Identifier: BSD-2-clause