Flashing MinnowBoard MAX With the SPI Hook in Linux

Exact Steps for flashing new firmware to the MinnowBoard Max (A2) using a SPI Hook from Tincan Tools.

6 minute read

If you are doing development on the MinnowBoard MAX board having the ability to read from, write to, and erase the onboard SPI Flash memory is very useful. The SPI Hook tool from TinCanTools provides exactly this functionality. Priced at only $29USD the SPI Hook provides an affordable alternative to much more expensive tools such as the Dediprog SF100 SPI Flash Programmer that retails for $230USD. The SPI Hook is not as fast as more expensive tools but for most development needs it’s fast enough. The SPI Hook also provides a virtual Serial Port for communicating with the MinnowBoard MAX. One of the most common reasons for flashing the MinnowBoard’s SPI Flash memory is to update the board’s Firmware. At the time of this article the most recent firmware version is Release 0.83. All firmware versions can be found on Intel’s MinnowBoard MAX Firmware page.

Connect SPI Hook to MinnowBoard MAX

Before we can do anything the SPI Hook needs to be connected to the MinnowBoard MAX. TinCanTools has included everything needed to connect the board as well as excellent instructions.

Install Flashrom Utility

Before we can talk to the MinnowBoard MAX through the SPI Hook we need a utility installed called flashrom. This utility is used to identify, read, write, verify and erase flash chips. Most Linux distributions provide flashrom as a package that can be installed using the distribution package manager such as $sudo apt-get install flashrom on a Debian/Ubuntu machine, or $sudo dnf install flashrom on a Fedora (F23) system. However, make sure the version of flashrom is at least v.0.9.8. At the time of this post, I had to compile flashrom 0.9.8 from source.

With the flashrom utility installed, test that the connection to the MinnowBoard MAX is functioning. When reading/writing to/from the MinnowBoard MAX, the board should be POWERED OFF. Simply unplug it to make sure it’s powered off. In a terminal window on your host enter the following command to read the current image from the MinnowBoard MAX and write it to a file called test.bin.

sudo ./flashrom -p ft2232_spi:type=2232h,port=A,divisor=4 -r test.bin

If successful, you’ll see the following:

wmat@conan:/media/wmat/Backups/dev/spihook$ sudo flashrom -p ft2232_spi:type=2232h,port=A,divisor=4 -r test.bin
flashrom v0.9.7-r1852 on Linux 4.2.0-18-generic (x86_64)
flashrom is free software, get the source code at http://www.flashrom.org

Calibrating delay loop… OK. Found Micron/Numonyx/ST flash chip “N25Q064..1E” (8192 kB, SPI) on ft2232_spi. Reading flash… done.’

Let’s verify the image in flashrom on the board against the newly created test.bin:

sudo flashrom -p ft2232_spi:type=2232h,port=A,divisor=4 -v test.bin

If successful, you’ll see something like the following:

wmat@conan:/media/wmat/Backups/dev/spihook$ sudo flashrom -p ft2232_spi:type=2232h,port=A,divisor=4 -v test.bin
flashrom v0.9.7-r1852 on Linux 4.2.0-18-generic (x86_64)
flashrom is free software, get the source code at http://www.flashrom.org

Calibrating delay loop… OK. Found Micron/Numonyx/ST flash chip “N25Q064..1E” (8192 kB, SPI) on ft2232_spi. Reading old flash chip contents… done. Verifying flash… VERIFIED.

Now let’s write the image we’ve created as test.bin back to the MinnowBoard MAX:

sudo flashrom -p ft2232_spi:type=2232h,port=A,divisor=4 -w test.bin

wmat@conan:/media/wmat/Backups/dev/spihook$ sudo flashrom -p ft2232_spi:type=2232h,port=A,divisor=4 -w test.bin
flashrom v0.9.7-r1852 on Linux 4.2.0-18-generic (x86_64)
flashrom is free software, get the source code at http://www.flashrom.org

Calibrating delay loop... OK.
Found Micron/Numonyx/ST flash chip "N25Q064..1E" (8192 kB, SPI) on ft2232_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... 
Warning: Chip content is identical to the requested image.
Erase/write done.

Given that the image we created and the image on the board currently were identical, flashrom will warn you.

With that done, we can now be confident that the SPI Hook can write directly to the MinnowBoard MAX SPI Flash memory.

Setup Virtual Serial Port

With the hardware connected plug the USB cable connected to the SPI Hook into an open USB port on your host Linux computer. You’ll note that the SPI Hook Power LED will illuminate indicating that the board is powered on. Open a terminal on the host and check dmesg to see that the board was detected by the kernel. Note that the SPI Hook enumerates as 2 UARTs attached to ttyUSB0 and ttyUSB1 respectively.

UART Detected

In a terminal on the host open a screen session on ttyUSB1:

$sudo screen /dev/ttyUSB1 115200

Boot the MinnowBoard MAX all the way to the UEFI Shell prompt. The terminal window with the screen session is now displaying the board’s output via the virtual Serial Port provided by the SPI Hook. It should look like this:

UEFI Shell

At the Shell prompt type exit and hit enter to return to the boot manager screen where the firmware version is displayed.

Identify Current Firmware Version

Back at the boot manager screen the current firmware version will be displayed as the third line down right after the CPU specs line. In the image below the firmware version is: MNW2MAX1.X64.0082.R02.1507271125

Firmware Version

The most important portion of the firmware version string is the third section from the left “0082” that indicates revision 82.

Upgrade Firmware

Given that the current MinnowBoard MAX firmware available from Intel is Release 0.83 as listed on Intel’s MinnowBoard MAX Firmware page and we are running revision 82, we can download the binary image and write it to the board.

Intel lists two versions of the binary, a Debug image and a Release image. For normal board usage download the Release version of the firmware. In my case, I am running a MinnowBoard MAX (A2) that has a 64-bit E3800 processor therefore I need the 64-bit Release image.

The image is a zip file, so it will have to be unzipped before use. On my machine, I enter:

$ unzip MinnowBoard.MAX_.X64.083.R01.zip

This results in a directory called MinnowBoard.MAX.X64.083.R01 containing the following 3 files:

MinnowBoard.MAX.0.83.BIN-ReleaseNotes.txt
MinnowBoard.MAX.X64.083.R01.bin
MinnowBoard.MAX.FirmwareUpdateX64.efi

The file to flash to the MinnowBoard MAX is MinnowBoard.MAX.X64.083.R01.bin. At this point please take a few minutes and read the Files List section of the ReleaseNotes.txt file for a description of each file.

At this point, all that’s left to do is flash the bin file to the MinnowBoard MAX using the following command:

sudo flashrom -p ft2232_spi:type=2232h,port=A,divisor=4 -w MinnowBoard.MAX.X64.083.R01.bin

If successful, you will see the following:

wmat@conan:/media/wmat/Backups/dev/spihook/MinnowBoard.MAX.X64.083.R01$ sudo flashrom -p ft2232_spi:type=2232h,port=A,divisor=4 -w MinnowBoard.MAX.X64.083.R01.bin
flashrom v0.9.7-r1852 on Linux 4.2.0-18-generic (x86_64)
flashrom is free software, get the source code at http://www.flashrom.org

Calibrating delay loop... OK.
Found Micron/Numonyx/ST flash chip "N25Q064..1E" (8192 kB, SPI) on ft2232_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.

Verify New Firmware Version

With the success of the new firmware being written to the board, let’s verify that the firmware version displays the new version. Boot the MinnowBoard MAX as normal with no peripherals attached and at the UEFI shell, type exit.

The Firmware version should be displayed as follows:

Firmware Upgraded

If you have any questions feel free to post below.

comments powered by Disqus