Skip to content

Firmware Programming

Keir Fraser edited this page Feb 13, 2021 · 34 revisions

The first installation of this firmware onto Gotek can be done either by serial or USB link to a host PC.

Method 1: Serial Programming

A nice video summary of this method using programming software on Windows is available on Youtube courtesy of Kris Cochrane. It also includes the OLED Display and Piezo Sounder mods:

FlashFloppy custom firmware install

Serial programming requires a USB-TTL adapter, readily available on Ebay or from project webstores:

USB-TTL Adapter

The Gotek is then jumpered in system-bootloader mode and programmed from the host PC. See the below picture for wiring and jumper selection.

Important Notes:

  • Your Gotek may have a different number of header pins/holes, but any missing or extra pins are not used in the programming process.
  • This Gotek has pins soldered to the programming header. It is possible to make the connections with no soldering, but take care that all wires are sufficiently well connected.
  • The ordering of the connections (5V,GND,TX,RX) can vary across USB-TTL serial adapters, so be careful to note the ordering on your own.

Programming header

The programming process is described, along with suitable Windows software, on the Cortex firmware webpage. Of course, rather than using the Cortex HEX file, use the *.hex file contained in the FlashFloppy distribution.

If programming on Linux, you can follow the Cortex instructions to physically set up your serial connection and bootstrap the Gotek, and then use stm32flash to do the programming (for v0.10 in this example):

 # sudo stm32flash -k /dev/ttyUSB0
 # sudo stm32flash -vw FF_Gotek-v0.10.hex /dev/ttyUSB0

Troubleshooting

  • On Windows, ensure the driver has correctly detected the USB-TTL adapter. In particular, PL2303 clones have trouble with the official Prolific driver.
  • Ensure you have TX and RX wires the correct way round.
  • Sometimes the STM32 bootloader gets confused or negotiates the wrong baud rate. Try resetting the Gotek by touching NRST to GND, or by removing and reapplying power.
  • Some serial adapters require pull-up resistors on the TX and RX wires. See AN2606 ("STM32 microcontroller system memory boot mode"), Section 3.3, Figure 1. A suitable resistor value (R) is 10K; these can safely be connected to VCC/+V of 3.3V or 5V.

Programming pullups

Method 2: USB Programming

This method requires a USB-A to USB-A cable, a pair of jumper wires to configure the programming header of the Gotek, and the *.dfu programming file contained in the FlashFloppy distribution.

USB Programming Setup

To configure the programming header of the Gotek, temporarily place jumper wires across the following pin pairs: Boot-3V and Tx-5V.

Because these jumper wires are temporary and only used for this initial programming, you can simply use short lengths of hookup wire. In doing so, ensure the exposed ends of your wires are not touching each other.

Windows

For more details watch the following Youtube video. Note: The *.dfu file is now included in the FlashFloppy distribution; there is no need to create it from the *.hex file and those steps can be skipped.

Flash Gotek without Serial Adapter

Linux / Mac

Firstly, set the programming jumpers as described above, and detailed in the Windows tutorial video. Ignore the rest of the video, which is Windows-specific.

Connect the Gotek to your host using a USB-A to USB-A cable.

Programming requires the dfu-util command-line tool which can be downloaded via your package manager (Linux), or Homebrew (on macOS). Programming is then as simple as (for v3.23 in this example):

sudo dfu-util -a 0 -s :unprotect:force -D FF_Gotek-v3.23.dfu
sudo dfu-util -a 0 -D FF_Gotek-v3.23.dfu

The first line is only needed if the Gotek Flash is read-protected (this is the case for factory-fresh Goteks). Since the unprotect command resets the Gotek, you may need to wait some seconds before issuing the second command, while the DFU device is re-enumerated.

There are reports of some issues connecting as a DFU device to macOS. In some cases this can be solved by connecting via an external USB hub.