Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

Moving from PonyProg to AvrDude AVR programmer without pain

Probably PonyProg is one of the most popular programming software among AVR microcontroller developers. And this is OK as it is good software with a very intuitive interface and support many chips like Atmel AVR, Microchip PIC micro, I2C, Microwire, SPI EEPROM. It works well with AVR ISP adapter which is easy to build. This is an ideal tool for low budget projects.

The only thing what I don like with it, that I need to do additional steps to program AVR chip:

  • Compile project with WinAVR;
  • Open hex file with PonyProg;
  • Programm the chip;

Then I thought- what if I could build and program the AVR chip with a single button press. This is where AVRDUDE comes in.

AVRDUDE is a FreeBSD Unix program for programming Atmel’s AVR CPU’s. It can program the Flash and EEPROM and were supported by the serial programming protocol; it can program fuse and lock bits. AVRDUDE also supplies a direct instruction mode allowing one to issue any programming instruction to the AVR chip regardless of whether AVRDUDE implements that specific feature of a particular chip. AVRDUDE can be used as a command-line tool (convenient to use with makefiles) or interactively via terminal. It can program microcontroller’s flash, EEPROM, fuse bits, modify individual bits, explore memory contents, etc. For additional information refer to AVRDUDE manual.

Let’s try to set up AVRDUDE to work in Windows environment. As I am using Windows XP, I need to set up port drivers to enable AVRDUDE direct access to ports. For this in an AVRDUDE package is a handy tool included: install_giveio.bat which copies needed driver files to the windows directory. For this just run:

C:\WinAVR\bin>install_giveio.bat
Copying the driver to the windows directory
target file: C:\WINDOWS\giveio.sys
1 file(s) copied.
Remove a running service if needed...
Installing Windows NT/2k/XP driver: giveio
installing giveio from C:\WINDOWS\giveio.sys... ok.
starting giveio... ok.
set start type of giveio to auto... ok.
Success

After this installation you can check driver status by writing command:

C:\WinAVR\bin>status_giveio.bat
status of giveio:
Type: [0x01] Kernel driver.
Start Type: [0x02] Automatic
Error Control: [0x01] NORMAL: Display a message box.
Binary path: \??\C:\WINDOWS\giveio.sys
Load order grp:
Dependencies:
Start Name:
ok.

When port drivers are set up, then we can do couple fun tests with your AVR microcontroller via same AVR ISP cable that we use with PonyProg. No, any changes are needed as this programmer is supported by AVRDUDE.

Just open a console window and write command line:

C:\WinAVR\bi>avrdude -p m8 -c pony-stk200 -e -U flash:w:demo.hex

….

This command-line programs your Atmega8 flash memory with demo.hex contents using simple AVR ISP adapter.

Well, let’s make this happen when building WinAVR project in Programmers Notepad editor. For this, we need to prepare Makefile. The easiest way to do this is to use Mfile utility, where you can select programmer type and port:

Mfile_Avrdude_setting1.PNG

You should have the following results in the makefile:

Mfile_Avrdude_setting2.PNG

That’s it. Now is a fun part. If you have your project ready to run, select Program command from Tools menu in PN:

AVRDUDE_programming.PNG

This command builds your project and automatically sends a hex file to AVR microcontroller automatically. In the future, there will be more real-world examples of how this is working. Don’t afraid to read the documentation – all is written there 😉

Good luck.

3 Comments:

  1. Hi,
    Would you please email the AVRDude(compiled version) program for me?

    Best regards

  2. Pingback: Avr programmer

  3. @Aban: you have to download winavr. AVRdude is supplied with it. (it’s in the bin folder)

Leave a Reply