Reply to How To Flash the Midifighter with New Firmware

How To Flash the Midifighter with New Firmware
How To Flash the Midifighter with New Firmware
20100220: created by Fatlimey
20100524: added Mac instructions

The Midifighter uses a DFU (Device Firmware Update) style bootloader that allows
the chip, once put into "bootloader mode", to receive new programs and settings
over the USB connection. Any tool that supports the DFU command set can be
used to flash a new program to the Midifighter over USB.

To drop your Midifighter into Bootloader Mode, plug in the USB cable while
holding down the four corner keys:
Code:
   # . . #
   . . . .
   . . . .
   # . . #
Continue to hold the four corner keys until bootloader mode is reached, this will take about 2 seconds, the Midifighter will show a checkerboard pattern to indicate that it is ready to accept DFU commands:
Code:
   * . * .
   . * . *
   * . * .
   . * . *
An alternative method is to solder two microswitches to the spaces
available at the top-left of the PCB. Pressing the Reset button will act
as if the USB cable was removed then connected again, while holding
down both buttons will immediately drop the device into Bootloader
Mode without the need to hold down the 4-corners key pattern. If you
believe you are going to be doing a lot of programming with the Midifighter
I would highly recommend adding these switches, simply for the
convenience factor.

Putting the Midifighter into bootloader mode causes it to disconnect from
USB and reconnect as a different kind of USB device (i.e. not a MIDI class
device), and on some systems this device type requires the installation of a
driver before the reflashing software will recognize the bootloader
device. Setting up this driver is a one-time installation that is only
required of you wish to reflash your Midifighter.

The EEPROMs inside the chip are designed to be programmable for several
thousand cycles, a number of flashes that would take heavy amounts of
development time and testing. It's just worth knowing that there is a limit
and that one day, a long, long time in the future, with enough reflashes the
chip may break.


1. PC using Atmel Flip

Using the program "Flip" from Atmel.

At the end of installation, you *must* select the option to read the README file:

file:///C:/Program%20Files/Atmel/Flip%203.4.1/info/Readme.html
as it contains instructions for installing the USB driver for the DFU
device. This driver allows connection to the DFU bootloader so that a
program can be uploaded. It's a normal driver install involving:

  • Go to the device manager.
  • Find the AT90USB162 device in the "Jungo" section.
  • Right-click and select "Update Driver...".
  • Select "Install from a specific location".
  • Select "Include this location in the search" and specify the driver
    location, which by default would be "C:/Program Files/Atmel/Flip 3.4.1/usb"
  • Select "Finish" to finally install the driver.
  • The device should appear in the "LibUSB-Win32 Devices" section.


Once installed, Flip is simple to use.

1. Select the chip that is to be programmed. Use the "chip" icon,the menu
item "Device/Select..." or press Ctrl-S. Select the option:

AT90USB162
This will tell the program what start address and size to use for
program uploads.

2. With the Midifighter connected and in Bootloader Mode, connect to the
device by pressing the "usb cable" icon and selecting "USB", or by
pressing Ctrl-U. Then select "Open" to connect to the Midifighter.

(TIP: If you are going to be doing software development on the
Midifighter, and uploading fresh firmware often, it's useful to
select the option:

"Settings/Preferences/Connecting-Closing/Auto-Connect"

This will save you from having to hit Ctrl-U to connect over USB
before each firmware upload.)


3. Load a ".hex" firmware file using the "File/Load Hex File..." option,
or by hitting Ctrl-L, and navigating to the hex file and hitting "OK".

4. Select the programming steps "Erase", "Program" and "Verify". This
will cause the old program data to be removed, the new data to be
written and then read back to verify that it was successfully uploaded
to the device. ("Blank Check" is used to verify that the erase
operation completed successfully and is mainly used to verify that a
chip is bad.)

5. Hit the "Run" button to execute the reprogramming.

6. Restart the Midifighter using the "Start Application" button, making
sure the "reset" option is selected, or just unplug and replug the USB
cable. The Midifighter should reset and act as if it has just been
plugged in. Depending on the purpose of the new firmware you may
notice no immediate difference, and if the EEPROM version has been
incremented you may have lost your persistent settings or you may in
rare situations encounter the "first boot hardware test". Read the
firmware release notes for more information on the exact behavior to
expect.

Note: If you have issues getting FLIP to either run or connect to the MF please try copying the contents of "C:/Program Files/Atmel/Flip 3.4.1/usb" into "C:/Program Files/Atmel/Flip 3.4.1/bin" and copy atlibusbdfu.dll from the bin folder into you windows folder.

2. PC using the command line.

If you are developing software for the Midifighter, it's sometimes useful to
be able to automate the reflashing process. Atmel Flip comes with a
command-line application for this called "batchisp.exe", and it can be found in
the same directory as the "flip.exe" binary.

The simplest way to access this program is to add the directory containing
the Flip binaries to the $PATH environment variable. For example, if you
have installed Flip version 3.4.1, the path can be appended using:
Code:
   > set PATH = %PATH%;"C:\Program Files\Atmel\Flip 3.4.1\bin"
Reprogramming and rebooting a chip takes three calls of the program. To
reflash the Midifighter with a firmware file called "myhexfile.hex" you
would issue these three commands:

Code:
   > batchisp -hardware usb -device at90usb162 -operation memory EEPROM erase
   > batchisp -hardware usb -device at90usb162 \
              -operation memory EEPROM loadbuffer myhexfile.hex program
   > batchisp -hardware usb -device at90usb162 -operation start reset 0

3. Mac
(Thanks to SarahEmm)

You will need to download the latest ".hex" firmware from the Midifighter sourceforge site:

Then your steps are:

  1. Ensure you have the Apple Developer Tools installed (they come on a CD/DVD with new macs/new OSes)
  2. Install MacPorts. An installer can be found at http://www.macports.org/install.php.
  3. Open a Terminal window (found under /Applications/Utilities/Terminal) to get a command line.
  4. At the command line, run
    Code:
    sudo /opt/local/bin/port install dfu-programmer
    to build and install dfu-programmer and dependencies.
  5. Hold down the four corner buttons on your Midifighter and plug in the USB cable.
  6. At the command line, run
    Code:
    dfu-programmer at90usb162 erase &&
    dfu-programmer at90usb162 flash --debug 1 midifighter.hex &&
    dfu-programmer at90usb162 reset
    (without the linebreaks, where midifighter.hex is the name of the new firmware file to be programmed).
  7. Unplug and re-plug your Midifighter to start running the new firmware.



4. Linux

Coming soon
You need to login in order to write on our forum

<< Cancel

Copyright 2012-2023
DJRANKINGS.ORG n.g.o.
Chuo-ku, Osaka, Japan

Created by Ajaxel CMS

Terms & Privacy