Page 1 of 16

Updating firmware with protected bootloader.

PostPosted: Tue Jun 01, 2010 10:19 pm
by dmitri
This procedure describes how to load an encrypted MegaDrum firmware over MIDI or USB.

To use this procedure a couple of pre-requisite must be met.
1. MegaDrum must be programmed with the protected bootloader.
2. The procedure must be done on a Windows PC or Mac OS X.

Here is description of the procedure
1. Download and unzip the firmware update utility called mdfwupdate.
(Updated on 23/12/2011 to add Mac OS X version).
mdfwupdate.zip

2. Download the latest encrypted MegaDrum firmware and choose a file matching your MegaDrum version, e.g. for MegaDrum on Atmega644 the file will be called megadrum644_20111213.bin where 20111213 is firmware version date.
3. Power MegaDrum up while holding the key LEFT pressed. If you connect over USB and it is the first time you connect your MegaDrum to your PC, let Windows install drivers. While keeping the key LEFT pressed the MIDI LED will be blinking indicating that it is entering the bootloader mode. When you release the key LEFT the LCD will show (on Atmega based MegaDrum):
Code: Select all
FwSUpdater 16MHz
DOWN-ok.UP-clock

or (on ARM based MegaDrum):
Code: Select all
FwSUpdaterSTM32b
StartUpdateOnPC

4. From a command line run the utility, e.g. on Windows:
Code: Select all
mdfwupdate.exe megadrum644_20111213.bin

On Mac OS X;
Code: Select all
./mdfwupdate megadrum644_20111213.bin

5. First it will prompt you to choose which MIDI output port to use. Type a number corresponding to the MegaDrum MIDI port and press Enter. It will now prompt you to choose which MIDI input port to use. Type a number corresponding to the MegaDrum MIDI port (don't press Enter yet).
6. Skip this step on an ARM based MegaDrum. In MegaDrum select correct frequency for your Atmega crystal by pressing the key UP. Each time you press UP it will cycle one step through 16MHz-20MHz-24MHz-12MHz. If you use a 16MHz crystal for Atmega, you don't need to press UP since 16MHz is a default start up frequency for the bootloader.
7. Skip this step on an ARM based MegaDrum. In MegaDrum press the key DOWN. It will display 'StartUpdateOnPC'.
8. On the PC press Enter. Note, on Mac OS X this must be done within 1 second after step 7 otherwise MegaDrum bootloader will reset itself.
9. It will now start updating the firmware and after a couple of minutes it will finish. While doing the update it will show progress on the command line and on the LCD. On the LCD it will look like this:
Code: Select all
88886>ater 16MHz
StartUpdateOnPC

10. When update has finished, the utility will show
Code: Select all
Transferring.. 100% done.
MegaDrum updated successfully.

and MegaDrum will reboot and will start with new firmware.

This is a screenshot of the whole procedure on the command line:
mdfwupdate.png

Re: Updating firmware with protected bootloader.

PostPosted: Wed Jun 02, 2010 9:15 pm
by Firelord
This front-end was superseded by MDUpdate.

Just a quick follow-up to my previous attempt of making firmware selection easier for this new utility.

mdfu.png


Download (~ 111 KB)
(current version 1.1)

Updated to version 1.1 (15.06.2010):
- Removed redundant 'UPDATE' button, the update utility will now be launched as soon as a firmware file is selected.

Some things to consider:
- It only runs on Windows and requires .NET 2.0;
- It ships with the mdfwupdate.exe utility built-in, i.e. it will be extracted on first run if not already present in the GUI folder.

Re: Updating firmware with protected bootloader.

PostPosted: Tue Jun 15, 2010 8:55 pm
by Firelord
I also recorded a video of the updating process (following the MIDI-OX video). It can be viewed here:

http://www.youtube.com/watch?v=Y8M3KIRuPWQ

Re: Updating firmware with protected bootloader.

PostPosted: Thu Jun 17, 2010 5:00 am
by rockdude
Firelord wrote:I also recorded a video of the updating process (following the MIDI-OX video). It can be viewed here:

http://www.youtube.com/watch?v=Y8M3KIRuPWQ


Excellent video Firelord! Much appreciated. Videos like this will make things very clear.

Re: Updating firmware with protected bootloader.

PostPosted: Fri Jun 18, 2010 6:43 pm
by davem
Hi dmitri,

I've not been around for a while, and missed the encrypted bootloader stuff. Is there any kind of timeframe on a Mac version of this software? I don't own or have access to a Windows PC and run entirely on Mac software, MCT and all. If you need assistance I can provide it but I'm aware that you probably don't want to divulge information for the system you're using.

Re: Updating firmware with protected bootloader.

PostPosted: Fri Jun 18, 2010 7:00 pm
by dmitri
This is a test java version (source code):
BootloaderJavaUpdateConsole.zip


It works on Windows if sysex message length is limited to 22, using MidiSupport.writeMid(), or using 1 byte sysex messages, MidiSupport.writeShort(), but fails if using MidiSupport.write(). Haven't had time yet to figure out why.
Tested it on Mac as well using mmj and seems to work (as watched by MIDI Monitor) but I tested it only with virtual ports so don't know if it'll work with a real MegaDrum connected.

Re: Updating firmware with protected bootloader.

PostPosted: Fri Jun 18, 2010 9:35 pm
by Firelord
Any chance of getting the c/c++ source code for the utility?

Re: Updating firmware with protected bootloader.

PostPosted: Fri Jun 18, 2010 9:43 pm
by pfhor
+1 on releasing source, would only be beneficial to have the community contribute to it. :)

Re: Updating firmware with protected bootloader.

PostPosted: Fri Jun 18, 2010 10:17 pm
by dmitri
c++ source code:
mdfwupdate_source.zip


On Windows with MinGW can be compiled as:
Code: Select all
g++ -D__WINDOWS_MM__ -Wall -o mdfwupdate.exe update.cpp RtMidi.cpp -lwinmm

On Mac OS X can be compiled as:
Code: Select all
g++ -D__MACOSX_CORE__ -Wall -o mdfwupdate update.cpp RtMidi.cpp -framework CoreMidi -framework CoreAudio -framework CoreFoundation

On Linux can be compiled as:
Code: Select all
g++ -D__LINUX_ALSASEQ__ -Wall -o mdfwupdate update.cpp RtMidi.cpp -lasound -lpthread

Re: Updating firmware with protected bootloader.

PostPosted: Sat Jun 19, 2010 2:19 am
by davem
Much appreciated dmitri. I will make a simple OS X GUI wrapper for the program, if you'd like.