Upload New Firmware to Your MeeBlip

First, to get the latest code, remember you can check out code downloads from:
https://github.com/MeeBlip/meeblip-synth

This is a long explanation of a short process – long just to give you everything you’d possibly want to know! If you’re in a hurry, or you know what you’re doing, check out our blog post with 10 second instructions.

The beauty of digital instruments is that they run software, meaning you can change how they operate. The Atmel AVR chip at the heart of the MeeBlip has on-board flash memory in which it stores its program code. (It’s an 8-bit CPU called the ATmega32A, which loads code that’s squeezed into just 32KB of memory.) Most of what the MeeBlip does, from how it generates sounds to how it responds to knob turns or MIDI events, is contained in those instructions. You can upload your own code to that memory once and gain instant-on access to it.

You might want to install updates we provide for the MeeBlip, as we improve the synth in response to feedback. You might want to try out custom firmware written by other members of the MeeBlip community. Or you might want to try programming the MeeBlip yourself – making small changes to the code is fairly easy, and since that flash memory is rewritable, you can always go back to a previous version if you screw something up.

So, how do you do this? If you’re accustomed to boards like the Arduino, you’ve already uploaded program code to flash memory, but you’ve done so with a very big shortcut. Most Arduino boards can be programmed directly through a USB interface, because they have what’s called a bootloader pre-burned to the device.

With the MeeBlip, you’ll need a special device to upload your programs. Fortunately, these devices are pretty easy to operate and inexpensive, and if you intend to do any hardware hacking at all, they’re a good thing to have around.

Here, we’ll walk you through which programmer to get and how to use it, without assuming you’ve ever used one before.

Choose a Programmer

AVR programmer devices act as a bridge between your computer and an AVR-based chip — any AVR chip, by the way, not just the MeeBlip. They connect to the chip using a six-pin header at one end, and connect to your computer using USB at the other end. If you don’t yet own a device, here are a few we really like.

Our current favorite is the Sparkfun Pocket AVR Programmer. It’s US$15, it’s tiny, it’s pre-assembled, and it should do what you need it to do. (There’s also no reason to think it shouldn’t work just fine on Mac and Windows, despite the warning in the description.)

Two other programmers we’ve tested: the Adafruit USBtinyISP, which is an open-source programmer you solder and assemble, left, and the Pololu USB AVR Programmer, right.

For a fun, easy build and exceptional support and documentation, you can’t beat Limor Fried’s open source USBtinyISP, sold by Adafruit Industries. Sparkfun’s kit is actually based on this very project. You do have to whip out a soldering iron, but the USBtinyISP has an enclosure, so it’s a good choice for a programmer you can safely carry around. It also gives you both 6-pin and 10-pin connections.

Pololu’s USB AVR ISP Programmer is similar, costs around US$20, and comes pre-assembled. It also boasts some nifty extras: it installs two virtual COM ports, easily switching between debug and programming modes. If you are on Windows, it also has a really basic oscilloscope feature – no replacement for an actual oscilloscope or multimeter, but fun to use and potentially even useful for … something.

Digi-Key also offers a pre-assembled Atmel programmer that looks a bit fancier for $35, though we haven’t tried it.

In summary, all three of these are recommended entry-level programmers, particularly the open source Adafruit and Sparkfun models:
Adafruit: US$22, you assemble, comes with housing and 10-pin “bonus” cable, open source.
Sparkfun: US$15, pre-assembled, derived from Adafruit.
Pololu: US$20, pre-assembled, couple of extra features, especially if you’re on Windows.

Read the Manual!

Adafruit’s guide is the most comprehensive, a great starter tutorial to the word of programming:
USBtinyISP: Care & feeding thereof

But here’s a shortened, hands-on tutorial for the MeeBlip, which we’ll add to over time with your feedback.

Disassemble Your MeeBlip

You’ll need to physically connect to the MeeBlip’s programming header. In order to protect your MeeBlip’s innards, we don’t expose the header. You’ll need to disassemble the MeeBlip.

On the Quick Build units, the header’s location depends on which revision of MeeBlip you received. On newer boards, we’ve moved the header to the bottom of the board for easier access. All you have to do to get at it is remove the six screws on the bottom of the case, then the nut that fits over the 1/4″ audio jack. Take off the bottom panel of the case, and you’ll see the header.

The header on the bottom of the board, center – note the six pins.

On early units, the header is on the top of the board. As with the other MeeBlip, remove the 1/4″ nut from the back and the panel from the bottom. Then, remove the knob caps from the top of the case. Unscrew the screws the hold the board to the top of the case. Pull gently on the board to remove it. You can leave the jumpers to the audio, MIDI, and power connectors in place. This exposes the header.

The header on the top of the board, as it is on earlier MeeBlip units. You’ll connect the six-pin cable from your programmer (note the six holes) to the six pins on the MeeBlip board.

If you built your own MeeBlip, of course, you’ll just take it out of whatever housing you’ve got. (You did put together a housing, right? Oh. Okay, don’t worry about it – takes us a while to get around to these things, too!)

Install and Configure Your Programming Software

Mac OS X

Updated – a (potentially) better way! avrdude is available as part of a lightweight installation system called Homebrew. It’s currently our preferred way of installing on the Mac, but there’s a bit of a trick; see a separate blog post.

See also: handy instructions on installing from source from the Arduino playground.

Mac OS X doesn’t have a package manager by default as Linux does, so free software can take a little more work to install.

First, grab avrdude. If you don’t feel comfortable building it yourself or installing from a Mac package manager like MacPorts or fink, check out Adafruit’s download page for Mac (PowerPC or Intel) binaries:
http://www.ladyada.net/make/usbtinyisp/download.html

Limor suggests copying avrdude to /usr/local/bin and avrdude.conf to /usr/local/etc. I had to create the latter directory. Open a Terminal, and change to the proper directory. (Tip: type “cd ” into the Terminal, and then just drag the icon of the download – it’ll copy the path for you! Hit enter.)

For me, the remaining commands were:

sudo cp avrdude /usr/local/bin/avrdude
sudo mkdir /usr/local/etc
sudo cp avrdude.conf /usr/local/etc/avrdude.conf

Be sure to add the directory where the binary is stored to your path so you can just enter “avrdude” and have something happen. In a Terminal, enter:
echo 'PATH=$PATH:/usr/local/bin' >> ~/.bash_profile
… and then restart the Terminal.

Linux

Install avrdude from your distro’s package repository. On Ubuntu/Debian, for instance, simply enter the following line into a Terminal:

sudo apt-get install avrdude

(If you use an rpm-based system like Red Hat or Fedora, avrdude has rpm-specific instructions.)

Writing to a device requires administrative privileges. You can insert the command “sudo” before avrdude commands, or to make things easier, add to your device rules. On Ubuntu, for instance, I created a file in the /etc/udev/rules.d directory called usbtiny.rules. (You can use any filename you like.) In that file, I placed one line:

SUBSYSTEM=="usb", SYSFS{idVendor}=="1781", SYSFS{idProduct}=="0c9f", GROUP="users", MODE="0666"

This line gives all users permission to talk to the device. Finally, change the permissions on the file itself:

chmod a+r usbtiny.rules

Windows

Windows requires drivers for USB programmers. Adafruit walks through the process of installing the USB driver on Windows.

With the drivers in place, you can install the Windows version of avrdude, WinAVR. Both the avrdude manual and Adafruit documentation are useful:
AVR Setup on Windows
avrdude: Windows Installation

Once installed, you’ll use avrdude from the command line just as you do in Mac OS X and Linux; just run cmd.exe and proceed normally.

Connect to the MeeBlip

Whichever programmer you’re using, you want to make sure pin 1 on your ribbon cable lines up with pin 1 on your MeeBlip. Pin 1 is on the bottom left on the MeeBlip with the board facing up. (If you’ve got a new MeeBlip, there’s no silkscreen labeled “Pin 1,” but it’s the bottom left with the bottom of the board facing you.)

On the ribbon cable on the usbtiny, pin 1 is marked in red. But regardless, you’ll want the ribbon end of the cable facing down when connected to the MeeBlip.

Here’s the ribbon cable connected to the header on boards that have the header pins on the top.

Here’s a Sparkfun programmer connected to a newer MeeBlip Quick Build board with the header on the bottom.

Power: If you have a programmer that provides 4-5V power, you actually don’t need to connect the MeeBlip to power. You’ll get power from the programmer. But if you don’t have a programmer with power, or if you have Adafruit’s programmer but haven’t installed the jumper for power, you can simply connect MeeBlip to power as you always have.

Upload the Firmware!

With the cable plugged in, we can finally upload some code!

You can test that you’ve done everything properly by connecting your MeeBlip and running the following command (for Adafruit and Sparkfun models):

avrdude -c usbtiny -p m32

For other programmers, substitute the name of the programmer after the -c flag. For instance, on the Pololu programmer, substitute -c avrispv2.

If all is working correctly, you should see something like this:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9502

avrdude: safemode: Fuses OK

avrdude done. Thank you.

If you see an error message, like an initialization error, check the following, probably in the following order:
1. Make sure your syntax is correct.
2. Ensure you’ve properly connected to the MeeBlip, with the ribbon cable pointed the right way.
3. Double-check the installation steps for your OS.

If that worked, though, you can upload your code!

We’ll assume here that you’ve built a hex file or downloaded one from us. (The .asm file is raw source code, which you can’t upload directly to the MeeBlip because it isn’t compiled!)

Navigate to the directory in which you’ve got the .hex file you want to use, then execute the following command, again substituting the name of your programmer after -c if you need to:

avrdude -c usbtiny -p m32 -U flash:w:meeblip.hex

If all goes to plan, you should see some quick status in which the code is uploaded. (It takes just a couple of seconds!) The output will look something like:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9502
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file “meeblip.hex”
avrdude: input file meeblip.hex auto detected as Intel Hex
avrdude: writing flash (4246 bytes):

Writing | ################################################## | 100% 2.49s

avrdude: 4246 bytes of flash written
avrdude: verifying flash memory against meeblip.hex:
avrdude: load data flash data from input file meeblip.hex:
avrdude: input file meeblip.hex auto detected as Intel Hex
avrdude: input file meeblip.hex contains 4246 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 2.23s

avrdude: verifying …
avrdude: 4246 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done. Thank you.

Mmmmm. Terminal-y. Hey, you can do this in a matter of seconds with just one line of instruction! Not bad – take that, GUI!

Once the firmware is uploaded, you should be able to make some sounds. Disconnect the programmer, and you’re ready to get back to work.

Now We’re Cooking!

Those instructions were long in order to walk you through the process, but actually uploading firmware is ridiculously fast. Plug it in, open a terminal, upload, done – all in seconds.

That means if you ever do decide to dabble in programming, even to do something quick, you’ll find that you can try out code on the MeeBlip itself and make some noise right away, even including the time to compile the hex file.

If you’ve ever struggled to download a proprietary editor app, make it run on your computer, then wait eons for a MIDI SysEx dump to work, only to have something go wrong … yeah, we’ve been there. This is faster, more reliable, more powerful, and more compatible. It wasn’t our idea; it’s the way hardware hackers work.

Now, if you don’t mind, I’m going to slap that case back on and go make some noise!