Pages

Saturday, 17 May 2014

Burning an Arduino Bootloader with the phenoptix AVR ISP

Background

In yesterday's post about the phenoptix AVR ISP I said I'd share the details of how I used it to install a boot-loader on a blank chip. I was preparing the chip for use in an Arduino clone of my own design. Watch this space for details of that project! For now I'll talk you though on the boot-loader instalation.

You will need
  • a computer running the Arduino IDE version 1.0.5
  • an Arduino board - in my case, an Arduino UNO SMD edition
  • a blank chip - the ATMega386p that I mentioned yesterday
  • the phenopix AVR ISP programmer, as described yesterday
  • the special phenoptix ISP sketch from Github (details below)
Arduino UNO, AVR ISP and ATMega328p

What you need to do

The process has four main stages:
  1. Set up the hardware.
  2. Prepare the Arduino.
  3. Burn (install) the boot-loader.
  4. Test the chip.

Set up the hardware

  1. Carefully insert the chip you want to prepare into the appropriate socked of the phenoptix AVR ISP shield. You may need to straighten the legs of the IC chip before you can insert it.
  2. Carefully plug the pins of the shield into the header sockets of the Arduino.
  3. Connect the Arduino to your computer using a USB cable. You should see the LED on the Arduino light up, and you'll also see some flashing on the LEDs of the shield

Prepare the Arduino

You'll need to upload a special sketch to the Arduino. Don't use the standard ISP sketch from the Arduino examples menu. You must use a sketch that's specific to the phenoptix shield. You can get that sketch from github.

  1. Click on this link.
  2. click on the button marked Raw
  3. Copy the text of the sketch to the clipboard.
  4. Create a new sketch in the Arduino IDE
  5. Paste the text
  6. Save the sketch. I called mine phenopitxISP.
  7. Upload the sketch to the Arduino.

Burn the Bootloader

Up to this point you've used the Arduino IDE in the usual way; you shouldn't need to change the port or board settings from those that you normally use.

For the next stage, however, the Arduino IDE needs to know about the chip you want to prepare, not about the Arduino that you're using as an ISP.

If you're preparing an ATMega328p, as recommended, you will need to change the board setting on the IDE to Arduino Duemilanove w/ ATmega328.

(For an ATMega8, which I also wanted to use, you'd select Arduino NG or earlier w/ ATMega8).

So:

  1. In the IDE, from Tools/Board, select the board type that corresponds to the target chip.
  2. From Tools click on Burn Bootloader.
You should see a Burning Bootloader message appear on the status line at the bottom of the IDE. The lights on the shield will flash for quite some while - a minute or so. Once they stop you should see a message on the IDE status line indicating that the Bootloader has been installed.

Now you're nearly done, with one more phase left.

Testing your chip's bootloader

For this stage you will need to try the chip out in the clone where you plan to use it.

  1. Carefully remove the chip from the panoptix shield.
  2. Insert it into your clone board.
  3. Connect the clone board to the computer running the Arduino IDE. You may need to change the port setting on the IDE if you are using a different USB cable from the one you used with your Arduino.
  4. Using the IDE, install a test sketch on your clone. I edit the standard blink sketch to use delays set to 100 ms. The LED blinks rapidly and I can easily see that I've installed something other than the default version of the sketch on the chip.
Testing the chip in a clone board

Conclusion


The phenoptix board and software have proved easy to use, and I'm very pleased with the result. I'm now well on the way to preparing the set of Arduino clones I needed.