Difference between revisions of "Firmware Update"

From Medusa
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
# Check your hardware revision (see [[Description#Hardware_Revisions]]). Beware that firmwares 1.0.18 and older are only compatible with REV A. If you install older firmware on REV B then you may experience some strange behaviour but you won't brick the device and reinstalling correct firmware will be possible and will fix those issues.
# Check your hardware revision (see [[Description#Hardware_Revisions]]). Beware that firmwares 1.0.18 and older are only compatible with REV A. If you install older firmware on REV B then you may experience some strange behaviour but you won't brick the device and reinstalling correct firmware will be possible and will fix those issues.
# Download firmware from [//medusa-sc.org/firmware/ Medusa Firmwares Page]. Firmware updater is a binary application that will update the firmware automatically. Binaries are available for Linux (64bit binary for Intel), Max OS X (Intel and ARM binaries) and Windows (32bit and 64bit binaries for Intel).
# Download firmware from [//medusa-sc.org/firmware/ Medusa Firmwares Page]. Firmware updater is a binary application that will update the firmware automatically. Binaries are available for Linux (64bit binary for Intel), Max OS X (Intel and ARM binaries) and Windows (32bit and 64bit binaries for Intel).
# Make sure that Medusa has been correctly detected by your operating system. Medusa uses standard "virtual serial port" (CDC) protocol on USB, so usually it should work without any drivers on Linux, Macos and Windows 10+. In case of Window 8.1 and older you need this file: [//medusa-sc.org/firmware/medusa.inf medusa.inf] (unsigned file specifically designed for Mesusa) or this file: [//medusa-sc.org/firmware/stmcdc.zip stmcdc.zip] (signed driver for all CDC devices with stm32 chips). See below how to use those files.
# Make sure that Medusa has been correctly detected by your operating system. Medusa uses standard "virtual serial port" (CDC) protocol on USB, so usually it should work without any drivers on Linux, Macos and Windows 10+. In case of Window 8.1 and older you need this file: [//medusa-sc.org/firmware/medusa.inf medusa.inf] (unsigned file specifically designed for Mesusa) or this file: [//medusa-sc.org/firmware/stmcdc.zip stmcdc.zip] (signed driver for all CDC devices with stm32 chips). See below how to use those files. In case of Linux make sure that your user has permissions to write to serial port (see below).
# Run the application. On the console you should see something like this (typically it takes less than 10 seconds):
# Run the application. On the console you should see something like this (typically it takes less than 10 seconds):
<pre>
<pre>
Line 47: Line 47:


In both cases you should see a new COM port in your system. In case of using medusa.inf you will see "Medusa CDC serial port" and in case of using stmcdc.zip you will see "STMicroelectronics Virtual COM Port" - it doesn't matter. In both cases the medusa firmware update software should work without any problems.
In both cases you should see a new COM port in your system. In case of using medusa.inf you will see "Medusa CDC serial port" and in case of using stmcdc.zip you will see "STMicroelectronics Virtual COM Port" - it doesn't matter. In both cases the medusa firmware update software should work without any problems.
== Linux udev ==
Usually in Linux default permission to /dev/ttyACMn (device file used to communicate with Medusa) is <code>rw-rw---- root uucp</code>. In such case only root and users belong to uucp group have write access to this file. The first solution is to add your user to 'uucp' group. The second is to add specific 'udev' rule for Medusa that will make sure that all users will have rights to Medusa's port. To do that usually you should create file in '/etc/udev/rules.d/' named '##-medusa.rules' (for example '77-medusa.rules') with following content:
<pre>
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0666", SYMLINK+="ttyMedusa"
</pre>
After that you need to reload rules. Typically run the command: <code>sudo udevadm control --reload</code> and then <code>sudo udevadm trigger</code>.


== To brick or not to brick ==
== To brick or not to brick ==

Latest revision as of 13:10, 14 December 2023

Firmware Update

  1. Check your hardware revision (see Description#Hardware_Revisions). Beware that firmwares 1.0.18 and older are only compatible with REV A. If you install older firmware on REV B then you may experience some strange behaviour but you won't brick the device and reinstalling correct firmware will be possible and will fix those issues.
  2. Download firmware from Medusa Firmwares Page. Firmware updater is a binary application that will update the firmware automatically. Binaries are available for Linux (64bit binary for Intel), Max OS X (Intel and ARM binaries) and Windows (32bit and 64bit binaries for Intel).
  3. Make sure that Medusa has been correctly detected by your operating system. Medusa uses standard "virtual serial port" (CDC) protocol on USB, so usually it should work without any drivers on Linux, Macos and Windows 10+. In case of Window 8.1 and older you need this file: medusa.inf (unsigned file specifically designed for Mesusa) or this file: stmcdc.zip (signed driver for all CDC devices with stm32 chips). See below how to use those files. In case of Linux make sure that your user has permissions to write to serial port (see below).
  4. Run the application. On the console you should see something like this (typically it takes less than 10 seconds):
$ ./firmware_updater_macosx_arm
firmware leng: 170328B
Found port: /dev/cu.usbmodemF2ECEB871
port: /dev/cu.usbmodemF2ECEB871 - main app
Sending fwupdater data
......................................
Sending fwupdater hmac
Found port: /dev/cu.usbmodemF2ECEB871
port: /dev/cu.usbmodemF2ECEB871 - updater
Sending main code data
...................................................................................................................................
Sending main code hmac
Sending fpga core data
........................................................................................................................................................................
Sending fpga core hmac

Using medusa.inf or stmcdc.zip

In case of Windows 10 and newer nothing needs to be done and any CDC device is automatically recognized, but in case of older Windows systems the user has to manually assign a driver (usbser.sys in this case) to a specific device (Medusa in this case). By default Medusa is shown in "device manager" as an "unrecognized device". To allow Windows to use usbser.sys you need to:

Option 1 - using unsigned medusa.inf file:

  1. go to "device manager" and find Medusa under "other devices";
  2. right click on it and pick "update driver software..." and then "browse my computer for driver software";
  3. click the "browse" button and select the catalog with the "medusa.inf" file that you downloaded from this page and then click the "next" button;
  4. you will see a red warning that the file you are going to use can be dangerous (because this inf file is not signed) - pick "install this driver software anyway".

Option 2 - using signed, universal stmcdc.zip file:

  1. unzip the "stmcdc.zip" file;
  2. go to "device manager" and find Medusa under "other devices";
  3. right click on it and pick "update driver software..." and then "browse my computer for driver software";
  4. pick the option "let me pick from a list of available drivers on my computer";
  5. if windows asks you to choose a device type - just click "next";
  6. in the next window click on "Have disk...";
  7. click the "browse" button and select 'stmcdc.inf' in the 'stmcdc' folder;
  8. click "ok" and then "next";
  9. Windows will inform you that this driver might not be good for the selected device (because it is a universal driver for all STM32 CDC devices - not specifically for Medusa, but it works perfectly ok) - press the "yes" button.

In both cases you should see a new COM port in your system. In case of using medusa.inf you will see "Medusa CDC serial port" and in case of using stmcdc.zip you will see "STMicroelectronics Virtual COM Port" - it doesn't matter. In both cases the medusa firmware update software should work without any problems.

Linux udev

Usually in Linux default permission to /dev/ttyACMn (device file used to communicate with Medusa) is rw-rw---- root uucp. In such case only root and users belong to uucp group have write access to this file. The first solution is to add your user to 'uucp' group. The second is to add specific 'udev' rule for Medusa that will make sure that all users will have rights to Medusa's port. To do that usually you should create file in '/etc/udev/rules.d/' named '##-medusa.rules' (for example '77-medusa.rules') with following content:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0666", SYMLINK+="ttyMedusa"

After that you need to reload rules. Typically run the command: sudo udevadm control --reload and then sudo udevadm trigger.

To brick or not to brick

Firmware in Medusa is divided into two parts - a simple updater (let's call it part A) and the main program (call it part B).

Part A updates part B (plus FPGA core) and part B updates part A

The boot code in Medusa checks checksums of both parts. If both checksums are correct then it jumps to part B (or part A when the "right" button is pressed). If only one of them is correct then it jumps to this part directly. This design prevents device "bricking". Even if you loose power during Medusa firmware update, after you turn it back on it will just use the valid part of the firmware. You will only need to run the updater again to complete the procedure.