Thanks to this overly syndicated blog post (really – Planet Ubuntu I can understand given its content, but Planet Mozilla and Planet Inkscape, too!?) I discovered a wonderful little device called Minimus AVR USB. Basically it’s a USB-enabled (and USB-programmable) AVR microcontroller on a board with the I/O lines brought out to solder connections and just enough on-board peripherals (two buttons, three LEDs) to do some basic things without breaking out the soldering iron.
I’ve been meaning to get back into microcontrollers for a while and been tempted to go down the Arduino route, but too little spare time meant that I never got any further. Because of their slightly illicit origins as PS3 modding tools, Minimus boards are readily available at modding sites for just a few pounds (I bought mine for less than £5 from here).
I hope to post more about these in future, but I wanted to get an early post in to mention a little pitfall I fell into. I’m developing on a Ubuntu box and managed to get the AVR toolchain installed and working easily enough. I grabbed the demo code from the Minimus site and was able to push the hex file to the board in order to get the lights flashing and the buttons working. At least I knew the little board was operational.
Next I opened the source code, but as it’s been written to compile using AVR’s Windows toolchain I promptly ignored the build instructions and make file. “It’s just a few lines of code”, I thought to myself, “I can hand compile it easily enough.” So I did. And it compiled. And I converted the resultant file into a hex file for pushing to the Minimus. I pushed it with no errors, reset the device and… no flashing lights.
Many hours of tweaking that tiny source file proved that I could turn each of the lights on permanently, or off permanently. But I couldn’t persuade them to flash, and I couldn’t read the state of the hardware button. I threw in snippets of code I’d found to disable the watchdog timer, but still no joy. I tried setting the I/O lines using binary, hex, decimal, bit shifts and any other method I could think of. Nothing worked.
The solution finally came when I found some other code online and built using the make file. Suddenly the lights were flashing and the button was working! Something in the make file – one of the many switches to GCC probably – was sufficient to get things working. So if you find yourself here because you’ve bought a Minimus to play with and can’t seem to get it going, check that you’re building with a make file, not compiling by hand.