Sunday, November 23, 2008

notes of the day:

note #1: when trying avrdude with a breadboard-wired AVR, make sure the power leads on the breadboard is actually connected to the PSU.

note #2: now that i've done that, avrdude is talking to my avr. like, totally awesome, duuuude.

note #3: when playing around with programming fuses, make sure you have a high-voltage programmer like the STK-500 or a suitably wired AVR dragon, or just have an entire pile of AVR's to play with.

note #4: do not use a 10uf capacitor instead of a 22uf capacitor. The external oscilloator thingie will not work. also putting larger wires on the osc (and making sure the wires are actually *in* the board) help, too.

And now for the main course -how i wired up the breadboard!

5v and ground come from an old dell dimension xps/4100 power supply. pins 11 and 12 (the top left, top being the tab) turn it on. it puts about 5.14v on the 5v rail.

I used an iomega zip/ditto db-25 cable I got at the thrift store, and then used pins from a db-25 male plug i got at radio shack. I did this so I could move the pins around manually... and because I couldn't hack using the inserter tool.

Here are the pin assignments as seen from the parallel port to the atmega168:

pin 1 -> 470ohm -> pin 19 (SCK)
pin 2 -> 470ohm -> pin 17 (MOSI)
pin 11 -> 2x330ohm -> pin 18 (MISO. not soup, tho.)
pin 16 -> direct to pin 1 (reset)
pin 18 -> direct to ground

the instructions say that pin3 goes to vcc. (It might be possible to do a hanging-wire programmer using just the internal clock, resistors, parallel port connection, and some wires, if that actually works.)

and on the breadboard itself, from the atmega168 POV:

pins 9, 10 - wired to the 16mhz oscillator and a 22uf ceramic capacitor to ground.
pin 7 - 5v
pins 8, 22 - ground

When programming fuses, set the high fuse to 0xdd and the low fuse to 0xff to get the external 16mhz osc working correctly. This is the correct setting for both arduino and usbasp. (Do not get confused and set the low fuse to 0x60 for external clock. It bricks the chip.) Arduino also changes the extended fuse from 0x01 to 0x00, which I haven't tried yet.

use avrdude with "-c dapa" and "-p m168"

So there you have it - the simplest possible programming setup for avrdude and an atmega168 avr. With this you can prepare more Arduino chips, or experiment further...

No comments: