NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Programming atmega168 with avrisp mk2

August 01, 2010
by maceide
maceide's Avatar

Does anyone know how to connect a atmega168 to a avrisp mk2 for programming it? I can not figure it out, and I have spent hours looking on the web (obiously not on the right places, cause there must be some answers out there..?)

Any help very much appreciated!

Regards

August 01, 2010
by ferret4
ferret4's Avatar

The Nerdkit people should be able to clarify this. I looked at the images of the AVRISP2 and its connector and wondered the same thing. Not a 24 pin connector. I get the impression from the ATmel site that the ATSTK500 (available at Digikey part number ATSTK500-ND for yet another $78.75) kit is required. There are several of these interface kits with increasing prices, for chips with more pins / more features but I think the 500 is all that's needed for the ATmega168. I'm looking forward to the answer also.

August 01, 2010
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi there,

The Atmel AVRISP-mkII can definitely be used to program the ATmega168 and ATmega328P chips. Here is the product website and the user guide.

Take a look on page 26 of the user guide. There, you'll find a pinout of the 6-pin connector. (Careful -- I think that this is from the perspective of a board with a male header, not from the perspective of the AVRISP's own ribbon cable connector, but I'm not 100% sure.) You need to connect all 6 pins to their corresponding places on the ATmega168 chip (MISO, MOSI, SCK, RESET, GND, VCC). You also need to have your chip powered on its own -- power is not supplied by the AVRISP-mkII.

Hope that helps!

Mike

August 02, 2010
by ferret4
ferret4's Avatar

It appears to me from the board photo on page 24 of the guide that pin 1 of the male header is in the same location as pin 1 in the "Target Interface" pinout on page 26, ie the pinout on page 26 looks like a view down onto the male pins and is not the female cable end. So a jumper cable has to be made up to connect the AVRISP2 cable to the ATmega168 pins, as they don't mate directly, and power provided. Not a problem.

August 02, 2010
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi ferret4,

I think you've confirmed what I mentioned before about the pinout being from a view down onto male pins -- thanks.

In any case, a minimal "jumper cable" could consist of six wires, stripped and inserted into the female ribbon cable end, and then into the solderless breadboard.

Mike

April 02, 2011
by kkanodia
kkanodia's Avatar

Hey Mike,

I have been successful in programming the Atmega168-20PU DIP IC using the avrisp mk2 programmer and uploading the bootloader that you have provided along with my code... but the footprint of the DIP controller is big for my requirement so I have been trying to use ATmega168 - 20AU (TQFP-32) IC for the same application.. I was able to successfully communicate with the uC using mk2 and load my program but the bootloader shows an error while upload... How do I go around this problem??

Thanks, Kabir

Post a Reply

Please log in to post a reply.

Did you know that the printf format string "%.3f" will show three digits after the decimal point? Learn more...