Turn Arduino into an ISP programmer

Hello

A couple of weeks ago my AVR-ISP programmer died and this motivated me to try to turn an Arduino board into an ISP programmer.
I used software written by Guido Socher and adapted it to the arduino board

it's very alpha at the moment but this would allow people to program the bootloader to as many avr chips as they like for free....

check it out here http://tinker.it/now/2006/12/04/turn-arduino-into-an-avr-isp-programmer/

let me know if it works for you

massimo

nice one massimo. that's the one nicolas and i were talking to mellis about. glad you picked it up :wink:
did you manage to make it work on the 168? that's what we're really interested in.

hello

yes dave forwarded me nicholas' email me just after I got it working..

i was able to program the 168 but using avr studio... (thanks to parallels for mac..) but avr dude gives so many confusing error messages with it that it made me lose a week...

I was in a small city in germany for 2 weeks when my programmer died and in one week i've built every possible programmer out there....

It needs more testing and I have to send a bottle of wine to Guido :slight_smile:

massimo

I don't know much about programming but does this mean I can program a ATmega chip with a ICSP using a Arduino board? Also when is that Arduino Bluetooth board coming out?

Yes

I was using it to program the Bootloader on the BT boards.

the instructions are not super simple yet, i'm working on writing a better tutorial.

The board is in production now, I'll have an exact date this week. It took us a lot of time because making it easy to use is not so simple... now you can download the code via bluetooth which is quite cool :slight_smile:

massimo

glad we're pretty much getting to the same result.
4 questions:

  • i saw you set a 115.2 Kbaud rate on the uart, is that causing a problem with a 16Mhz crystal (according to p162 of m8 datasheet, that's a 3.5% error)?
  • did you manage to flash the bootloader on m168 with the 16MHz crystal and avr studio?
  • i saw in test.ccommand that you're using uisp to flash with stk500v2, did you manage to flash the m168 with uisp and stk500v2 on the 16Mhz crystal?
  • are you planning to work on the bit bang (as it is better just to do it one time :wink: ) ?

Regards

Nicolas

Hello

some super fast replies

115.2k is what avr studio expects, to change that is a bit annoying so i left it like that and I can communicate with the board no prob
(if you connect with a terminal emulator you can see the programmer responding with a prompt to change the version number reported)

i can write to the chip but it's not 100% reliable yet

test.command is actually wrong because uisp doesn't support the stv500v2. I made another script that uses avrdude
something like this
avrdude -p m168 -b 115200 -c stk500v2 -P /dev/cu.usbserial-A4000QpS -e -U flash:w:bl.hex
but avrdude gives strange errors while handling the fuses.. i've wasted days of work because of that.....

I did compile the bitbang by recompiling libusb and the special version of uisp that guido made but i never actually tested it
because i thought that getting the arduino board to be an ISP itself was more interesting
also the bitbanging is slow (as stated on the website)

from here to a completely robust solution there is still work to do... but for now it was good enough for me. now I have to concentrate on the BT and Ethernet boards :slight_smile:

massimo

the place where to change the port in load.command is “dserial=$PORT”, right? i just put a number instead of $PORT, right?
to launch load.command with windows xp do i use the command prompt?
thanks and regards.
are you sure about the reset pin on 10? isn't it 1 instead?

Has anyone accomplished this on Mac OS X?

I've got the boards hooked up correctly and the stk500 firmware uploaded correctly to the first Arduino. However when I run the burn command (after the correct (I believe)) modifications I got a constant Device Not Responding type of message.. Actually I think it's Programmer Not Responding.

I don't know if that's because the icsp isn't working or if there is an incompatibility between the stk500 firmware and mac os x?

I would really like to get a atmega168 burned w/ the 168 flavor arduino bootloader... The extra space would be very welcome. However, like I said... it's just not working.

Any insight or anybody being successful at this would be great to hear. It seems clear, but something just isn't meshing.

I've also tried avrdude 5.2 as per a suggestion I found online - as it was supposed to be more compatible w/ os x.. but no dice there either.

Anyway, thanks for any help rendered, I appreciate it.

-Jeremy

I had the same non-result as you - I did get the programmer firmware downloaded, but any time I tried to use it as a programmer I got a "programmer not responding" message. Mac OS X 10.4.8 PPC.

I did talk to the programmer via rs232 and it seemed to go to some sort of prompt when I hit return, but it never really did anything. It looks like this happened when I tried to program with it, judging by the way the TX and RX LEDs blinked.

-j

hmm... Frustrating. I have a project I'd like to pursue that includes both i2c and an LCD which fills the atmega8 just by including libraries.. ergh.

Was the reason for not being able to burn bootloaders w/ the arduino board a monetary or technical decision?

-jf

You may need to remove the built-in LED connected to pin 13 that's on the Arduino board you're using a programmer. I think it interferes with the SPI lines that are used for programming. The next revision of the Arduino board should fix this problem.

I had already worked around the LED problem (I moved a resistor instead of removing the LED). Besides that, I was taking that data off the ICSP header instead of the standard arduino outputs.

-j

What software are you using on the computer? The Arduino environment won't work with it, as it uses uisp which only support stk500, not stk500v2 which is used by the firmware. We should be switching to avrdude soon, which supports stk500v2. In the meantime, you'll need to use it from the command line, along the lines Massimo suggested.

I was using avrdude at the command line. I failed to take notes, so I'm about to try the whole thing over on my desktop machine (was working on the laptop before) and may even switch to an arduino serial that I built if the NG fails.

My errors were avrdude telling me the programmer wasn't responding, so I don't think the NG hardware was the issue. I suspect that I don't have an appropriate avrdude.conf entry, but I can't remember what made me think that (it was late at night, and like I said I failed to take notes).

-j

I've never got it to work myself, so I'm not sure I can help. It's possible that a "programmer not responding" message is a hardware problem; I think it could happen if the SPI between the board and the chip being programmed fails. Maybe Massimo has more ideas what the problem is?

the instructions are not super simple yet, i'm working on writing a better tutorial.

Any progress on this? :slight_smile:

It's probably an obvious oversight on my part, but what should one change the port to in "load.command" for a PC COM port? Also, can one burn the regular Arduino firmware back to the chip after programming others?

Thanks!

hi all -

it would really be great if people could use their arduinos as avr isp programmers! it seems like it should be possible, so i'm very surprised that there doesn't seem to be a working method, since it would be a popular feature of the arduino.

i've tried a few different "how-to's" that claim to be able to do this, but it seems like none of them actually work, at least for what i want (program atmega168, along with fuse bits).

i tried this one out but couldn't get it to work either, same kind of errors as the others reported. it seems (although i'm not sure) that the avrusb500.hex file gets loaded into my arduino diecimila with:

cd /Applications/arduino-0011/hardware/tools/avr/bin
cp ~/Desktop/avrusb500-1.5-arduino/avrusb500.hex .
./avrdude -C ../etc/avrdude.conf -p m168 -c avrisp -b 19200 -P /dev/cu.usbserial-A4001lXM -U flash:w:avrusb500.hex

(need to press the reset button just before hitting enter on the last command).

[edit: does this even work though? i was just reading about the diecimila's reset behaviour, seems it goes to the sketch almost immediately after pressing reset - so maybe i'm not even actually uploading it, even though avrdude says so?]

but then i try to upload a compiled "blink" sketch to my target (atmega168 with internal 8MHz clock, sketch compiled with lillypad arduino settings) using this (without pressing reset):

cp /tmp/build*/Blink.hex .
./avrdude -C ../etc/avrdude.conf -p m168 -c avrisp2 -b 115200 -P /dev/tty.usbserial-A4001lXM -U flash:w:Blink.hex -U lfuse:w:0xE2:m -U hfuse:w:0xDF:m

...all i get is:

avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout

do i need to recompile the avrusb500.hex for the atmega168? i'm not quite sure of the magic spell needed to do that. or, should i stop wasting my time and buy a real programmer?

thanks... jm

the water runs the easiest way. i've stopped fooling with parallel programmers and turning arduino in isp programmers and bought a avrisp mkII. works on mac, albeit very slow. 10 minutes to completion! but it works. as soon as the deadline i'm in right going to is passed, i will investigate further in the arduino as programmer stuff. i've resoldered the 16Mhz xtal and stored the 3.6468 xtal for later retrieval.

lost a few days fiddling with pc on windows, braking working arduino's and searching the web for clues...

macsimski: if your AVRISP mkII takes 10 minutes to burn a bootloader, it's probably configured to have a very slow communication speed. You can reconfigure it with with AVR Studio on Windows (and possibly some other way as well). Apparently they come from the factory with a random default speed.