Reprogramming the MaKey Makey

The MaKey MaKey is a very well marketed bit of technology. I got one for my son last year and we had a bit of fun with it, not quite as much as Jay’s videos would have you believe…

Recently we decided to attach it to an Android tablet to get a pet to take a photo of itself. It seemed like a good idea until we realised that the tablet needed an <Enter> key and the MaKey MaKey didn’t provide one. Not to worry, it’s just a modified Arduino, right?

The MaKeyMaKey is supposed to have the Caterina bootloader installed. Ours didn’t, or if it did, the timeout was set to a handful of clock cycles. So there was no over-the-usb programming going to happen. So I got a cheap http://www.fischl.de/usbasp/[usbasp] programmer from ebay. The Makey Makey circuit is available, as is the usbasp one, so connecting the two wasn’t too hard.

MaKey MaKey pin

usbasp pin

Name

D14

9

MISO

D16

1

MOSI

5V

2

5V

GND

8, 10

Ground

RST

5

Reset

D15

7

SCK

But then there was trouble. The program would upload but verification failed every time, at the same spot.

avrdude -F -p atmega32u4 -c usbasp -D -U flash:w:MaKeyMaKey.hex:i

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9587
avrdude: reading input file "MaKeyMaKey.hex"
avrdude: writing flash (18006 bytes):

Writing | ################################################## | 100% 11.93s

avrdude: 18006 bytes of flash written
avrdude: verifying flash memory against MaKeyMaKey.hex:
avrdude: load data flash data from input file MaKeyMaKey.hex:
avrdude: input file MaKeyMaKey.hex contains 18006 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 8.47s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0002
         0x6c != 0x7d
avrdude: verification error; content mismatch

avrdude: safemode: Fuses OK (E:CE, H:D8, L:FF)

avrdude done.  Thank you.

To cut a frustratingly long story short: The problem wasn’t incorrect wiring, dodgy connections, wrong clock speeds as suggested by avrdude: warning: cannot set sck period. please check for usbasp firmware update., or similar. It was simply that the chip needs to have its flash erased when using this programming method. Passing the -e flag to avrdude solved it.

avrdude -e -F -p atmega32u4 -c usbasp -D -U flash:w:MaKeyMaKey.hex:i

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9587
avrdude: erasing chip
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: reading input file "MaKeyMaKey.hex"
avrdude: writing flash (18006 bytes):

Writing | ################################################## | 100% 11.95s

avrdude: 18006 bytes of flash written
avrdude: verifying flash memory against MaKeyMaKey.hex:
avrdude: load data flash data from input file MaKeyMaKey.hex:
avrdude: input file MaKeyMaKey.hex contains 18006 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 8.47s

avrdude: verifying ...
avrdude: 18006 bytes of flash verified

avrdude: safemode: Fuses OK (E:CE, H:D8, L:FF)

avrdude done.  Thank you.

Now we can really have some fun.

Posted Sunday, October 19, 2014

Blog contents