For this I used
Prerequsites:
- Ubuntu 10.04LTS machine or VM
- Install arduino gui from arduino.cc. I downloaded arduino v22 so I installed it in ~/arduino-0022
- Download and unzip Mega-ISP sketch from http://code.google.com/p/mega-isp/downloads/list. I downloaded version .04 (latest at the time of writing)
- A fully functional arduino board setup will be required. This will act as the ISP programmer.
- Target arduino board with blank ATMega8 chip.
Here is the procedure:
- Wire up the arduino boards using the instructions at: http://arduino.cc/en/Tutorial/ArduinoISP. If you have a non standard pinout arduino clone, connect following pins of source to target
Source Arduino Pin Target Arduino Pin 13 13 12 12 11 11 10 RST +5v +5v gnd gnd - Install avrdude on the operating system:
sudo apt-get install avrdude
3. Load your Programmer Arduino baord with Mega-ISP sketch. Make sure that sketch is written properly to the board.
4. copy ATMegaboot from arduino installation (in my case ~/arduino-0022)
cp ~/arduino-0022/hardware/arduino/bootloaders/atmega8/ATmegaBOOT.hex ./
5. Copy and paste the following code on your linux shell prompt. This will create a file flash.sh and will make it executable:
echo '#!/bin/bash
cmd="`which avrdude`"
chip="atmega8"
options="avrdude -p $chip -c avrisp -P /dev/ttyUSB0 -b 19200"
# Erase chip write lock and fuses
$cmd $options -e -U lock:w:0x3f:m -U lfuse:w:0xdf:m -U hfuse:w:0xca:m
# Upload bootloader code
$cmd $options -D -U flash:w:ATmegaBOOT.hex:i
# Lock boot section
$cmd $options -U lock:w:0x0f:m
' > flash.sh; chmod u+x flash.sh
6. Check your wiring again and execute
./flash.sh
7. If things go well you will see successful avrdude messages and your Mega8 will be programmed with arduino boot. This procedure can be used to flash other hex files as well.
I have built a small ISP pcb that I plug my arduino into if I need ISP capabilities to program other AVRs, just use the right AVR device with avrdude options.

0 comments:
Post a Comment