Arduino as programmer/flashing firmware

I thought I might try to flash the Atmegas (Atmega664p & 328p) using Arduino as an ISP.
I’m totally new to these topics.
So before I digg into that, maybe one of the pros can tell me, if this is even possible at all.
I found a few instructions which seem to point in the right direction.
http://arduino.cc/en/Tutorial/ArduinoISP
http://arduino.cc/forum/index.php?topic=64612.0

Has anyone ever done that? Can it be done?

Cheers,
p

So i just read that, i guess this means a simple and plain “no”…

“The main difference between the Shruti-1 and Shruthi-1 bootloaders is that the Shruti-1 is Arduino compatible (update by serial port using the STK500 protocol), while the Shruthi-1 is not.”

Does this also apply to the Digital FX board?

There are two things here, and you must not mix them up:

  • Programming the Shruthi as if it were an Arduino-compatible board, that is to say trying to hook the Shruthi to a serial <-> USB cable and expecting it to talk to the Arduino IDE.
  • Getting an Arduino board to behave like an ISP programmer, and using this to flash an AVR chip on a second board (for example a Shruthi-1 digital board).

The first one is not possible, there are too many hardware differences between the Shruthi digital board and an Arduino (starting by the crystal frequency: 16 MHz for Arduino, 20 MHz for the Shruthi), and the Arduino environment and “way of doing things” is not suitable for a project of the scope of the Shruthi.

The second one is possible indeed (you’ll have to connect the pins 10-13 of the arduino the Shruthi-1 ISP port), and your Arduino will “emulate” a genuine ISP programmer. But I don’t mess much with Arduino stuff these days and can’t help you on how to do that.

Oh, I misunderstood your statement about the Arduino compability!
Great, so I’ll try a bit more and maybe can post a solution.
Not promising anything…

I did that, it’s here: http://mutable-instruments.net/forum/comments.php?DiscussionID=853&page=burning-bootloader-error&Focus=10957
Some quirks tho’.

@ermangaver. I have read the post and you solve the problem. I have an arduino uno in a desk and i’d like to know how to connect to shruthi. Is there a guide or a link?
Marco

@peek: It was ArduinoISP but not the one in the examples (that time Arduino 0022), another one maybe newer, last updated October 2010 by Randall Bohn, that I’ve downloaded somewhere and don’t remember where… sorry. Most likely it’s not really important but in case I can always upload.
About the quirks, well after burning the arduino it worked with avrdude as an avrisp but lost some functionality compared to the actual programmer. Once connected the target micro was recognized fine but programming the bootloader I always got a verification error, pichenettes explained me why in the other thread and shruthi is working :slight_smile:

@zetam:I don’t think there’s a guide specifically for this case, that’s what I did, maybe it can help:
arduino mini and a brand new atm on a breadboard, GND and +5v from arduino to atm (pin 31,30) and the usual crystal clock (20Mhz) connections with the two small condensers to ground (I don’t know if the external clock is really necessary but it doesn’t hurt for sure).
If you’re going to do it directly from the shruthi you can skip this first part because power and clock are already provided.
Then: Arduino SCK => ATM SCK pin8,
ard. MISO => atm MISO pin7,
ard. MOSI => atm MOSI pin6,
ard. RESET => atm RESET pin9.
My guess is that these are the same pins provided to the AVRISP connection in the shruthi’s control board.
Look here: http://arduino.cc/en/Tutorial/ArduinoISP for a general overview, in your arduino and shruthi schematics look for the right pins.
It should work but bottom line is I don’t really know, may be some problems I’m not aware of.

Ciao

Thanks for sharing knowledge. I’ll try. Marco

same goes to me: thanks for the answer! will report back!

You’re both welcome but the information were inaccurate so with further experimenting here is an errata/update.

The software I used was Mega-ISP, namely ArduinoISP.04 still the current version: http://code.google.com/p/mega-isp/downloads/detail?name=ArduinoISP.04.zip.
I was confused by the file’s name in my PC.

I’ve programmed the Midipal MCU in a similar way. It came out that in order to do so the power has to be provided by the programmer, maybe they need to share a common ground.
Anyway, for whatever reason, it didn’t work powering the MCU from the Midipal itself and I always got “0x000000 Yikes! Invalid device signature…” when trying to enter the avrdude’s terminal.

The supplied voltage should be close to 3.3v. Arduino delivers only 5v so I regulated it (sort of) with two random diodes in series obtaining 3.6v at Midipal’s pins named GND and 3.3v.
Close enough because I got the right signature with avrdude, then: C:\\Winavr…>avrdude -B 100 -p m328p -c avrisp -P com3 -b 19200 -e -u -U efuse:w:0xfd:m -U hfuse:w:0xd4:m -U lfuse:w:0xff:m -U lock:w:0x2f:m
and C:\\Winavr…>avrdude -B 1 -p m328p -c avrisp -P com3 -b 19200 -U flash:w:midipal_flash_golden.hex:i -U eeprom:w:midipal_eeprom_golden.hex:i -U lock:w:0x2f:m as per pichenettes.

Being the second time I successfully used Mega-ISP it’s definitely time for me to thanks Randall Bohn for his great job, guess that Timex Sinclair times weren’t for nothing :slight_smile:

Btw Midipal sounds fast, I’m going to test it thoroughly tonight!

Bye