===== Firmware ===== Firmware (the software running on the IO boards) is a big part of our hardware (except Unipi 1.1) and gets updated during the time as things are getting fixed or new functionality is being added. The Firmware is a standard part of our OS images and is also distributed in our repository in the //unipi-firmware6// package. Package update does not flash the firmware onto the IO boards, this requires a manual intervention. ==== Connecting via SSH ==== The first necessary step is to connect to the unit via SSH. How to connect via SSH is explained in [[en:automation:unipi-ssh-connect-hidden]]. How to find or set the password for SSH is also described in the article about [[.:02-passwords]]. ==== Obtaining the update package ==== To update the firmware, you need to obtain the update package. We strongly recommend online update, as offline update might need expert Debian knowledge. === Online firmware installation === * 1. Obtain the latest firmware version sudo apt update && sudo apt upgrade * 2. It's very important to **REBOOT**, so the updated kernel modules are used sudo reboot === Offline firmware installation === {{ :files:img_warning-line_b.png?nolink |}} {{ :en:hw:09_safety-instructions_pseudo-ISO-7010-attention.png?nolink |(!)}} **Attention:** \\ This option is for experts only, as it might require to bring newer versions of other packages, we highly recommend using the online installation method. * 1. Download the latest version of the **unipi-firmware6** package from [[https://repo.unipi.technology/debian/pool/]]. Then it is needed to get it to the unit. There are two ways to do that: * 2.a - Using SCP * Copy if from your PC to the unit using SCP (a WinSCP, Filezilla or other software can be used) to the /tmp/ folder * Install the package using dpkg, for example dpkg -i /tmp/unipi-firmware_5.50_all.deb * 2.b - Via USB flash * Copy the downloaded file from your PC to the root of the FAT32 formated USB flash and insert the USB flash to any USB port of the unit. * Switch to root user sudo su * Find out the name of the inserted flash disk (usually it is //sda1//) fdisk -l * Create a mount folder for the disk mkdir /media/usbflash * Mount the disk to the newly created folder mount /dev/sda /media/usbflash * Install the package using dpkg, for example dpkg -i /media/usbflash/unipi-firmware_5.50_all.deb ==== Updating the firmware ==== There are two tools for managing firmware of Unipi products: * //fwspi// - used for internal IO boards of Unipi PLCs. * //fwserial// - used for Unipi Extensions. The tools are located in /opt/unipi/tools/ directory and have to be run as root. This is an example that will get the current firmware version of board on section 1. sudo /opt/unipi/tools/fwspi -u 1 Note, the parameter //-u// specifies the board Modbus address - board section. === Internal IO boards === The internal IO boards are fixed, so only information needed is the section number. * 1. Check the current FW version installed in each IO board sudo /opt/unipi/tools/fwspi -u 1 * 2 If the firmware is 5.x or older, you need to [[#upgrading_the_firmware|upgrade it first]], see the section below. * 3. Update to the downloaded FW version sudo /opt/unipi/tools/fwspi -av * 4. The output shows the old version and the newly installed version. === RS-485 Extensions === xS/xG series extensions can be upgraded similarly. Apart from Modbus address, you also need to specify the port and other RS-485 parameters, if they do not use the default setting. {{ :files:img_warning-line_b.png?nolink |}} {{ :en:hw:01_safety-instructions_ISO-7010-W001.png?nolink |/!\}} **Attention:** \\ Make sure that there is no other application using/communicating on the used port and do not disconnect power to the unit or Extension. Any of this will lead to bricking the extension. {{ :files:img_warning-line_b.png?nolink |}} {{ :en:hw:08_safety-instructions_pseudo-ISO-7010-info.png?nolink |(!)}} **Note:** \\ The -p (port) parameter must be set according to the used serial for the extension - see the serial port mapping for [[en:hw:004-edge:06-peripherals:01-rs485#port_mapping|Unipi Edge]], [[en:hw:007-patron:portmap|Unipi Patron]], [[en:hw:02-neuron:portmap|Unipi Neuron]] or [[en:hw:01-axon:portmap|Unipi Axon]] to find proper serial port within your unit. For example, if extension is connected to //RS485-1/RS485-1.1//: sudo /opt/unipi/tools/fwserial -p /run/unipi-plc/by-sys/rs485-1/tty -P Note that the fwserial assumes that extension's Modbus address, baud rate and parity are in the factory-default state, ie **19200 baud 8N1 with address 15**, if you have a different configuration, you need to specify as parameters: %% -b, --baud baudrate, default 19200%%\\ %% -o, --stopbits stop bits (1|2), default 1%%\\ %% -r*, --parity parity (N|E|O), default N%% * -r is currently available only on systems running Debian 13 When the extension is on port **/run/unipi-plc/by-sys/rs485-1/tty**, Modbus address **6**, baudrate **9600** and parity **even**: * 1. Check the current FW version installed in the extension sudo /opt/unipi/tools/fwserial -p /run/unipi-plc/by-sys/rs485-1/tty -u 6 -b 9600 --parity E * 2 If the firmware is 5.x or older, you need to [[#upgrading_the_firmware|upgrade it first]], see the section below. * 3. Update to the downloaded FW version sudo /opt/unipi/tools/fwserial -p /run/unipi-plc/by-sys/rs485-1/tty -u 6 -b 9600 --parity E -Pv * 4. The output shows the old version and the newly installed version. ==== Upgrading the firmware ==== Direct update from older firmwares (5.x and below) is not possible, an upgrade needs to be performed. The only change is that parameter //-U// (or parameter //-a// and doing the command for each board separately) is used instead of //-P//, see the examples for both commands: sudo /opt/unipi/tools/fwspi -u 1 -Uv sudo /opt/unipi/tools/fwserial -p /run/unipi-plc/by-sys/rs485-1/tty -u 15 -Uv ==== Other useful parameters ==== === Resetting the configuration === When updating the firmware, you can also reset the configuration (AO type, MWD, default states) to the default state with the //-R// parameter. For example: sudo /opt/unipi/tools/fwspi -u 1 -PRv