Thursday, June 7, 2007

Dragon Steak, Dragon's Lair... Dragons BITE!

So the AVR Dragon and the AVR STK500 arrived in the mail. I'm certainly getting in deep, but Atmel does a good job of holding your hand and making you feel better than you actually are. All of which is just a prosy way of saying I was like a kid in a candy store when the box arrived. My only disappointment was that Digikey stuck their inventory sticker on top of the Dragon's box. It's a beautiful red box with gold artwork of a Chinese and a Norse dragon going at it. Luckily the same motif is silkscreened on the back side of the board, so all's not lost.

I spent a few evenings reading, thinking, and writing down. In the end I realized the pair really is a nice set of tools. So I figured it was a perfect time to play! Out came the chip that came with the STK500, and in went an ATtiny85, the only processor I have that'll talk to both devices. So what to do? What to do?

Well blink an LED, of course! And the STK500 has these in copious quantities. What could be easier?

Funny how it didn't work. Second time, either. Or the third time. So I held my breath and put the ATtiny85 into debugWIRE mode.

Aaaaand promptly lost the ability to talk to it because it's the Dragon and not the STK500 that can do debugWIRE style debugging. Problem is once debugWIRE is enabled, the normal ISP programming doesn't work. So I futzed around trying to get the Dragon to talk debugWIRE to it before I finally gave up in disgust and read up on how to do high voltage serial programming on the STK500.

It took some jumpering, but I finally got the STK500 to talk over HV serial. debugWIRE fuse was cleared, I restored everything to defaults, and re-jumpered for ISP mode. A quick check verified everything was happy again.

That's when I looked at the path of the .hex file I'd been loading into the ATtiny85... It was set for some LCD code I'd done for an ATmega168. AAAAAARGH! I'd been loading code into the '85 that simply wouldn't couldn't ain't gonna work. I pointed the programmer at the right file, and golly gee willickers the LED blinked like crazy! Good to know I wasn't crazy that whole time. But what a pain in the rear. AVR Studio 4 strikes again.

I still need to build the two jumper cables for the Dragon to make it really useful, but already the two tools are making themselves comfy at home. This stuff really really is fun.

- Tom

No comments: