SmartDisk II: Firmware update

Two programs are on the flash of your board: a bootloader (version 0.21) and the firmware (the latest release). You update the firmware over USB: you drag a .UF2 file onto a drive that the bootloader shows on your computer. You install the bootloader itself only once, with an ST-Link programmer. The configuration is on the SD card, not on the board, so a firmware update does not touch it (The SD card).

Warning. Never connect the ST-Link programmer at the same time as USB or the Apple II. Its voltage regulator is fragile. The silkscreen of the board says “ONLY 1 PWR SRC” (Hardware and installation, Power).

Which file for which board

BoardFirmware file
SmartDisk II (revisions 8 and 9: 0.96 inch OLED, four keys)the standard firmware
SmartDisk II XL (revision 10: 1.54 inch OLED, rotary encoder)the XL firmware

The two files are not interchangeable. Check that you pick the one for your board. The XL board uses the same bootloader and the same update procedure as the standard board.

Which method

MethodWhat you needWhen
UF2 over USBthe bootloader already on the board; a USB cable and a computerevery normal update
ST-Link (bootloader)an ST-Link programmer and a header soldered on J6a board without bootloader (a board you built), or to change the bootloader

There is no update from the SD card and none from the Apple II.

Where the files are

Download the firmware from the SmartDisk Firmware page: the releases are there as .UF2 files. The bootloader files are there too (bootloader_smartdisk_v0.21: .hex, .bin and .elf).

Before you start

  1. Note the version you have. See “Check the version” below.
  2. Copy the SD card, or at least sdiskConfig.json (favorites, settings, last image, the four SmartPort volumes) to your computer. The file is at the root of the card.
  3. Get the .UF2 file of the version you want for your board, and keep the one you have now, to go back.
  4. Check the bootloader. The firmware needs bootloader v0.21. Do not use v0.15: it causes problems with the SmartPort of the IIgs. v0.21 is the latest. To see which bootloader you have, enter DFU mode (below): its version is on the OLED.
  5. Power. Update with the board out of the Apple II or the Macintosh. Remove the jumpers on J1 and J7, so that USB is the only power source (Hardware and installation, Power).

The update over USB (UF2 drag and drop)

  1. Connect the board to your computer with a USB cable (the USB connector of the BlackPill module).
  2. Press the NRST (reset) button of the BlackPill twice, quickly: the second press must come within half a second of the first. At every reset the bootloader waits half a second before it starts the firmware. A second reset during that wait puts it in DFU mode. A single reset starts the firmware as usual. If your board is in its case, the case has a reset key for this.
  3. The board shows as a USB drive named DISKIIBOOT. It holds INFO_UF2.TXT, INDEX.HTM and CURRENT.UF2. The OLED shows SMARTDISK II BOOTLDR, DFU MODE and the version of the bootloader (the display is optional: the drive appears even when the OLED stays blank).
  4. Copy the .UF2 file onto that drive. The bootloader writes the firmware into the flash as the blocks arrive. It accepts only UF2 files made for the STM32F4. It ignores any other file, a .bin for example.
  5. When the copy is complete, wait. The bootloader checks that your computer has finished writing, restarts the board by itself and starts the new firmware after its half second wait. The drive disappears and the splash shows on the OLED.
  6. Unplug the USB cable. Check the version (below).

What the update does not touch

  • The bootloader. The bootloader write-protects its own flash sectors, and it ignores every UF2 block that is addressed outside the firmware area (0x08010000 to 0x0807FFFF). A UF2 file cannot overwrite it.
  • The SD card and everything on it. The firmware never writes the configuration into the flash.

You need this only for a board that has no bootloader (for example a board you built), or to change the bootloader. No other power source may be connected to the board.

What you need: an ST-Link V2, 4 wires, the J6 header soldered on the board (the assembly house does not fit it), and the bootloader file bootloader_smartdisk_v0.21.hex (or .bin).

Wiring:

Board J6 pinSilkscreenST-Link
13V3.3V
2SDIOSWDIO
3SCKSWCLK
4GNDGND

The reset line of the board is not on J6. The board takes its 3.3 V from the ST-Link: J1 and J7 stay open.

  1. Wire the ST-Link to J6 as in the table. Connect nothing else: no USB, no Apple II.
  2. Run OpenOCD with the .hex file:
openocd -f interface/stlink.cfg -f target/stm32f4x.cfg \
  -c "init" -c "reset init" -c "flash protect 0 0 last off" \
  -c "program bootloader_smartdisk_v0.21.hex verify reset exit"

The command removes the write protection of the first two flash sectors, writes the bootloader and verifies it. The bootloader sets the protection again the first time it starts. With another tool, write the .bin at address 0x08000000.

  1. Remove the ST-Link and the wires.
  2. Connect USB only and do the UF2 update above to put the firmware on the board.

On a chip with no valid firmware, the bootloader goes straight to DFU mode, ready for the .UF2 file.

Check the version

  • The splash at power up shows the version at the bottom right, for about half a second (the release number followed by two digits).
  • The footer of the image menu and of the directory options shows the version too.
  • The log: with Settings > Log to SD on, each start writes ---- SmartDisk II vX.YY.NN, run started ---- into SMARTDISK.LOG at the root of the card. The same log comes out on the UART header J4, 460800 baud.
  • The first part, vX.YY., is the release. The two digits after it are a build number. A release file is named with its own number.
the splash with the logo and the version at the bottom right
the splash with the logo and the version at the bottom right

After the update

  1. Power the board and watch the splash: the version is the one you installed.
  2. The main menu appears. Your settings, favorites, last image and SmartPort volumes are read from sdiskConfig.json on the card. Check them (Favorites, File manager, Settings).
  3. A setting that your old configuration does not have takes its default: 5.25 write on, Autoboot last img on, the other new options off. The Settings list shows only the options of the emulation that runs (Settings reference, Firmware release notes).
  4. Mount an image and boot a machine, as in Usage guide. On a IIgs, test the emulation you use: SmartPort is the most sensitive to timing.

What an update does to the configuration

CaseResult
Update from an older release, normal fileread as it is. The absent keys take their defaults. The file is rewritten at the next save with the new keys
An old file that was cut at 1024 bytesEvery firmware up to v0.80.45 wrote at most 1024 bytes of the file. A longer text was cut, and a cut file is not valid. The firmware uses the defaults and leaves the file as it is until your first save, which replaces it. Favorites beyond the cut are already lost
Going back to v0.80.xv0.80.45 reads at most 2048 bytes of the file. A longer file written by the firmware is cut there, and the old firmware then replaces it with the defaults. Put your backup copy of sdiskConfig.json back after the downgrade
Clear prefs (Settings, ENTER, ENTER)deletes sdiskConfig.json and restarts: defaults for everything, empty favorites and volumes. Your images are not touched
A configuration that stops the boardan emulation type that does not exist is replaced by Disk II at start. Delete the file on a computer if needed

If the update fails

SymptomWhat to try
No DISKIIBOOT drive after the double pressPress NRST twice again, a little faster. Try another USB cable (one with data lines) and another USB port
The copy was interrupted and the board does not startPress NRST twice to enter DFU mode and copy the .UF2 file again. A board with no valid firmware stays in DFU mode
The board starts, then the screen stays blackThe display recovers by itself: the board tries it again every 5 seconds. See Troubleshooting, FAQ and the log
The board no longer enters DFU modeInstall the bootloader again with an ST-Link, as above
The Apple II no longer boots a disk after the updateSee Compatibility. Go back to the previous release

Going back to an older release

  1. Take the .UF2 file of the older release.
  2. Do the update above with that file: press NRST twice and drag the older file onto the drive. No change of bootloader is needed.
  3. Restore the copy of sdiskConfig.json that you made before, see the table above.
  4. Check the bootloader: v0.21. A board with the v0.15 bootloader has problems with the IIgs SmartPort whatever firmware runs.
  5. Remember what an older firmware does not have: the Macintosh and 3.5 inch drive emulation, Create disk, the settings that follow the emulation, Log to SD. It ignores their keys in sdiskConfig.json.

The bootloader

  • At each reset a double press enters DFU mode, a single one starts the firmware, and a board with no valid firmware stays in DFU mode.
  • The firmware has no key combination and no menu entry to enter DFU mode: you always use the NRST button.
  • You update the bootloader only with an ST-Link, as above.

Building the firmware yourself

This part is for people who build the firmware. If you only install releases, skip it.

The images to use are built with CMake presets:

PresetBoard
bootloaderstandard board
bootloader-xlXL board
cd firmware
cmake --preset bootloader-xl                         # or: cmake --preset bootloader
cmake --build --preset bootloader-xl -j 8
cmake --build --preset bootloader-xl --target uf2

The result is in the folder build-cmake/<preset>/, with the .UF2 file for the bootloader. The UF2 file is made from the hex file with the family id 0x57755A57. The target flash writes the image with an ST-Link instead.

In this layout the vector table of the firmware is at 0x08010000 and the code starts at 0x08018000, above the bootloader.

The presets standard and standard-xl build a different layout, without bootloader: the image is linked at 0x08000000 for the whole flash. Written with an ST-Link, it replaces the bootloader. Do not use it on a board that has the bootloader.

Related: Hardware and installation for the board and the J6 header.


← Previous

The SD card

Next →

Usage guide

SmartDisk II user documentation · latest firmware · Documentation home

Scroll to Top