Adventures with Atmel AVRs and CNC PCB engraving.

Well it has to be said, for a PIC-man venturing into the Atmel world there are many pitfalls.

The story so far...

I designed a Jtag/ISP programmer based on the excellent IsoJtagISP. I used Eagle CAD and pcb-gcode to output the design to my little Widgitmaster CNC router.

(Mind the blobs of solder at the top. I bumped the crystal loose and tore the tracks off the board during the many attempts at removing the AVR as detailed below...)

The board engraved a treat and was flawless. Time to drill... oops! I forgot to set the Z height for the "Tool Change" home position, so helpfully the machine engraved a nice straight line across 3 tracks. DAMN! Ok, fix that... drill, drill, drill, DAMN does it again! This time only across one. Repair the tracks with a small piece of magnet wire and start assembly.

Assembly goes a treat, board is straight, all the holes and positions are perfect. Board is completed...

Ok, time to program the AVR with it's needed boot loader. Hack together a 'BSD' type parallel wires-only programmer, use AVRDUDE, AVR programmed no drama. All looking great.

Put AVR in new board, power up, LED flashes as suppose too, looking brilliant. Load up AVRStudio, attempt to update the firmware using the AVRProg tool. Firmware uploads...... ERROR. Damn!

Look at it, hmmm I didn't program the fuses on the AVR so it's still running on the 1MHz RC internal oscillator instead of the 7.3728MHz crystal... AVR back on hacked up programmer. Look at datasheet for ATMEGA16, read the first few sentences get the idea and say to myself "hmm this is very similar to a PIC I know what to do".... WRONG!

I calculated the fuse values by hand, gleefully uploaded them to the AVR, plug it back into the board. Dead as a stone... plug back into the hack programmer... "No AVR connected"... DAMN!

Re-read datasheet... "Please note, put a '0' for programmed and a '1' for not".... WHAT! It's frigg'n reversed! So instead of 'enabling' the bits with a '1' I've disabled the bits. So features I didn't want are turned on, and features I needed are turned off. The upshot now is the AVR is locked with the programming interfaces disabled, the clock in a format that doesn't seem to function and the bootloader disabled.... F^&*!

So now, I'm looking down the barrel of building _another_ programmer which supports HVPP to de-brick this AVR or simply toss it back in the box to be fixed at some point in the future and buy another one....

It should be labelled 'disable bits' not 'enable bits'...

Not happy! If you've got any ideas please put a comment or drop me an email.