Programming ATMEGA168PA-AU With AVRISP MkII

I've been working on a project where I've converted an existing circuit design from PTH to SMD. In the process of doing this, I've ended up adding a ICSP header to the board as I am no longer able to remove my microcontroller to program it using an Arduino board.

My intention was to program the board using the 'Upload With Programmer' option in the IDE. The first thing I did was user AVRDude to make sure that everything was working properly, when I test the board I get this message:

avrdude: AVR device initialized and ready to accept instructions

Great I thought, the board is alive! However now it comes to programming the thing and I feel I'm in over my head. My board has a debug light on pin 1 so I have tried to upload a simple sketch just to get that to flash but I'm getting nothing. Do I need to do anything else to the microcontroller before I can use the 'Upload With Programmer' option? Should I be setting anything in AVRStudio first?

I've been using the 168 Pro Mini setting when doing these experiments and it doesn't seem to error out (when looking through the verbose logs). I've also tried uploading the bootloader which seems to work too. Should I be editing the boards.txt file to suit this microcontroller?

(Let me know if you need any further details to help me out :))

If you look in Device Manager, does it show something like LibUSB driver when the MKii is connected to the PC? You may have to update the driver - it is in one of the IDE folders.

Once that works, then select the board type under Tools:Board and the programmer under Tools: Programmer

Burn a bootloader so the fuses are set correctly for 3.3V/5V and 8/16MHz operation Tools: Burn Bootloader

and then load your sketch File:Upload Using Programmer

which does not change the fuses, but does overwrite the bootloader with your sketch.

The MKii does not provide power, only senses its to set its levels correctly. The board must be independently powered. (or the MKii modified to supply power from its USB pin)

I'm using a Mac BTW - the programmer is installed and working properly and I'm powering the board. I don't think the code is being uploaded properly even though Arduino thinks it is. This is the output from the IDE: https://www.dropbox.com/s/mjpq433cg7ejc4m/output.txt

It doesn't show any errors, but something must be going wrong as nothing's happening!

What will the arduino do so you know it's working? Can't tell from that hex code you posted.

It should load the Blink example code and pin 1 should alternate between high and low. Maybe I'm making an assumption in thinking that no error message = no errors?

You can check if your board is alive here:

http://www.gammon.com.au/forum/?id=11633

I have an uploader here:

http://www.gammon.com.au/forum/?id=11638