arduino leonardo as avrisp

i made a breadboard arduino Duemilanove using an atmega168 with 16MHz oscillator.i upload the arduinoISP to the leonardo and connect pins 13,1,2,11 and 10 on leonardo to SCK,MISO,MOSI & reset respectively on the atmega168 on the breadboard.i then try to burn the bootloader on to this blank chip but i keep getting an error.i then try and connect TX/RX from leonardo to the TX/RX pins on the atmega168 and try to upload the blink sketch.same problem.i get an error message saying the device cannot be recognised.need help please!

i posted a picture of the breadboard version i made

"It turned out that the ArduinoISP sketch that comes with the arduino ide (version 1.0.1) does not work out of the box on the recent Leonardo model."

see: ArduinoISP on the Leonardo | PeterVH
for a fix.

applied the fix bt no use.i try burning the bootloader and i get this error message

avrdude: stk500_getsync(): not in sync: resp=0x00

i also try uploading the blink sketch directly to the chip and i get this error

Binary sketch size: 1,084 bytes (of a 14,336 byte maximum)
avrdude: Expected signature for ATMEGA168 is 1E 94 06
         Double check chip, or use -F to override this check.

the MISO,MISI and SCK pins are connected to the ICSP header of the leonardo.im using an ATMEGA168P-20PU and trying to burn the bootloader as a Duemilanove w/ Atmega168.i tried using 16MHz and 20Mhz crystal oscillator for the chip since this chip can run at a max of 20MHz

riyadhalnur:
i made a breadboard arduino Duemilanove using an atmega168 with 16MHz oscillator.i upload the arduinoISP to the leonardo and connect pins 13,1,2,11 and 10 on leonardo to SCK,MISO,MOSI & reset respectively on the atmega168 on the breadboard.

As fas as I know the ISP signals of Leonardo are not available on pins 13, 12, 11, 10 but only on the ICSP header.
See: http://arduino.cc/en/uploads/Main/arduino-leonardo-schematic_3b.pdf
Also, the ICSP header has exactly the signals (Reset, Mosi, Miso, SCK) which means it is configured for programming the Leonardo's 32u4 microcontroller using an external programmer not for using Leonardo as an ISP programmer.

In theory the solution proposed here should work:

However, it looks like ArduinoISP was not intended to work together with Leonardo.

However, it looks like ArduinoISP was not intended to work together with Leonardo.

I believe this is not true. All what is needed for ArduinoISP is an spi interface to the target and a communication link to the pc and the Leo has both. It did not work in 1.0.1 because of a driver bug, but the Leonardo is still new, so this is normal.

Sure, the Leonardo's behavior (resetting, serial line,...) is different and confuses us sometimes. But for ArduinoISP I see no negative effects. I even see advantages:

  • The leonardo is immune to autoresets (well, since 1.0.2) triggered by avrdude, on the classic arduino's you need to disable autoreset with a cut in the dtr line or a capacitor...
  • The Leonardo has a second serial port (Serial1, the real uart). This is a great feature! I learned a lot about ArduinoISP by printf debugging on the second serial port. (The Leonardo was not yet out at that time, but I used a Sanguino which also has a Serial1). You can't do that on a classic arduino! The Leo is a great little board.

So if I flash Arduino Leonardo with ArduinoISP using Arduino 1.0.2 instead of 1.0.1 and then use Leonardo as an ISP programmer in conjunction with avrdude I still have to modify ArduinoISP code like this:

In ArduinoISP change this line:
#define RESET SS
into:
#define RESET 10

but no other change will be necessary.

Is this correct?

Well, I just tried it. It worked, but there is one small thing: open the serial monitor right after flashing ArduinoISP into the leo (step 5 in my writeup). This is only needed right after uploading the ArduinoISP sketch. This should have been fixed, I’ll need to debug this…