> 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-rtu/upgrade-xl4-to-xl4-plus.md).

# Upgrade an XL4 to an XL4 Plus

Upgrade an XL4 RTU from Q04 to Q04 Plus firmware so it works as an XL4 Plus.

Upgrading an XL4 RTU to an XL4 Plus RTU involves upgrading the Q04 processor firmware to Q04 Plus. Firmware upgrades are performed using QTech Workbench software. The upgrade process preserves critical settings such as calibration data of analogue I/O and the electronic serial number (ESN) of the RTU. However, **all RTU logged data is lost** so please download that before starting.

{% hint style="info" %}
**Applies to:** DATRAN XL4 RTUs running Q04 firmware (V6.xx). Q04 Plus uses a new configuration file paradigm which is only compatible with Workbench version 2.0 or later. Once the XL4 RTU has been updated to Q04 Plus, subsequent firmware updates are via a USB drive.
{% endhint %}

Also see [Port an XL4 site to the XL4 Plus in DATRAN VI](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/upgrade-xl4-to-xl4-plus/port-xl4-site.md) for the DATRAN, DLP and Modbus changes.

### Before you start

* **Order the upgrade licence.** To upgrade a DATRAN XL4 RTU to an XL4 Plus, please contact the QTech sales team at <sales@qtech.co.nz> to order the upgrade licence key. The serial number of the RTU to be upgraded is required.
* **Collect the logged data.** All RTU logged data is lost so please download that before starting.
* It is assumed that readers are familiar with the operation and installation of the XL4 and Workbench software. If you are new to the XL4 product range please read the user manual first.

### What you need

* QTech Workbench Software. Workbench is downloaded from the [QTech website](https://qtech.co.nz/product/workbench/). Workbench uses .NET framework V4. If you do not have .NET framework installed on your PC, this should be configured using the Windows Settings > Apps & Features > Programmes and Features. Turn on V3.5 and V4.8.
* USB Cable (type A-B)
* DC Power supply and cable
* Q04 Plus Bootloader firmware (.hex) file located in a folder on your PC
* USB drive (8 GB formatted as FAT32) containing both the Q04 Plus Application firmware (.elf file) and MD5 validation file (.md5). The files must be in the root folder of the USB drive. Avoid using USB drives larger than 8 GB.
* Optional - DIP switch jig for setting digital inputs on and off (not supplied)
* Optional - LAN patch cable if access to a LAN running DHCP services is available

The firmware application, bootloader and message validation files are distributed by QTech. It is important to use the correct bootloader version or some features will not be available or the RTU will neither upgrade nor function correctly. See [Which version do I have?](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/which-version.md) The RTU Bootloader firmware must always be upgraded before upgrading the application firmware.

### Upgrade

1. Power up the XL4 RTU. Open Workbench. Connect Workbench to RTU with USB cable. Click **Connect** to connect to the RTU. If necessary, from the **Device Type** menu select **DATRAN XL4 RTU**.
2. Ensure any RTU Datalogging data has been retrieved, as it will be erased by this process.
3. Check a valid RTU serial number has been read from the RTU and is displayed in Workbench. The 4 ASCII numbers are one of the ways the Bootloader detects that the RTU was previously running the old Q04 firmware.
4. Close Workbench and disconnect USB cable. Remove power from the RTU. Unscrew and remove the RTU case cover. **Insert the two ISP jumpers.**

   ![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)
5. Power up the RTU and run Workbench. From the **Device Type** menu select **DATRAN XL4 RTU**. There is no need to "connect" to the RTU.
6. Click the **Firmware Upgrade** section of Workbench. Click **Browse** and navigate to the Bootloader firmware file on your PC. Select the file. Click **Program** to flash the RTU with the selected file. If successful, Workbench will display a success message and the RTU's ERR LED will flash rapidly to indicate the Bootloader cannot yet find the application to boot.

   ![Firmware Upgrade in Workbench, with Browse and Program](https://3621580088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5hMAUl7E1cWeN5Rghg0%2Fuploads%2FwZ4CZxjwPPIxIJXAkd0a%2Fworkbench-firmware-upgrade.png?alt=media)

   If the process fails at this step, then: remove the ISP jumpers, cycle the power on the RTU, close then reopen Workbench, from the **Device Type** menu select **DATRAN XL4 RTU**, click **Connect**, insert the ISP jumpers and repeat the instructions from the start of step 6.
7. Close Workbench. **Remove the two ISP jumpers.**
8. Optional - memory integrity check. At this point the Bootloader can check the FLASH and SDRAM integrity (see below).
9. Insert the USB drive containing the Application firmware into the USB port on the RTU. Power up the RTU and programming commences. The Status LEDs will flash in a sequence to indicate programming is in progress. The Bootloader can take approx. 10s to reformat the FLASH and there is no LED activity during this time. Be patient and don't repower the RTU during this time. **Important: do not remove power during the programming process.**
10. Visually check LED operation. The CPU OK LED will fade on/off. The MU LED will be on. The ERR LED indicates any additional fault codes. This is normal because for example, at this stage a DLP will not be loaded so this will be the most likely error code being shown. If the ERR LED flashes rapidly this indicates the RTU does not have a valid license. It does not mean the upgrade has failed.
11. Remove the USB Drive. Do not leave the USB drive in or next time the RTU reboots it will attempt to re-flash the firmware.
12. Record the name of the XL4. This is in the form "Q04-1234" or "XL4-1234". Usually printed on a sticker on the processor board. Replace the XL4 case cover and screw together.
13. Connect the USB cable to the RTU. Power up the RTU. Open Workbench. By default, Workbench selects **DATRAN XL4 Plus RTU** device type to configure. If it does not, from the **Device Type** menu select **DATRAN XL4 Plus RTU**. Click **Connect**. Select the **Overview** category. Verify the serial number of the RTU is displayed. If it isn't, contact QTech.
14. If the RTU requires a new license to enable features contact QTech to be issued a licence. Click the **Licensing** category and **Read from Device**. Enter the new licence code supplied by QTech. Click **Write to Device** to update the RTU. Rebooting the RTU will stop the ERR LED flashing. See [Licensing and features](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/licensing-and-features.md).
15. The XL4 RTU upgrade to Q04 Plus is now complete. The RTU will now perform as an XL4 Plus RTU and is now ready for the usual configuration: see [Configure](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/configure.md).

If there was a fault the CPU LED will be off, and the ERR LED indicates an error code. 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).

### Optional: memory checks

At step 8 you can use the Bootloader to check the FLASH and SDRAM integrity. The tests are triggered by inserting the INIT jumper and then turning on a digital input. Grounding the input (assert low) selects the test. A switch jig is not required if you simply wire a RDI to the ground pin (**G**) on the RTU.

| Input | Test or action        | Lights on success |
| ----- | --------------------- | ----------------- |
| RDI1  | Test SDRAM            | RDO1              |
| RDI2  | Test FLASH            | RDO2              |
| RDI3  | Test USB Memory Stick |                   |
| RDI4  | Test NAND Flash       | RDO4              |
| RDI6  | Erase NAND FLASH      |                   |
| RDI7  | Erase NOR FLASH       |                   |
| RDI8  | Erase NVRAM           |                   |

![A switch jig on the digital input connector](https://3621580088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5hMAUl7E1cWeN5Rghg0%2Fuploads%2FHmFol3ySlwXM9YymHge4%2Fxl4plus-switch-jig.jpg?alt=media)

1. Insert the INIT jumper (factory default jumper).
2. Set the desired switch for the test.
3. Repower the RTU to initiate tests. When tests are executing the RTU status LEDs will flash in sequence to show the test is in progress. Activating a test will illuminate the corresponding digital input LED on the RTU. When tests are complete the ERR LED will flash. If the test/action "Passed" then the corresponding digital output LED will be lit after the test/action.
4. Execute the SDRAM and FLASH tests.
5. Do not erase the FLASH at this point as it will be reformatted anyway. **Do not erase the NVRAM.** This makes the RTU lose its serial number and calibration factors. This is not advised unless those values are found to be corrupted.
6. Turn off all digital inputs and remove switch jig.
7. **Remove the INIT jumper.** This optional step is now complete, return to step 9.

{% hint style="danger" %}
Always remove the INIT jumper after performing self-tests otherwise self-test functions may be inadvertently conducted when the digital input harness is reconnected and the device repowered.
{% endhint %}

### Archive log

If you upgrade an XL4 to XL4 Plus the memory chip (128 MB NAND Flash) will not be present on the board and the Archive log feature will be unavailable. Contact QTech if you need this feature.
