Skip to content

Commit 6318127

Browse files
authored
Merge pull request #1 from sparkfun/main
merge in SparkFun's main
2 parents 7c7c8c2 + b758699 commit 6318127

File tree

59 files changed

+17761
-7209
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+17761
-7209
lines changed

Diff for: .github/workflows/compile-sketch.yml

+5-11
Original file line numberDiff line numberDiff line change
@@ -87,27 +87,21 @@ jobs:
8787
steps:
8888
- name: Checkout
8989
uses: actions/checkout@v2
90+
91+
- name: Branch name
92+
run: echo running on branch ${GITHUB_REF##*/}
9093

9194
- name: Compile Sketch
9295
uses: arduino/compile-sketches@v1
9396
with:
9497
platforms: ${{ matrix.board.platforms }}
9598
fqbn: ${{ matrix.board.fqbn }}
9699
libraries: |
97-
- source-url: https://github.com/${{github.repository}}.git
100+
- source-path: ./
98101
sketch-paths: |
99-
- examples/Example10_AltitudeMSL
100-
- examples/Example11_ResetModule/Example1_FactoryDefaultviaI2C
101-
- examples/Example13_PVT/Example1_AutoPVT
102-
- examples/Example13_PVT/Example2_AutoPVT_ExplicitUpdate
103-
- examples/Example14_DebugOutput
104-
- examples/Example15_GetDateTime
105-
- examples/Example16_Nanosecond_MaxOutput
106-
- examples/Example16_PartialSecond_MaxOutput
107-
- examples/Example18_PowerSaveMode
108-
- examples/Example19_DynamicModel
109102
- examples/Example20_SendCustomCommand
110103
enable-warnings-report: true
104+
enable-deltas-report: true
111105
# verbose: true
112106

113107
# outputs:

Diff for: Adding_New_Messages.md

+168
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
## How to add new messages to the SparkFun u-blox GNSS Arduino Library
2+
3+
Based on [this issue](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/issues/97), here is a summary of how to add new messages to the SparkFun u-blox GNSS Arduino Library with full "auto" support (for callbacks, logging, etc.).
4+
5+
Looking at the issue, we see that the library is not supporting the UBX-NAV-PVAT (Navigation Position Velocity Attitude Time solution).
6+
PVAT is a new message added in version 1.21 of the HPS (High Precision Fusion) firmware and version 33.21 of the F9 Interface Description.
7+
This makes us wonder if more new messages have been added which should also be included?
8+
9+
### Step 1: Check the Interface Description for new keys
10+
11+
* Download the latest [interface description](https://www.u-blox.com/sites/default/files/F9-HPS-1.21_InterfaceDescription_UBX-21019746.pdf) from the [u-blox website](https://www.u-blox.com/en/product/zed-f9r-module#tab-documentation-resources)
12+
* Open the interface description in Adobe Acrobat Reader DC (the free version)
13+
* Do a ```File \ Save as Text...```
14+
* Save the file in ```Text (Accessible) (*.txt)``` format
15+
* Go make a cup of tea - this takes a while
16+
* Open the txt file in Notepad++ or another editor which supports Regular Expressions
17+
* The keys will have been saved as individual lines in the format: 0xnnnnnnnn space CR LF
18+
* So all we need to do is use a regex to delete everything else
19+
* Open Search \ Replace
20+
* Click the Search Mode - Regular Expression button
21+
* In the "Find what :" box enter: ```^(?!.*0x[\dabcdefABCDEF]{8}\s\r\n).*```
22+
* Clear the "Replace with :" box
23+
* Click "Replace All"
24+
* You are left with just the keys - and a bunch of empty lines, some of which contain form feeds (\f)
25+
* Delete the empty lines (\r\n) by replacing \r\n with nothing - don't panic, this takes a few seconds
26+
* Delete the form feeds by replacing \f with nothing
27+
* Finally replace the remaining spaces (\s) with \r\n
28+
* Delete any spurious lines left at the start of the file. E.g. ROM and BASE and 0x118B2060. These came from the General information section
29+
* The following line (0x10340014) is the first key from the "Configuration Reference" section
30+
* Search for that key number and you will find it again half way through the file. This second copy came from "Configuration Defaults"
31+
* Delete the duplicate keys from that line onwards
32+
* Save the file
33+
* Open it in a spreadsheet, e.g. LibreOffice Calc
34+
* Select the "A" column and click "Sort Ascending A-Z"
35+
* Save the file (as Text CSV)
36+
* Use KDiff3 or another diff package to see the new additions
37+
38+
You can find the keys in the [keys folder](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/tree/main/keys), saved as sorted text files.
39+
There are separate files for the P, R and T interfaces, plus a combined list (also sorted in ascending order).
40+
41+
Comparing HPS 1.21 to HPS 1.20, we can see that the following keys have been added:
42+
43+
* 0x10340014 CFG-BDS-USE_GEO_PRN
44+
* 0x10710005 CFG-I2CINPROT-SPARTN
45+
* 0x10730005 CFG-UART1INPROT-SPARTN
46+
* 0x10750005 CFG-UART2INPROT-SPARTN
47+
* 0x10770005 CFG-USBINPROT-SPARTN
48+
* 0x10790005 CFG-SPIINPROT-SPARTN
49+
* 0x20050035 CFG-TP-DRSTR_TP1
50+
* 0x20910605 CFG-MSGOUT-UBX_RXM_SPARTN_I2C
51+
* 0x20910606 CFG-MSGOUT-UBX_RXM_SPARTN_UART1
52+
* 0x20910607 CFG-MSGOUT-UBX_RXM_SPARTN_UART2
53+
* 0x20910608 CFG-MSGOUT-UBX_RXM_SPARTN_USB
54+
* 0x20910609 CFG-MSGOUT-UBX_RXM_SPARTN_SPI
55+
* 0x2091062a CFG-MSGOUT-UBX_NAV_PVAT_I2C
56+
* 0x2091062b CFG-MSGOUT-UBX_NAV_PVAT_UART1
57+
* 0x2091062c CFG-MSGOUT-UBX_NAV_PVAT_UART2
58+
* 0x2091062d CFG-MSGOUT-UBX_NAV_PVAT_USB
59+
* 0x2091062e CFG-MSGOUT-UBX_NAV_PVAT_SPI
60+
* 0x20910634 CFG-MSGOUT-UBX_SEC_SIG_I2C
61+
* 0x20910635 CFG-MSGOUT-UBX_SEC_SIG_UART1
62+
* 0x20910636 CFG-MSGOUT-UBX_SEC_SIG_UART2
63+
* 0x20910637 CFG-MSGOUT-UBX_SEC_SIG_USB
64+
* 0x20910638 CFG-MSGOUT-UBX_SEC_SIG_SPI
65+
66+
Interestingly, we can also see that one key has been deleted:
67+
68+
* 0x10530006 CFG-UART2-REMAP
69+
70+
From this we can confirm - as documented by u-blox in the [Release Notes](https://www.u-blox.com/sites/default/files/ZED-F9R-02B_FW1.00HPS1.21_RN_UBX-21035491_1.3.pdf) -
71+
that HPS 1.21:
72+
73+
* adds support for SPARTN (Safe Position Augmentation for Real-Time Navigation) correction messages
74+
* enables the use of BeiDou geostationary satellites (previously, this configuration item had a different name)
75+
* enables UBX-SEC-SIG message (signal security measures) as output across the different interfaces
76+
* enables UBX_NAV_PVAT message (navigation and altitude position) as output across the different interfaces
77+
78+
There are also two new dynamic models, robotic lawn mower (11) and e-scooter model (12), which we need to add to the library.
79+
80+
See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/805aab18b6656513bfee473487a437754cd3965d) for the changes.
81+
82+
### Step 2: Update the combined keys file
83+
84+
Update [u-blox_config_keys_sorted.txt](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/blob/main/keys/u-blox_config_keys_sorted.txt)
85+
to include the new keys.
86+
87+
See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/8895764f237ae494dcd0fa1ae942d487d2e1557f) for the changes.
88+
89+
### Step 3: Update u-blox_config_keys.h
90+
91+
Update [u-blox_config_keys.h](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/blob/main/src/u-blox_config_keys.h) to include the new keys.
92+
Include the descriptions as defined in the Interface Description.
93+
94+
See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/3609da15f90a7a66b41524e77c6dc3dd76cd362c) for the changes.
95+
96+
### Step 4: Add the new message struct to u-blox_struct.h
97+
98+
The next step is to add the new struct for UBX-NAV-PVAT to u-blox_struct.h.
99+
100+
The messages are in ascending class and ID order. So we add UBX-NAV-PVAT (0x01 0x17) after UBX-NAV-HPPOSLLH (0x01 0x14).
101+
102+
The names and widths of the fields are taken directly from the interface definition.
103+
104+
See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/a4ba440c6240e0974c27f40b976a5ddf0fbdb9b6) for the changes.
105+
106+
### Step 5: Update SparkFun_u-blox_GNSS_Arduino_Library.h
107+
108+
Add the new message ID: ```const uint8_t UBX_NAV_PVAT = 0x17;```
109+
110+
Add the new functions to provide "auto" support for UBX-NAV-PVAT: ```getNAVPVAT```, ```setAutoNAVPVAT```, ..., ```logNAVPVAT```
111+
112+
Add new helper functions to access the most important fields: ```getVehicleRoll```, ..., ```getMotionHeading```
113+
114+
Add the pointer to the struct storage: ```UBX_NAV_PVAT_t *packetUBXNAVPVAT = NULL;```
115+
116+
Add the private init function: ```bool initPacketUBXNAVPVAT();```
117+
118+
See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/423a1e2ccd418dd679257edc6edeec0bd3029052) for the changes.
119+
120+
### Step 6: Update SparkFun_u-blox_GNSS_Arduino_Library.cpp
121+
122+
Now we need to update SparkFun_u-blox_GNSS_Arduino_Library.cpp:
123+
124+
#### Step 6.1: Update end()
125+
126+
See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/35d225e3f1abb316eda3becb7f8e2eb04ff1d17c) for the changes.
127+
128+
#### Step 6.2: Update checkAutomatic()
129+
130+
See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/b746d8e2742961ede95e2d06d5db3a3a557e571d) for the changes.
131+
132+
#### Step 6.3: Update getMaxPayloadSize()
133+
134+
#### Step 6.4: Update processUBXpacket()
135+
136+
Take time to double-check that you have used the correct data width, signed/unsigned and position for each field.
137+
138+
See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/8eecdd5044f810b0e2b567150ff63a17c219fe8e) for the changes.
139+
140+
#### Step 6.5: Update checkCallbacks()
141+
142+
See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/b53bffaa3ae12482cfb268f23796963d0b8519c9) for the changes.
143+
144+
#### Step 6.6: Add the "auto" functions
145+
146+
See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/e394ae003ad38117d150598774d0552059416473) for the changes.
147+
148+
#### Step 6.7: Add the helper functions (if any)
149+
150+
See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/318e76383e96d6676bbb57294c25e665c0d4a31f) for the changes.
151+
152+
### Step 7: Add an example
153+
154+
See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/06014dc95f1b9ffae4876fbacfb9390541d7c31d) for the changes.
155+
156+
### Step 8: Update keywords.txt
157+
158+
Add the new "auto" and helper functions to keywords.txt.
159+
160+
See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/4f0a0ca3c5e6420be9064b91702947c23104bd1b) for the changes.
161+
162+
### Step 9: Update Theory.md
163+
164+
Add the new message to the list of "auto" messages.
165+
166+
See [this commit](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/commit/57f133259245d8071c73797e4be2ff630c2720ab) for the changes.
167+
168+
That's all folks!

Diff for: README.md

+33-4
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,35 @@ u-blox makes some incredible GNSS receivers covering everything from low-cost, h
2121

2222
This library can be installed via the Arduino Library manager. Search for **SparkFun u-blox GNSS**.
2323

24-
## v2.0
24+
## Automatic support for correction services like PointPerfect (u-blox), RTK2go, Emlid Caster and Skylark (Swift Navigation)
25+
26+
u-blox's PointPerfect GNSS augmentation service uses the secure MQTT protocol to download SPARTN format correction data, providing "3-6 cm accuracy and convergence within seconds". Please see the new [PointPerfect Client example](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/tree/main/examples/ZED-F9P/Example18_PointPerfectClient) for more details.
27+
28+
v2.2.1 also supports L-band correction services using the new u-blox NEO-D9S correction data receiver. Please see the new [L-band Corrections example](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library/tree/main/examples/ZED-F9P/Example19_LBand_Corrections_with_NEO-D9S) for more details.
29+
30+
Other RTK NTRIP corrections services often require you to send them your location in NMEA GPGGA format. v2.2 of the library makes this easy by providing get functions and automatic callbacks
31+
for both GPGGA and GNGGA messages. You can now instruct your module to output GPGGA (e.g.) every 10 seconds and then push it to the correction server directly from the callback. No more polling, no more parsing!
32+
33+
v2.2 also includes two new functions useful for correction services:
34+
35+
* ```setMainTalkerID``` : lets you change the NMEA Talker ID (prefix) from "GN" to "GP" - just in case your correction service really does need GPGGA, not GNGGA
36+
* ```setHighPrecisionMode``` : adds extra decimal places in the GGA messages, increasing the resolution of latitude, longitude and altitude
37+
38+
Please see the new [Automatic_NMEA examples](./examples/Automatic_NMEA) for more details.
39+
40+
We've also added a new [NTRIP Caster Client example](./examples/ZED-F9P/Example17_NTRIPClient_With_GGA_Callback) showing how to use these new features to full effect.
41+
42+
## AssistNow<sup>TM</sup>
43+
44+
v2.1 of the library adds support for u-blox AssistNow<sup>TM</sup> Assisted GNSS (A-GNSS) which can dramatically reduce the time-to-first-fix. You can find further details in the [AssistNow Examples folder](./examples/AssistNow).
45+
46+
## v2 vs. v1
2547

2648
This library is the new and improved version of the very popular SparkFun u-blox GNSS Arduino Library. v2.0 contains some big changes and improvements:
2749

2850
* Seamless support for "automatic" message delivery:
29-
* In v1.8, you could ask for the NAV PVT (Navigation Position Velocity Time) message to be delivered _automatically_, without polling. v2.0 adds automatic support for [**23 messages**](./Theory.md#auto-messages), covering the full range of: standard and High Precision position, velocity and time information; relative positioning; event capture with nanosecond time resolution; raw GNSS signal data including carrier phase; Sensor Fusion; and High Navigation Rate data.
51+
* In v1.8, you could ask for the NAV PVT (Navigation Position Velocity Time) message to be delivered _automatically_, without polling. v2.0 adds automatic support for [**26 messages**](./Theory.md#auto-messages), covering the full range of: standard and High Precision position, velocity, attitude and time information; relative positioning; event capture with nanosecond time resolution; raw GNSS signal data including carrier phase; Sensor Fusion; and High Navigation Rate data.
52+
* Don't see the message you really need? [Adding_New_Messages](./Adding_New_Messages.md) provides details on how to add "auto" support for your favourite message.
3053
* Dynamic memory allocation with clearly-defined data storage structs for each message:
3154
* There are no static 'global' variables to eat up your RAM. v2.0 automatically allocates memory for the automatic messages when they are enabled. You may find your total RAM use is lower with v2.0 than with v1.8.
3255
* Each "auto" message has a clearly-defined [data storage struct](./src/u-blox_structs.h) which follows the u-blox protocol specification precisely.
@@ -53,6 +76,8 @@ Migrating to v2.0 is easy. There are two small changes all users will need to ma
5376

5477
If you are using the Dead Reckoning Sensor Fusion or High Dynamic Rate messages, you will need to make more small changes to your code. Please see the [dead reckoning examples](./examples/Dead_Reckoning) for more details. There is more detail available in [Theory.md](./Theory.md#migrating-your-code-to-v20) if you need it.
5578

79+
There is a [new example](./examples/Dead_Reckoning/Example8_getNAVPVAT) showing how to read the UBX-NAV-PVAT (Position, Velocity, Attitude, Time) with a single function call. UBX-NAV-PVAT has full "auto" callback and data-logging support too!
80+
5681
## Memory Usage
5782

5883
The u-blox GNSS library has grown considerably over the years and v2.0.8 came very close to completely filling the program memory on platforms like the ATmega328 (Arduino Uno).
@@ -79,9 +104,13 @@ The SPI examples have their [own folder](./examples/SPI).
79104

80105
Please check the module datasheets for details on what clock speeds and data rates each module supports. The maximum clock speed is typically 5.5MHz and the maximum transfer rate is typically 125kBytes/s.
81106

82-
## Max (400kHz) I<sup>2</sup>C Support
107+
## I<sup>2</sup>C Support
108+
109+
For I<sup>2</sup>C communication, please be sure to remove all additional pull-ups on the I<sup>2</sup>C bus. u-blox modules include internal pull-ups on the I<sup>2</sup>C lines (sometimes called DDC in their manuals). Cut all I<sup>2</sup>C pull-up jumpers and/or remove them from peripheral boards. Otherwise, various data glitches can occur. See issues [38](https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/issues/38) and [40](https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/issues/40) for more information. We recommend running the I<sup>2</sup>C bus at 100kHz.
110+
111+
## Compatibility
83112

84-
To achieve 400kHz I<sup>2</sup>C speed please be sure to remove all pull-ups on the I<sup>2</sup>C bus. Most, if not all, u-blox modules include internal pull ups on the I<sup>2</sup>C lines (sometimes called DDC in their manuals). Cut all I<sup>2</sup>C pull up jumpers and/or remove them from peripheral boards. Otherwise, various data glitches can occur. See issues [38](https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/issues/38) and [40](https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/issues/40) for more information. If possible, run the I<sup>2</sup>C bus at 100kHz.
113+
v2 of the library provides support for generation 8, 9 and 10 u-blox GNSS modules. For generation 6 and 7, please see [this example (depricated)](https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/tree/master/examples/Series_6_7/Example1_GetPositionAndTime_Series_6_7).
85114

86115
## Contributing
87116

Diff for: Theory.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ When the user calls one of the methods the library will poll the u-blox module f
55
* Wait for a minimum of 25 ms between polls (configured dynamically when update rate is set)
66
* Write 0xFD to module
77
* Read two bytes (0xFD and 0xFE) for bytes available
8-
* If 0x7F or 0xFF then no bytes are available
98
* Otherwise, read number of bytes and process into NMEA, UBX, or RTCM frame.
109
* If checksum is valid, flag frame as complete.
1110

@@ -55,9 +54,11 @@ In v2.0, the full list of messages which can be processed and logged automatical
5554
- UBX-NAV-VELNED (0x01 0x12): Velocity solution in NED frame
5655
- UBX-NAV-HPPOSECEF (0x01 0x13): High precision position solution in ECEF
5756
- UBX-NAV-HPPOSLLH (0x01 0x14): High precision geodetic position solution
57+
- UBX-NAV-PVAT (0x01 0x17): Navigation position velocity attitude time solution (**only with ADR or UDR products**)
5858
- UBX-NAV-CLOCK (0x01 0x22): Clock solution
5959
- UBX-NAV-SVIN (0x01 0x3B): Survey-in data (**only with High Precision GNSS products**)
6060
- UBX-NAV-RELPOSNED (0x01 0x3C): Relative positioning information in NED frame (**only with High Precision GNSS products**)
61+
- UBX-NAV-AOPSTATUS (0x01 0x60): AssistNow Autonomous status
6162
- UBX-RXM-SFRBX (0x02 0x13): Broadcast navigation data subframe
6263
- UBX-RXM-RAWX (0x02 0x15): Multi-GNSS raw measurement data (**only with ADR or High Precision GNSS or Time Sync products**)
6364
- UBX-TIM-TM2 (0x0D 0x03): Time mark data
@@ -70,6 +71,8 @@ In v2.0, the full list of messages which can be processed and logged automatical
7071
- UBX-HNR-ATT (0x28 0x01): Attitude solution (**only with ADR or UDR products**)
7172
- UBX-HNR-INS (0x28 0x02): Vehicle dynamics information (**only with ADR or UDR products**)
7273

74+
Please see [Adding_New_Messages](./Adding_New_Messages.md) for details on how to add "auto" support for new messages.
75+
7376
Notes:
7477
- UBX-NAV-POSLLH is not supported as UBX-NAV-PVT contains the same information
7578
- UBX-NAV-TIMEUTC is not supported as UBX-NAV-PVT contains the same information

0 commit comments

Comments
 (0)