Can't Use an Arduino as ISP

I have a Duemilanove with the Arduino as ISP sketch put on it, and with the wires to hook up another arduino and I included the cap between the reset and ground. I wire it up to a target Arduino, an UNO to test it out, I line up the Tools as needed, and try an upload and.... no dice.

I'm running Ubuntu 13.10 and I tried multiple versions of the IDE software. I can put sketches on the Duemilanove and UNO normally with the system and the versions of the IDE. Needless to say I double checked the wiring between the two. I need to solve this because there is NO way I can EVER program a Leonardo except by using an ISP device.

NOTE: Please do not tell me that Leonardos work on Linux. If it works on YOUR Linux box, you merely got lucky.

pentius:
I have a Duemilanove with the Arduino as ISP sketch put on it, and with the wires to hook up another arduino and I included the cap between the reset and ground. I wire it up to a target Arduino, an UNO to test it out, I line up the Tools as needed, and try an upload and.... no dice.

I'm running Ubuntu 13.10 and I tried multiple versions of the IDE software. I can put sketches on the Duemilanove and UNO normally with the system and the versions of the IDE. Needless to say I double checked the wiring between the two. I need to solve this because there is NO way I can EVER program a Leonardo except by using an ISP device.

NOTE: Please do not tell me that Leonardos work on Linux. If it works on YOUR Linux box, you merely got lucky.

I don't know what to tell you. The ISP sketch works fine for me (Kubuntu 14.04, 64 bit). Of course, it doesn't properly handle the Arduino MEGA and is all around sort of flakey to use (reset timing is tricky).

I heartily suggest you buy yourself an Atmel AVR-ISP-MKII (click the picture for the link):

It "just works", no fuss no muss (works fine on Linux, by the way).

Note that the Atmel ISP does not provide power over the ISP connection. You either need to connect a separate power source to your target device or else hack your ISP to forward USB power to the ISP pin. The cover pops off easily, so you won't damage anything by opening it.

To do the hack, see these pics - click a pic for higher resolution:

Obviously (as the pics show) the diode has to point towards the ISP header! :slight_smile:

Good luck!

I need to solve this because there is NO way I can EVER program a Leonardo except by using an ISP device.

INCORRECT ASSUMPTION:
Am I understanding that you are overwriting your 32U4 Leonardo bootloader??? This also contains the LUFA code, you are aware? Without the boot loader+LUFA, why pay the extra price for the 32U4 .... Just the 20% extra SRAM?

If I remember correctly... You need to change the 32U4 to indicate no boot loader if you are just requiring the SRAM. Google for specifics.

Ray

I'm not trying to overwrite the bootloader, just load in sketches onto a Leonardo. The normal method of loading sketches onto a Leonardo plain does not work for me. That's why I'm trying to use the Duemilanove as the ISP device. I have to bypass that funny USB feature of the Leonardo's chip.

pentius:
I'm not trying to overwrite the bootloader, just load in sketches onto a Leonardo. The normal method of loading sketches onto a Leonardo plain does not work for me. That's why I'm trying to use the Duemilanove as the ISP device. I have to bypass that funny USB feature of the Leonardo's chip.

Using ArduinoISP to program the 32U4 does overwrite the bootloader. The bootloader is able to intercept a HEX file and write to flash but ISP just writes the program over the bootloader which is also in flash. SO, the bottom-line is that you can use ISP without a bootloader or load the bootloader+sketch (by creating a composite HEX file semi-manually) or you can use USB with the bootloader to load flash beyond where the bootloader resides. There may be other options available.

The following examples are for 328P but you can adapt to 32U4... Examples based on ArduinoISP.

To Read and create a disk file image (Windows examples):

flash
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U flash:r:%temp%\backup_flash.bin:r

eeprom
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U eeprom:r:%temp%\backup_eeprom.bin:r

hfuse
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U hfuse:r:%temp%\backup_hfuse.bin:r

lfuse
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U lfuse:r:%temp%\backup_lfuse.bin:r

efuse
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U efuse:r:%temp%\backup_efuse.bin:r

To Write a disk file image into the ATmega328 microcontroller (no line breaks):

flash
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U flash:w:\Users\owner\AppData\Local\Temp\backup_flash.bin

eeprom
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U eeprom:w:\Users\owner\AppData\Local\Temp\backup_eeprom.bin

hfuse
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U hfuse:w:\Users\owner\AppData\Local\Temp\backup_hfuse.bin

lfuse
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U lfuse:w:\Users\owner\AppData\Local\Temp\backup_lfuse.bin

efuse
avrdude -c arduino -P com9 -p ATMEGA328P -b 19200 -U efuse:w:\Users\owner\AppData\Local\Temp\backup_efuse.bin

The above is available as a downloadable batch-file for those interested:
http://www.hackster.io/rayburne/avr-firmware-duplicator

Somewhere around the forum, I posted the Intel HEX format specification, you can search for it if you wish.

INFORMATION IS INCORRECT IN THE BELOW RESPONSE... Please read further to hiduino response on the correct binding of the LUFA code to Leonardo sketches - Ray
The only concern about overwriting the bootloader, is the USB jack on the Leonardo is reduced to power-only as the LUFA code has been overwritten! I have read articles in other forums (added: these were not Arduino forums!) where crafty Ops have used LUFA libraries to return the USB functionality without using a bootloader. I have personally not experimented in this area, but it seems to be rather straightforward. Whether the LUFA library would present the same interface to the running Arduino code is unknown, but I would doubt it... that is, the API for setting-up and executing USB functionality is likely left to the user's program... but that is just speculation on my part.

Ray

Huh? Loosing the USB bootloader does not eliminate the USB core from the users sketch. Every sketch built with Leonardo or Micro selections already includes a serial USB core. It's a part of the sketch and takes up around 4K of flash. This is what allows user's sketch to do serialUSB communications. It does not rely on the bootloader for any USB communication. You don't need LUFA.

Loosing the USB bootloader does not eliminate the USB core from the users sketch. Every sketch built with Leonardo or Micro selections already includes a serial USB core.

I obviously messed-up that answer!
Thanks for setting things (me) straight.

The obvious take-away here is that, for me, the more I use different uC's and the more I play on different forums - the more I drift away from the Arduino-way of doing things! I will double-check my responses in the future.

Ray

Let me get this straight.

If I succeed at loading in a sketch to a Leonardo with a Duemilanove ISP to act like a mouse, it will overwrite the bootloader but the Leonardo will nonetheless work like a mouse. If so, at this point I will be happy to have it work. Since the bootloader does me no good, it'll be fine by me to dump it.

Now, about the Duemilanove ISP problem...

pentius:
Let me get this straight.

If I succeed at loading in a sketch to a Leonardo with a Duemilanove ISP to act like a mouse, it will overwrite the bootloader but the Leonardo will nonetheless work like a mouse. If so, at this point I will be happy to have it work. Since the bootloader does me no good, it'll be fine by me to dump it.

Now, about the Duemilanove ISP problem...

Yes, that is my understanding too based upon hiduino's input - there is obviously a full LUFA library that gets automatically linked. As for the ArduinoISP, maybe this will shed some light:

Regretfully, I am not Linux user.

Ray

The bootloader or anything on the flash will always be erased in entirety before new flash is loaded via the ICSP header. Like others said, make sure you disable bootloader fuse settings.