Showing posts with label Arduino as ISP. Show all posts
Showing posts with label Arduino as ISP. Show all posts

Saturday, June 4, 2016

Arduin Uno as ISP to burn Bootloader to Mega 2560


To burn bootloader to Arduino MEGA 2560 using Arduino Uno as ISP, connect Uno & MEGA as shown:


PC is connected to Uno.

- Program Uno as ArduinoISP
> Select board of Uno
> Select programmer of AVRISP mkII
> File > Examples > ArduinoISP > ArduinoISP
> Upload

- Now we are going to program MEGA, the Uno act as Arduino as ISP.
> Select board of MEGA
> Select programmer of Arduino as ISP
> Tools > Burn Bootloader

As shown in this video:


Sunday, February 1, 2015

Program standalone breadboard Arduino of ATmega328, using Arduino Uno as ArduinoISP

This post show how to program the ATmega328 on a standalone breadboard Arduino. Using Arduino Uno as Arduino ISP.


Connect your breadboard Arduino to Arduino Uno as shown here:

Extra components needed:
- a 16 MHz crystal
- two 22 picofarad capacitors, between the crystal and GND.
- a 10k resistor, between pin 1 of ATMEGA328P and +5V.
- LED and 1K resistor, used in our Blink example. LED cathode connect to GND, anode connect to the 1K resistor, connect to pin 19 of ATMEGA328P.

The basic steps:
- Connect the breadboard to Arduino Uno as shown above.
- Connect Uno to PC using USB.
- Start Arduino IDE, and program the Arduino Uno as ArduinoISP.
- Switch Tools -> Board to our target board.
- Select Tools -> Programmer -> Arduino as ISP.
- Burn Bootloader.
- Compile and upload your sketch.

I suppose the target board is very similar to Nano board, so I select Board of Arduino Nano, and Processor of ATmega328. It success to burn bootloader, but FAIL to upload sketch, with error of:
avrdude: stk500_getsync() attempt x of 10: not in sync: resp=0x1c

As show in this video:

I have to modify boards.txt to add a new board, copy from nano. The file should be locate in the folder arduino-1.5.8/hardware/arduino/avr/. For safety, make a copy before edit.

Find the entry of nano, copy and rename another board, bba.name=BreadBoard Arduino in my case. Modify the content as:
##############################################################
# Create custom board of BreadBoard Arduino
bba.name=BreadBoard Arduino

bba.upload.tool=avrdude
#bba.upload.protocol=arduino

bba.bootloader.tool=avrdude
bba.bootloader.unlock_bits=0x3F
bba.bootloader.lock_bits=0x0F

bba.build.f_cpu=16000000L
bba.build.board=AVR_NANO
bba.build.core=arduino
bba.build.variant=eightanaloginputs

## BreadBoard Arduino w/ ATmega328
## -------------------------
bba.menu.cpu.atmega328=ATmega328

bba.menu.cpu.atmega328.upload.maximum_size=30720
bba.menu.cpu.atmega328.upload.maximum_data_size=2048
bba.menu.cpu.atmega328.upload.speed=57600

bba.menu.cpu.atmega328.upload.using=arduino:arduinoisp

bba.menu.cpu.atmega328.bootloader.low_fuses=0xFF
bba.menu.cpu.atmega328.bootloader.high_fuses=0xDA
bba.menu.cpu.atmega328.bootloader.extended_fuses=0x05
bba.menu.cpu.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex

bba.menu.cpu.atmega328.build.mcu=atmega328p

##############################################################

Re-start Arduino IDE after boards.txt modified and saved.

This video show how to edit the file boards.txt:

Finally, we can program the ATmega328 on breadboard using Arduino Uno as ISP, and select our custom BreadBoard Arduino, of processor ATmega328 as target.

Check this video:


Saturday, January 31, 2015

Use Arduino Uno as ISP to burn Bootloader on ATmega328

This post show how to use Arduino Uno as "Arduino as ISP", to burn bootloader on a empty ATmega328, marked ATMEGA328P-PU.

Extra components needed:
- a 16 MHz crystal,
- a 10k resistor, and
- two 22 picofarad capacitors.
Steps:


Program your Arduino Uno to be "Arduino as ISP":
- Connect Arduino Uno to PC with USB cable.
- Select Tools -> Port and your current connected Board (Arduino Uno).
- Select File -> Examples of ArduinoISP.
- Compile and upload to your Arduino Uno board.
- Once finished, your Arduino Uno is a "Arduino as ISP" now.

Burn bootloader to Atmega328, using your "Arduino as ISP":
- Select Tools -> Board, it is the board on which you want to burn the bootloader, not your current connect board. I will use Arduino Uno as target to verify my steps and setup later, so I keep using Arduino Uno.
- Select Tools -> Programmer of "Arduino as ISP".
- Select Tools -> Burn Bootloader
- Done.

Verify:
- Disconnect USB cable between Arduino Uno and yout PC.
- Replace the ATmega328 controller on your Arduino Uno with the new burnt ATmega328.
- Connect to PC again and try any example, it should be work as your original Arduino Uno.

Remark:

(I)
I have one chance failed with the error:

Arduino: 1.5.7 (Linux), Board: "Arduino Uno"

avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

It is caused by bad contact, solved by slightly fixing the wires.

(II)
Mention in the tutorial "Using an Arduino as an AVR ISP (In-System Programmer)": Note for the Arduino Uno: you'll need to add a 10 uF capacitor between reset and ground.

In my trial experience, I have no this capacitor added.



Reference:
http://arduino.cc/en/Tutorial/ArduinoToBreadboard
- http://arduino.cc/en/Tutorial/ArduinoISP