Is Arduino ISP a fully-fledged programmer? [closed]

Hi,

I wanted to flash an at90usbxxx and by using my UNO but it didn’t work out so far. Is it generally possible to flash any AVR microcontroller through an “Arduino ISP”? Or is it somehow limited to MEGAs (and tinys)?

If there is no limitation could it by that those clones behave different?

Thx,
schotter

Please explain what you mean by "didn't work out so far".

Please note that there are two different programmers with similar names. "ArduinoISP" is a dedicated programmer sold by Arduino: https://www.arduino.cc/en/Main/ArduinoISP

"Arduino as ISP" is when you use the ArduinoISP sketch on a standard Arduino board to make it into an ISP. I know it's very confusing that the dedicated programmer name and the sketch name are the same.

I'm assuming you mean "Arduino as ISP"

I haven't used the AT90USB but there was an issue when flashing programs to ATmega2560 using Arduino as ISP where the upload would complete but the program never ran: https://github.com/arduino/Arduino/issues/388 The issue ended up getting muddled up a bit with a similar issue on the USBasp programmer.

I found the issue was solved once I started using AVRDUDE 6.3.0 as included with recent versions of Arduino IDE/Arduino AVR Boards. So if you're using an older version give it a try with the current one to see if that will help.

pert:
I’m assuming you mean “Arduino as ISP”

Yep. Flashing the UNO is simple there is no error or anything a-like, but flashing my target AT90USB is not working…

$> avrdude -P /dev/ttyUSB0 -c arduino -p at90usb1286 -U flash:w:BootloaderCDC.hex:i -b 19200

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x14
avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x01
avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x10
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: stk500_disable(): unknown response=0x12
avrdude done.  Thank you.

A baud rate of 19200 is set in the Arduino as ISP’s source code, so it should work. If I use a higher baud rate it looks more promising.

$> avrdude -P /dev/ttyUSB0 -c arduino -p at90usb1286 -U flash:w:BootloaderCDC.hex:i -b 115200

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: Expected signature for AT90USB1286 is 1E 97 82
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

At least it tells me that I’m not talking to the AT90USB…

Just for completeness. I’m using the latest IDE (1.8.0) and AVRDUDE
avrdude version 6.3, URL: <http://savannah.nongnu.org/projects/avrdude/>so your mentioned issue shouldn’t be the cause for my problem.

schotter: so your mentioned issue shouldn't be the cause for my problem.

I agree, the output you posted shows that issue is unrelated to your problem. Other than that issue, which has been fixed now, the Arduino as ISP seems to be a very capable programmer. I do prefer the USBasp now but I have a dedicated Arduino as ISP board I made that comes out from time to time.

This is the command that the Arduino IDE 1.8.0 generates for Sketch > Upload Using Programmer with Tools > Programmer > Arduino as ISP selected:

avrdude -CC:\Program Files (x86)\arduino-1.8.0\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM21 -b19200 -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_215039/sketch_jan05a.ino.hex:i

So the baud rate should indeed be 19200. You're using "-c arduino" but the IDE command uses "-cstk500v1". Give that a try.

The "arduino" -c flag option is for the arduino bootloader. The ArduinoISP sketch uses the "stk500v1" option.

The reason it "works" when you bump set the baud rate to 115k is because you're not actually talking with the target board, but the bootloader of the Arduino "programmer". AVRDude is trying to reprogram the Uno, not use the Uno as a programmer to reprogram another chip. Notice how the error says "avrdude: Device signature = 0x1e950f (probably m328p)", the chip used in the Uno is an m328p.

I hope that makes sense. I did the best I could, but meta-phrases (reprogramming the programmer) are always hard to work with.

$> avrdude -P /dev/ttyUSB0 -c stk500v1 -p usb1287 -U flash:w:BootloaderCDC.hex:i -b 19200

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9782 (probably usb1287)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "BootloaderCDC.hex"
avrdude: writing flash (131072 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 131072 bytes of flash written
avrdude: verifying flash memory against BootloaderCDC.hex:
avrdude: load data flash data from input file BootloaderCDC.hex:
avrdude: input file BootloaderCDC.hex contains 131072 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 131072 bytes of flash verified

avrdude: safemode: Fuses OK (E:F0, H:9B, L:DE)

avrdude done.  Thank you.

It looks good but those 0.00s confuse me and the programmed application (a bootloader) doesn't seem to respond. But that could still be a failure on my side...

Anyway, you might have already noticed that I'm using linux (ubuntu 16.10). Is there something I need to be aware of? (Permissions are fine)

avrdude: verifying ...
avrdude: 131072 bytes of flash verified

The code is being programmed and read back from the controller properly. Any issue that still exists must be in the code you’re loading. It looks like you’re using the toolchain properly now.

0.00s is just a time value (0 seconds), no needs to worry about it.

It took me a while but I was finally able to flash my target! :) Now the writing and reading times make sense. What did I change? Just the hex file. So I'm happy now and once again for the record: an arduino can be a fully-fledged programmer.

Thank you all once again for helping.

$ avrdude -P /dev/ttyUSB0 -c stk500v1 -p usb1287 -U flash:w:Repetier.ino.hex:i -b 19200 

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9782 (probably usb1287)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "Repetier.ino.hex"
avrdude: writing flash (53518 bytes):

Writing | ################################################## | 100% 50.56s

avrdude: 53518 bytes of flash written
avrdude: verifying flash memory against Repetier.ino.hex:
avrdude: load data flash data from input file Repetier.ino.hex:
avrdude: input file Repetier.ino.hex contains 53518 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 30.16s

avrdude: verifying ...
avrdude: 53518 bytes of flash verified

avrdude: safemode: Fuses OK (E:F0, H:9B, L:DE)

avrdude done.  Thank you.