> For the complete documentation index, see [llms.txt](https://help.qtech.co.nz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/update-firmware.md).

# Update the firmware

Update the application firmware from a USB drive, and the bootloader with QTech Workbench.

Firmware upgrades to the RTU application firmware use a USB memory stick (formatted as FAT32) inserted into the socket. Firmware upgrades do not require jumpers to be fitted. Upgrades to bootloader firmware occur rarely. In system programming to upgrade the bootloader firmware of the RTU requires both the ISP jumpers to be fitted on the processor board and the device connected via this port to QTech Workbench running on a PC.

{% hint style="info" %}
**Applies to:** XL4 Plus, and XL4 RTUs already upgraded to Q04 Plus. To upgrade an XL4 from Q04 firmware, see [Upgrade an XL4 to an XL4 Plus](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/upgrade-xl4-to-xl4-plus.md). The firmware is available for download to QTech customers (SMA support login holders).
{% endhint %}

## In this section

* [Upgrade to V7.18](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/update-firmware/upgrade-to-v7-18.md): from V7.17 or older. Needs bootloader V3.04.
* [Upgrade to V7.19](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/update-firmware/upgrade-to-v7-19.md): from V7.18. Adds the archive log.

## Which bootloader do I need?

Here is a table of application firmware versions and the corresponding bootloader version that should be used.

| Application    | Bootloader     |
| -------------- | -------------- |
| V7.19          | V3.04 or V3.05 |
| V7.18          | V3.04          |
| V7.16, V7.17   | V3.03          |
| V7.14, V7.15   | V3.02          |
| V7.13 or older | V3.01          |

Bootloader V3.04 remains valid for use with V7.19. Bootloader V3.05 is factory upgradeable only. All new XL4-Plus RTUs are supplied with Bootloader V3.05 & V7.19. It is acceptable to use V3.04 and upgrade the application to V7.19 in the field. For details, see [Release notes](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/release-notes.md).

## Update the application from a USB drive

You need:

* XL4 Plus RTU
* DC power supply and cable
* USB drive (formatted as FAT 32) containing both the Q04 Plus Application firmware file (.elf) and the MD5 validation file (.md5) at the root level of the USB drive. The .elf and .md5 files are distributed by QTech.

| Step | Do this                                      | Notes                                                                                                                                                            |
| ---- | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1    | Disconnect power from the RTU                | Also disconnect all the I/O and communication devices from the RTU.                                                                                              |
| 2    | Insert the USB drive                         | USB drive must contain the .elf and md5 files at the root level.                                                                                                 |
| 3    | Power up the RTU                             | The RTU will detect the USB drive and automatically load the new firmware. Do not remove power from the RTU during this programming process.                     |
| 4    | Watch the status LEDs                        | The status LEDs will flash in sequence to indicate programming is in progress.                                                                                   |
| 5    | Wait until the OK indicator LED slow flashes | This indicates the firmware update is now complete.                                                                                                              |
| 6    | Remove the USB drive                         | Important. Do not leave the USB drive in the socket after upgrading is complete. Otherwise, the next time the RTU reboots it will reload the new firmware again. |

If the firmware update fails, the red ER status LED will flash twice and the OK LED will not slowly fade on/off. If the problem occurs when using a high-capacity USB drive, try using a smaller USB 2.0 8GB drive or similar, formatted FAT32. Check the correct files are at the root level of the USB drive and repeat the update process. See [The firmware update from a USB drive doesn't work](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/troubleshooting/usb-firmware-update-fails.md).

The update can be confirmed by connecting the Device to QTech Workbench and verifying the Firmware version and Application issue number on the **Overview** page.

{% embed url="<https://www.youtube.com/watch?v=fbC1H5B3EK8>" %}
XL4 Plus RTU firmware upgrade, on the QTech YouTube channel
{% endembed %}

## Update the bootloader

From time to time the bootloader will also need to be updated. This is done via Workbench connected to the RTU via USB and following the steps below. This process is more involved than updating the firmware, so please read instructions carefully.

{% hint style="warning" %}

* When the Bootloader is installed it will destroy the old Datalog Database (V2) and it will overwrite the RTU configuration. But it will retain the calibration settings and the license keys for running the application. For this reason there are two recommended actions before upgrading the unit: retrieve any outstanding logged data from the RTU, and save the RTU configuration to a file (via Workbench) so that it can be reloaded to the RTU after the upgrade is complete.
* It is very important to remove the ISP jumpers during step 8 of this process before reassembling the XL4 Plus RTU.
  {% endhint %}

You need:

* Workbench (for configuring XL4 Plus RTU)
* XL4 Plus RTU
* USB Cable (type A-B)
* DC Power supply and cable
* Q04 Plus Bootloader firmware (.hex) file (locate in a folder on the PC)
* USB drive (formatted as FAT) containing Q04 Plus Application firmware file and MD5 validation file (.elf + .md5)
* (optional) DIP switch jig for setting digital inputs on and off (not supplied)
* (optional) LAN patch cable if access to a local area network running DHCP services is available

| Step | Do this                                                                                                                                                                            | Notes                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 1    | Power up the RTU and connect Workbench via USB. Select **DATRAN XL4 Plus RTU** from the Workbench device type menu.                                                                | Click **connect** to connect to the RTU if necessary.                                                                                                                                                                                                                                                                                                                                                                    |
| 2    | Retrieve any important RTU Datalogging data in the RTU.                                                                                                                            | RTU Datalogging data is erased by this process.                                                                                                                                                                                                                                                                                                                                                                          |
| 3    | Check that Workbench can read a valid serial number from the RTU.                                                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                          |
| 4    | (optional step) Check the analogue calibration factors in Workbench. The Bootloader will read and convert these into values stored in a JSON format configuration file on the RTU. | The values in the config file can be checked later, and if they differ from that noted in Workbench at this stage, the RTU may need recalibrating.                                                                                                                                                                                                                                                                       |
| 5    | Close or disconnect Workbench. Remove power from the RTU. Unscrew and remove the RTU case cover. Insert the two ISP jumpers.                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                          |
| 6    | Power up the RTU and run Workbench                                                                                                                                                 | No need to “connect” – just select device type as XL4 Plus if needed within Workbench.                                                                                                                                                                                                                                                                                                                                   |
| 7    | Go to the **Firmware upgrade** section of Workbench, browse to the bootloader firmware file, select it then press **Program** to flash the RTU with the selected file.             | At this stage if successful Workbench will display a message and the RTU will flash the ER LED to indicate that the bootloader cannot yet find the application to boot. If the process fails at this step then: remove the ISP jumpers, cycle the power on the RTU, close then reopen Workbench, select device type as XL4 Plus if necessary, in Workbench, Press **Connect**. Insert the ISP jumpers, repeat this step. |
| 8    | Close Workbench. **Remove the ISP jumpers.**                                                                                                                                       | It is very important to remove the jumpers before reassembling the XL4 Plus RTU.                                                                                                                                                                                                                                                                                                                                         |
| 9    | Replace the RTU case cover and screw together.                                                                                                                                     |                                                                                                                                                                                                                                                                                                                                                                                                                          |

![Processor board layout: the ISP jumpers are at the lower right](https://3621580088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5hMAUl7E1cWeN5Rghg0%2Fuploads%2FQaPSY808vjBiQnSyprUc%2Fxl4plus-isp-jumpers.png?alt=media)

Then install the application from the USB drive, as above, and reload your configuration.
