Updating MegaDrum firmware via bootloader with MIDI-OX

Discussions related to MegaDrum Hardware

Updating MegaDrum firmware via bootloader with MIDI-OX

Postby dmitri » Tue Mar 17, 2009 10:40 pm

This post will always contain up to date information on how to update MegaDrum firmware via bootloader using MIDI-OX.

This is the latest MegaDrum bootloader you need to program your Atmega with:
MegaDrum_bootloader.zip



This is the source code of the bootloader (you don't need it unless you want to compile it yourself):
BootLoaderSysex.zip

I should point out that the part of the source code written by me is provided under GPL license.
It is sad I had to mention it since there already has been an incident of publishing/using this code under
other names without acknowledgement/reference to the original author.


MegaDrum_bootloader.zip contains 3 files: bootloader32.hex, bootloader324.hex and bootloader644.hex compiled for Atmega32, Atmega324, Atmega644 respectively. You will need only one matching Atmega MCU used in your MegaDrum.
This screenshot shows how fuses must be programmed for Atmega32:
Atmega32Fuses.png

This screenshot shows how fuses must be programmed for Atmega324:
Atmega324Fuses.png

This screenshot shows how fuses must be programmed for Atmega644:
Atmega644Fuses.png


The procedure for programming Atmega is described in MegaDrum documentation at http://www.megadrum.info/content/programming-mcus

Once you have the bootloader programmed follow this procedure:

See the video demonstration of the procedure: MegaDrum firmware upgrade using MIDI-OX
Many thanks to Firelord for creating this video!

1. 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.

2. Start MIDI-OX (don't start it before connecting MegaDrum!). In MIDI-OX menu go to Options->Configure Buffers and set Output, NOT Input, Buffers Size to 64000. Be sure it is actually set to 64000 and not to 6400 since the input field shows only 4 characters.

3. If your MegaDrum is connected over USB, in MIDI-OX menu go to Options->MIDI Devices and in 'MIDI Outputs' select MegaDrum USB (it may be called USB Audio). If your MegaDrum is connected over a standard MIDI, in MIDI-OX menu go to Options->MIDI Devices and in 'MIDI Outputs' select MIDI port your MegaDrum is connected to for output.

4. 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.

5. In MegaDrum press the key DOWN. It will display 'Send Sysex now'.

6. Skip this step if your MegaDrum has an old type of the bootloader, i.e. without protection from accidental firmware erasure. In MIDI-OX go to View->SysEx... In the SysEx window go to Command Window-> Load File... and load this file:
erase_firmware.syx
.
Still in the SysEx window go to Command Window->Send Sysex. After a couple of seconds MegaDrum should show 'ERASED'. If it doesn't, then you didn't select bootloader frequency matching your Atmega crystal or you have hardware problem in your MegaDrum board or your Windows installation is screwed up.

7. In MIDI-OX go to View->SysEx... In the SysEx window go to Command Window-> Load File... and load the MegaDrum firmware .syx file matching your MegaDrum hardware, e.g. for 32 inputs MegaDrum with Atmega32 at 16MHz it will be megadrum32_16_32_20090306.syx where first '32' is type of Atmega, '16' - crystal frequency, second '32' - number of inputs and '20090306' - firmware version. Still in the SysEx window go to Command Window->Send Sysex. It will start sending the new firmware to MegaDrum. The MIDI LED should be flashing around twice a second. After around 10-15 seconds the update should finish, MegaDrum should show 'Updated finished' and it will restart automatically in a couple of seconds. If it doesn't work, then you didn't select bootloader frequency matching your Atmega crystal or you have hardware problem in your MegaDrum board or your Windows installation is screwed up.
You do not have the required permissions to view the files attached to this post.
dmitri
Site Admin
 
Posts: 8706
Joined: Fri Aug 03, 2007 8:05 pm

Re: Updating MegaDrum firmware via bootloader with MIDI-OX

Postby Thurston » Wed Mar 18, 2009 11:44 am

It will be very convenient to have the first post of this sticky with updated files and procedures. I'll try this when I get home today. Thanks dimitri!
Thurston
 
Posts: 73
Joined: Mon Feb 02, 2009 8:03 pm

Re: Updating MegaDrum firmware via bootloader with MIDI-OX

Postby dmitri » Tue May 19, 2009 2:45 pm

I've updated the bootloader. Here is the list of changes:

1. It controls the contrast of the LCD up until the moment the key DOWN is pressed. Makes it easier to see the LCD while selecting crystal frequency.
2. Until the key DOWN is pressed to start the update, you can press the key LEFT to send a MIDI message. Every time you press the key LEFT it sends a MIDI message '0x99 0x 0x02 0x01'. If the selected frequency matches the crystal's frequency you should be able to see this exactly message on a receiving device, e.g. on a PC in MIDI-OX.
3. Once you pressed the key DOWN to start the update, it sends back everything it received over MIDI including all bytes of incoming SysEx messages.
Can be used to verify on a PC that sent and transmitted SysEx messages match.
dmitri
Site Admin
 
Posts: 8706
Joined: Fri Aug 03, 2007 8:05 pm

Re: Updating MegaDrum firmware via bootloader with MIDI-OX

Postby Synthex » Tue May 19, 2009 3:35 pm

Megadrum becomes a real masterpiece ! :)
Synthex
 
Posts: 1471
Joined: Fri Oct 12, 2007 6:06 am
Location: France

Re: Updating MegaDrum firmware via bootloader with MIDI-OX

Postby elrules » Tue May 19, 2009 8:33 pm

This is going to be very useful for MCT. In which bootloader is this new version based? I suppose that in the clock-selector+security sysex
elrules
 
Posts: 629
Joined: Thu Nov 29, 2007 4:51 pm
Location: Murcia, Spain, Europe, The World

Re: Updating MegaDrum firmware via bootloader with MIDI-OX

Postby dmitri » Tue May 19, 2009 8:37 pm

elrules wrote:This is going to be very useful for MCT. In which bootloader is this new version based? the one that needs the security sysex? or the one without it?

It is in the latest version and the security sysex is also there. Why would I remove it?
dmitri
Site Admin
 
Posts: 8706
Joined: Fri Aug 03, 2007 8:05 pm

Re: Updating MegaDrum firmware via bootloader with MIDI-OX

Postby dmitri » Thu May 21, 2009 7:59 pm

dmitri wrote:3. Once you pressed the key DOWN to start the update, it sends back everything it received over MIDI including all bytes of incoming SysEx messages.
Can be used to verify on a PC that sent and transmitted SysEx messages match.

Sadly, I had to scratch this. For some reason it was causing firmware corruption on Atmega644 (and perhaps on Atmega324).
dmitri
Site Admin
 
Posts: 8706
Joined: Fri Aug 03, 2007 8:05 pm

Re: Updating MegaDrum firmware via bootloader with MIDI-OX

Postby Ken Forgettable » Fri May 29, 2009 12:50 am

dmitri wrote:1. It controls the contrast of the LCD up until the moment the key DOWN is pressed. Makes it easier to see the LCD while selecting crystal frequency.


I've preparing to leave this musty ditch (a Cambridge ditch) =/ can you explain this idea a wee bit more as it can't work in the same way as the application firmware now can it!
Ken Forgettable
 
Posts: 402
Joined: Tue Jan 06, 2009 5:04 pm

Re: Updating MegaDrum firmware via bootloader with MIDI-OX

Postby dmitri » Fri May 29, 2009 8:58 am

Ken Forgettable wrote:
dmitri wrote:1. It controls the contrast of the LCD up until the moment the key DOWN is pressed. Makes it easier to see the LCD while selecting crystal frequency.


I've preparing to leave this musty ditch (a Cambridge ditch) =/ can you explain this idea a wee bit more as it can't work in the same way as the application firmware now can it!

The bootloader source code is quite small, you can see it for yourself.
dmitri
Site Admin
 
Posts: 8706
Joined: Fri Aug 03, 2007 8:05 pm

Re: Updating MegaDrum firmware via bootloader with MIDI-OX

Postby Ken Forgettable » Fri Jun 05, 2009 5:58 pm

dmitri wrote:you can see it for yourself.

Your a nice man Dmirti. Nearly as nice as this wine :P

//Atmega32 and ATmega324p = 0x3c00, BOOTSZ1 = Set, BOOTSZ0 = Clr
//ATmega644p = 0x7c00, BOOTSZ1 = Clr, BOOTSZ0 = Set
Last edited by Ken Forgettable on Fri Jun 05, 2009 10:09 pm, edited 4 times in total.
Ken Forgettable
 
Posts: 402
Joined: Tue Jan 06, 2009 5:04 pm

Next

Return to MegaDrum Hardware

Who is online

Users browsing this forum: Bing [Bot] and 86 guests