AVR Butterfly: Part 1

10 07 2009

After thinking about doing something interesting like making a robot for some time, I always end up getting bogged down in details and never get around to it. Instead of such a big project, I decided to just pick up an AVR Butterfly demonstration board to play with and learn more about programming micro-controllers. It’s got an d ATmega169PV with 512KB of memory; as well a handful of input/output pins with a built in clock, LCD, temperature sensor, buzzer, voltage sensor and analog to digital converter. It can also (in theory, see below) can be programmed with an RS232 port and no special hardware, and using all free software to compile C code or just program straight Assembly. And all this for only $20, hard to beat. I ordered it from Mouser and got it in the mail yesterday.

For assembly I found that I had a ton of male header connectors, but no females. A trip to radio shack came up with nothing, so I stripped apart an old computer and found what I needed. The cables that go to the serial and parallel port are 10 pin female and work well. Only downside is that they are stranded wire and will be a pain to push into a bread board.


The connectors are too wide for all 3 of the 10 pin headers, but the middle one I think is just JTAG stuff for the most part and won’t be used for now at least.


For the RS232 I used the female connector on the end of the power button,  along with a spare pin off a front LED connector.


The other end just goes to a DB9 I had laying around. Only downside to all this is that it’s quite easy to plug things in the wrong direction.

DSCN0799I hook it up to the RS232 and manage to make it say, “Hello”. After that when I try to actually program a simple C program into it though, I find that I happen to have one of the misprogrammed/recalled AVR butterflies which do not have the boot loader bit set correctly on them. Instead of starting instructions at the beginning of memory, it skips the bootloader and isn’t programmable through the RS232 until I toggle a bit using either JTAG or SPI.  The way to diagnose the problem is to note that when you apply power, instead of sleeping until you press up on the joystick, it will just start tickering AVR Butterfly across the screen right away. It also won’t send the series of question marks to the serial port on boot that are expected. The details on how to change the bit with SPI are elusive, since it’s something most people trying to program chips via JTAG or SPI should already know apparently, and the schematic link I found for using a parallel port to program the SPI was dead, so I’m currently waiting on some forum replies plus an email to Mouser to see if they will do anything about sending me a recalled product. They’ll probably tell me I can send it back and get a new one, but it’s really not worth the trouble, especially if they charge for shipping; and I also soldered on my header connectors already… Worse case I’ll make friends with some people at the lab at work and see if I can get ahold of a JTAG programmer during my lunch break.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: