|
| 1 | +# Updating RTK Firmware |
| 2 | + |
| 3 | +The RTK Facet is open source hardware meaning you have total access to the [firmware](https://github.com/sparkfun/SparkFun_RTK_Firmware) and [hardware](https://github.com/sparkfun/SparkFun_RTK_Facet). Be sure to checkout each repo for the latest firmware and hardware information. But for those who want to jump right in and tweak the firmware, we will discuss various methods. |
| 4 | + |
| 5 | +There are two firmwares that operate on the device: |
| 6 | + |
| 7 | +* Firmware on the ESP32 microcontroller. See below. |
| 8 | +* Firmware on the ZED-F9P Receiver. See [How to Upgrade Firmware of a u-blox Receiver](https://learn.sparkfun.com/tutorials/how-to-upgrade-firmware-of-a-u-blox-gnss-receiver/all) |
| 9 | + |
| 10 | + |
| 11 | +[](https://cdn.sparkfun.com/assets/learn_tutorials/2/1/8/8/SparkFun_RTK_Facet_-_Serial_Config_-_Main.jpg) |
| 12 | + |
| 13 | +*Main Menu showing RTK Firmware v1.8-Oct 7 2021* |
| 14 | + |
| 15 | +You can check your firmware by opening the main menu by pressing a key at any time. |
| 16 | + |
| 17 | +## Updating Firmware From the SD Card |
| 18 | + |
| 19 | +[](https://cdn.sparkfun.com/assets/learn_tutorials/1/8/5/7/SparkFun_RTK_Express_-_Firmware_Update.jpg) |
| 20 | + |
| 21 | +*Firmware update taking place* |
| 22 | + |
| 23 | +From time to time SparkFun will release new firmware for the RTK Facet to add and improve functionality. For most users, firmware can be upgraded by loading the appropriate firmware file from the [binaries repo folder](https://github.com/sparkfun/SparkFun_RTK_Firmware/tree/main/Binaries/For_SD_Loading) onto the SD card and bringing up the firmware menu as shown above. |
| 24 | + |
| 25 | +The firmware upgrade menu will only display files that have the "RTK_Surveyor_Firmware*.bin" file name format so don't change the file names once loaded onto the SD card. Select the firmware you'd like to load and the system will proceed to load the new firmware, then reboot. |
| 26 | + |
| 27 | +Note: The firmware is called `RTK_Surveyor_Firmware_vXX.bin` even though this product is called the *RTK Facet*. We united the different platforms into one. The [RTK Firmware](https://github.com/sparkfun/SparkFun_RTK_Firmware) runs on all our RTK products. |
| 28 | + |
| 29 | +## Updating Firmware From WiFi |
| 30 | + |
| 31 | +**Note:** Firmware versions 1.1 to 1.9 have an issue that severely limit firmware upload over WiFi and is not recommended; use the 'Updating Firmware From the SD Card' method instead. Firmware versions v1.10 and beyond support direct firmware update via WiFi and is the preferred method for updating the firmware on a unit. |
| 32 | + |
| 33 | +[](https://cdn.sparkfun.com/assets/learn_tutorials/2/1/8/8/SparkFun_RTK_Facet_-_WiFi_Config_Firmware_Update_Button.jpg) |
| 34 | + |
| 35 | +*Advanced system settings* |
| 36 | + |
| 37 | +Alternatively, firmware may be uploaded via the WiFi AP interface. |
| 38 | + |
| 39 | +**Versions 1.1 to 1.9:** For firmware versions 1.1 to 1.9, the upload process is limited in speed resulting in upload times of nearly 2 minutes. Because of this, we recommend using the 'Updating Firmware From the SD Card' method instead. If you do upload firmware over WiFi, once it has been uploaded it will be viewable on the 'Available Firmware' on the page. To prevent accidental loading the *Enable Firmware Update* checkbox must first be checked before the button is enabled. |
| 40 | + |
| 41 | +**Versions 1.10 and Greater:** Firmware may be uploaded to the unit by clicking on 'Choose File', selecting the binary such as 'RTK_Surveyor_Firmware_v1_xx.bin' and pressing upload. The unit will automatically reset once firmware upload is complete. |
| 42 | + |
| 43 | +## Updating Firmware From CLI |
| 44 | + |
| 45 | +The command line interface is also available for more advanced users or users who want to avoid the hassle of swapping out SD cards. You’ll need to download esptool.exe and RTK_Surveyor_Firmware_vXXX_Combined.bin from [the repo](https://github.com/sparkfun/SparkFun_RTK_Firmware/tree/main/Binaries). |
| 46 | + |
| 47 | +Connect a USB A to C cable from your computer to the ESP32 port on the RTK Facet. Now identify the com port the RTK Enumerated at. The easiest way to do this is to open the device manager: |
| 48 | + |
| 49 | +[](https://cdn.sparkfun.com/assets/learn_tutorials/1/4/6/3/RTK_Surveyor_-_Firmware_Update_COM_Port.jpg) |
| 50 | + |
| 51 | +*CH340 is on COM6 as shown in Device Manager* |
| 52 | + |
| 53 | +If the COM port is not showing be sure the unit is turned **On**. If an unknown device is appearing, you’ll need to [install drivers for the CH340](https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all). Once you know the COM port, open a command prompt (Windows button + r then type ‘cmd’). |
| 54 | + |
| 55 | +Navigate to the directory that contains the firmware file and esptool.exe. Run the following command: |
| 56 | + |
| 57 | + language:c |
| 58 | + esptool.exe --chip esp32 --port COM6 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0 RTK_Surveyor_Firmware_v19_combined.bin |
| 59 | + |
| 60 | +Note: You will need to modify **COM6** to match the serial port that RTK Facet enumerates at. |
| 61 | + |
| 62 | +[](https://cdn.sparkfun.com/assets/learn_tutorials/1/4/6/3/RTK_Surveyor_-_Firmware_Update_CLI.jpg) |
| 63 | + |
| 64 | +*Programming via the esptool CLI* |
| 65 | + |
| 66 | +Upon completion, your RTK Facet will have the latest and greatest features! |
| 67 | + |
| 68 | +## Compiling from Source |
| 69 | + |
| 70 | +The SparkFun RTK firmware is compiled using Arduino (currently v1.8.15). To compile: |
| 71 | + |
| 72 | +1. Install [Arduino](https://www.arduino.cc/en/software). |
| 73 | +2. Install ESP32 for Arduino. [Here](https://learn.sparkfun.com/tutorials/esp32-thing-hookup-guide#installing-via-arduino-ide-boards-manager) are some good instructions for installing it via the Arduino Boards manager. **Note**: Use v2.0.2 of the core. **Note:** We use the 'ESP32 Dev Module' for pin numbering. Select the correct board under Tools->Board->ESP32 Arduino->ESP32 Dev Module. |
| 74 | +3. Change the Parition table. Replace 'C:\Users\\[user name]\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.2\tools\partitions\min_spiffs.csv' with the min_spiff.csv file found in this folder. This will increase the program partition from a maximum of 1.9MB to 3MB. |
| 75 | +4. Set the core settings: The 'Partition Scheme' must be set to 'Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS). This will use the 'min_spiffs.csv' updated partition table. |
| 76 | +5. Set the 'Flash Size' to 16MB (128mbit) |
| 77 | +6. Obtain all the required libraries. **Note:** You should click on the link next to each of the #includes at the top of RTK_Surveyor.ino within the Arduino IDE to open the library manager and download them. Getting them directly from github also works but may not be 'official' releases: |
| 78 | + * [ESP32Time](https://github.com/fbiego/ESP32Time) |
| 79 | + * [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer) (not available via library manager) |
| 80 | + * [AsyncTCP](https://github.com/me-no-dev/AsyncTCP) (not available via library manager) |
| 81 | + * [JC_Button](https://github.com/JChristensen/JC_Button) |
| 82 | + * [SdFat](https://github.com/greiman/SdFat) |
| 83 | + * [SparkFun u-blox GNSS Arduino Library](https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library) |
| 84 | + * [SparkFun MAX1704x Fuel Gauge Arduino Library](https://github.com/sparkfun/SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library) |
| 85 | + * [SparkFun Micro OLED Arduino Library](https://github.com/sparkfun/SparkFun_Micro_OLED_Arduino_Library) - Note the Arduino Library manager lists this as 'SparkFun Micro OLED Breakout' |
| 86 | + * [SparkFun LIS2DH12 Accelerometer Arduino Library](https://github.com/sparkfun/SparkFun_LIS2DH12_Arduino_Library) |
| 87 | + |
| 88 | +Once compiled, firmware can be uploaded directly to a unit when the RTK unit is on and the correct COM port is selected under the Arduino IDE Tools->Port menu. |
| 89 | + |
| 90 | +Note: The COMPILE_WIFI and COMPILE_BT defines at the top of RTK_Surveyor.ino can be commented out to remove them from compilation. This will greatly reduce the firmware size and allow for faster development of functions that do not rely on WiFi or Bluetooth (serial menus, system configuration, logging, etc). |
| 91 | + |
| 92 | +## Creating Custom Firmware |
| 93 | + |
| 94 | +The RTK Facet is an ESP32 and high-precision GNSS hackers’s delight. Writing custom firmware can be done using Arduino. |
| 95 | + |
| 96 | +[](https://cdn.sparkfun.com/assets/learn_tutorials/1/4/6/3/RTK_Surveyor_-_Firmware_Update_-_Select_ESP32_Dev_Module.jpg) |
| 97 | + |
| 98 | +*Selecting ESP32 Dev Module* |
| 99 | + |
| 100 | +Please see the [ESP32 Thing Plus Hookup Guide](https://learn.sparkfun.com/tutorials/esp32-thing-plus-hookup-guide/all#software-setup) for information about getting Arduino setup. The only difference is that you will need to select *ESP32 Dev Module* as your board. |
| 101 | + |
| 102 | +[](https://cdn.sparkfun.com/assets/learn_tutorials/1/4/6/3/RTK_Surveyor_-_Arduino_Setup_-_Library_Link.jpg) |
| 103 | + |
| 104 | +*Arduino Library Links* |
| 105 | + |
| 106 | +Pull the entire [RTK Firmware repo](https://github.com/sparkfun/SparkFun_RTK_Firmware) and open `/Firmware/RTK_Surveyor/RTK_Surveyor.ino` and Arduino will open all the sub-files in new tabs. We’ve broken the functional pieces into smaller tabs to help users navigate it. There are a handful of libraries that will need to be installed. To make this easier, we’ve placed a link next to each library that will automatically open the Arduino Library Manager with that library ready for download. |
| 107 | + |
| 108 | +After connecting a USB C cable to the ESP32 Config connector and selecting the correct COM port you should be able to upload new firmware through the Arduino IDE. Note: The RTK Facet must be turned on for it to enumerate as a COM port. |
| 109 | + |
| 110 | +## A note about ZED-F9P firmware |
| 111 | + |
| 112 | +The firmware loaded onto the ZED-F9P receiver can vary depending on manufacture date. All field testing and device specific performance parameters were obtained with v1.30. |
| 113 | + |
| 114 | +v1.12 has the benefit of working with SBAS and an operational RTK status signal (the LED illuminates correctly). See [release notes](https://content.u-blox.com/sites/default/files/ZED-F9P-FW100-HPG112_RN_%28UBX-19026698%29.pdf). |
| 115 | + |
| 116 | +v1.13 has a few RTK and receiver performance improvements but introduces a bug that causes the RTK Status LED to fail when SBAS is enabled. See [release notes](https://content.u-blox.com/sites/default/files/ZED-F9P-FW100-HPG113_RN_%28UBX-20019211%29.pdf). |
| 117 | + |
| 118 | +v1.30 has a few RTK and receiver performance improvements, I<sup>2</sup>C communication improvements, and most importantly support for Spartan PMP packets. See [release notes](https://www.u-blox.com/sites/default/files/ZED-F9P-FW100-HPG130_RN_UBX-21047459.pdf). |
| 119 | + |
| 120 | +v1.32 has a few Spartan protocol specific improvements. See [release notes](https://www.u-blox.com/sites/default/files/documents/ZED-F9P-FW100-HPG132_RN_UBX-22004887.pdf). |
| 121 | + |
| 122 | +The RTK Firmware is designed to work with any ZED-F9x firmware. Upgrading the ZED-F9x is a good thing to consider but is not crucial to the use of the RTK products. |
| 123 | + |
| 124 | +A tutorial with step-by-step instructions for locating the firmware version as well as changing the firmware can be found [here](https://learn.sparkfun.com/tutorials/how-to-upgrade-firmware-of-a-u-blox-gnss-receiver/all). |
0 commit comments