Using AVR Dragon To Program AVR Chips

by Noel on March 6, 2012


In an earlier post, I wrote about AVR programming using Mac OSX. The last part in that procedure was the compiling of the C code to a HEX file.

Now how do you get the HEX file and upload it to your AVR microprocessor? You will need some sort of a programmer to do that.

Today I’m using one of the top choices for programming AVR chips, and that is the AVR Dragon. Thanks to Element14 for sending an AVR dragon for review.

What I like about the AVR dragon is that you can program your AVR microprocessor using several methods such as JTAG, HVP, PDI, or ICSP. It also allows debugging of all AVRs via JTAG, PDI, or DebugWire. Pretty impressive indeed.

In this article, I would try and discuss more about ICSP programming. ICSP stands for in-circuit serial programming. This means even if your AVR is already soldered on your board, as long as you’ve provided an ICSP connector for programming, you can upload your HEX files to your AVR chip.

How you do “wire” an ICSP connector, here’s a diagram I found from upvector.com


photo credit: upvector.com

Once you get your AVR dragon, there will be provisions for putting in some IC sockets where you can plug-in and program your AVR chips. In my case, I added a ZIF socket so I can put in my AVRs with ease. There are also provisions for male or female headers. I just used male headers instead.

Before actually burning your HEX files, here’s where a lot of newbies like me made a mistake. Unlike PIC where perhaps you use a pickit2 for programming, you need to provide power to your AVR chip in order for you to successfully program your AVR microcontroller. In PIC, you don’t have to. The power is provided by pickit.

Now of to the actual burning of your HEX files. You will need AVRdude to do this. You can invoke AVRdude via the command line and just pass on certain parameters like the hex file you wanted to “burn”.

In my example, here’s what I used.


avrdude -p m328p -c dragon_isp -P usb -e -U flash:w:Blink.cpp.hex

Now let’s discuss a bit about those parameters passed on to avrdude.

-c This parameter is where you specify the programmer you will use. In our case we’ll be using “dragon_isp”.

-p means the part number/code of your AVR processor. In my case I’m using m328p as I’m using Atmega328P.

To list the available part “codes”. You can type this at the command line.

avrdude -c dragon_isp

and it will show a list of AVR chips and the corresponding code for that.

-P usb tells avr dude to look for our AVR programmer in one of the USB ports.

-e is for performing chip erase

-U is for specifying the memory type, and the filename. The syntax is this

-U :r|w|v:[:format]

So here’s the screenshot of me burning the arduino bootloader to my Atmega328P chip using AVR dragon.

Here’s a photo of the setup

I’ve created a rig where I can easily burn bootloaders on Atmega328 chips. There’s an ISP connector and I have a 6pin cable connector to connect my rig to my AVR dragon.

Products Used:

AVR Dragon USA (via newark) – $49

AVR Dragon (Element14 Philippines) – PHP3,350

{ 0 comments }

Code Sourcery Installation In Ubuntu

by Noel on February 23, 2012

1. Go to Code Sourcery and download the lite version (FREE)

https://sourcery.mentor.com/sgpp/lite/arm/portal/subscription?@template=lite

2. Select ARM Processor

3. Choose Which Installer you need

I’ll choose the Linux installer

4. Run the installer

You may need to change the permission of the file and make it executable.

In my Ubuntu, my /bin/sh is symbolically linked to dash. Unfortunately, this wasn’t supported by the installer so
I have to do


cd /bin
sudo mv sh shold
sudo ln -s bash sh

5. Click Next

6. Click I access the terms and conditions and hit “Next”

7. Click “Next” again in the important information

8. Choose Typical and click “Next”

9. In this next step it will ask for the installation directory.
Now I would like to install this in /usr/share/CodeSourcery so I need to prepare the directory first and make sure I have permissions to that directory

In the terminal type this


sudo mkdir /usr/share/CodeSourcery
sudo chown . /usr/share/CodeSourcery

In my case, my username in my linux box is “noel” so the exact command I typed is

sudo chown noel.noel /usr/share/CodeSourcery

10. Check the install folder if correct

11. Select Modify Path – click “Next”

12. Choose Link Folder – just click “Next”

13. Pre-Installation Summary – click “Install”

14. Code Sourcery will start installing

15. And when you see this, you’re done.

16. Next is to add it to my path. In my case I’ll edit my .bashrc file

In your home directory type


nano .bashrc

Or you can use ‘gedit .bashrc’ if you want

Add the PATH to the bin directory of the code sourcery. In this case it is

/usr/share/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin

Save your changes.

17. Open another terminal window

Your new .bashrc file should take effect in this new terminal window.

Type


echo $PATH

and you should see your new PATH environment variable with the added CodeSourcery directory.

now let’s test if you can access the compiler. Type


arm-none-eabi-gcc --version

you should see something like this

Congratulations! Now you have an ARM tool chain installed in your Linux Machine.

{ 0 comments }

Programming Gizduino on a Mac OS X

February 22, 2012

I just got a macbook pro and I would want to try and do arduino programming on this machine. For now, I’ll zoom in and discuss more about Gizduino (an arduino clone). One thing quite different is that this doesn’t use an FTDI chip. It uses another chip called PL2303 (Prolific). So in order for [...]

Read the full article →

AVR Programming Using Mac OS X

February 15, 2012

Go to http://www.obdev.at/products/crosspack/download.html and download CrossPack for AVR development Install the DMG file double click the icon to run the installation Open a Terminal and type “avrdude” in the command line. You should see something like this. Congratulations! You’re now ready for AVR programming. Now let’s try and compile a demo program. Open a terminal [...]

Read the full article →

Introduction to TI MSP430 Launchpad

January 2, 2012

A friend of mine (Keith) made a really nice Introduction to the TI MSP430 launchpad. Instead of me making my own, I’ld rather just post his nice Intro. Thanks Keith! What is TI MSP430? “The MSP430 is a mixed-signal microcontroller family from Texas Instruments. Built around a 16-bit CPU, the MSP430 is designed for low [...]

Read the full article →

AVR Butterfly Review – A Cheap AVR Dev Board

December 9, 2011

I just got my AVR Butterly from Element14. I’ve heard about AVR butterfly before but I started with AVR programming using Arduino. I guess a lot of people started with arduino because it’s easy to use. A typical arduino is like $30. What’s nice about the AVR butterfly is that it only costs around $20 [...]

Read the full article →

Unboxing Of MSP430 Launchpad and AVR Butterfly

December 4, 2011

I was fortunate enough to be contacted by Ryan Gibson of Farnell (note: they’re also knowns as Element14) and was asked if I could do a review of some of their products. I picked 2 items in their inventory. One is the MSP430 launchpad and the other is the AVR Butterly. Here’s a photo of [...]

Read the full article →

Quick Start Guide for EFM32 Gecko Starter Kit

December 1, 2011

1. Install Simplicity Studio from (http://www.energymicro.com/downloads/) 2. Its been more than an hour… waiting patiently….(transfer rate is only 25kb/sec). 3. Install IAR 4. Get License. You need to fill up their form and then you’ll receive an email with the license keys. 5. Click setup IAR 6. Installation Finished. Finally! 5. Fire up the IAR [...]

Read the full article →

Unboxing the EFM32 Gecko Starter Kit

November 25, 2011

So I got my package from EnergyMicro.com. They’ve sent me an EFM32 Gecko Starter Kit. Honestly, I never heard this one before. I’m aware of ARM processors from Texas Instruments, ST, and a few others. But now I get to play with their Gecko Starter Kit. For those of you who haven’t heard of energy [...]

Read the full article →

PCB Manufacturing Video

November 5, 2011

I found this good video showing the process of multi layer PCB in a fabrication house. I didn’t know it involves so many steps just to produce a PCB. Great info. Step 01- Introduction – Eurocircuits Educational movies – making a PCB Step2 – Front End Tool Data Preparation Step 3 – Preparing the Photo [...]

Read the full article →