Mar-14th-2008

Part III – Making Programmer and Target.


Now you know what tools are required for MCU based development. And you are familiar with their uses. Now time to start some real development.To cover these parts you must have some basic knowledge and tools of electroniccircuit fabrication. So now, let us start with the most important tool the programmer.

Making a programmer.

There are many different types of programmers available on the net. The basic difference is their interface with the PC. Basically, there are three types of programmers.
  • Serial Port based
  • Parallel Port based
  • USB Port based.

Of these serial port based and parallel port based programmers are easy to make in minimal cost. However, the parallel port is little bulky as compared to serial port, I prefer serial one. One of the best programmers I have come across is PonyProg(http://www.lancos.com) Serial Device Programmer it is a package of simple and low cost programmer with easy to use GUI software. I have been using it from long time. So here I will teach you to make PonyProg device programmer.

 

Note
As the serials and parallel ports are very old technologies they are fast disappearing from PCs. Most laptops are not having them and even desktops are dropping them. Therefore, its no surprise that your PC does not has serial ports. In this case, you have to use USB AVR programmer. See our shop http://shop.extremeelectronics.co.in it’s available for only Rs320 ($6.00). The future is USB.

 

Things you will need.

S .No

Component

Value

Qty

1 Transistor BC 547 1
2 Zener Diodes 5.1V 2
3 Resistor 3.3K 2
4 Resistor 10K 1
5 Resistor 15K 1
6 DB9 Female connector 1
7 6 Pin Connector 1
8 General purpose PCB, Wires -

DB9 connector is which connects to your PCs serial Port. Its looks like this.

DB9
A DB9 Connector.

And the 6 Pin connector will make you programmer easy to connect/disconnect from the target board. Now assemble the programmer according to the schematic. Note that the pin numbers are marked on the DB9 connector itself.

avr programmer schematic

Schematic (Download)

avr programmer photo

My Prototype

avr programmer schematic

Finished with protective cover.

Now your programmer is ready !!! Note that the programmer has 6 pin output with following signals
  • RESET(1)
  • MOSI(2)
  • MISO(3)
  • SCK(4)
  • GROUND(5)
  • NOT-CONNECTED(6)
The 2,3,4 are for data transfer. In addition, there is an ISP connector in the target having same signals and these must be connected to matching signals of programmer. So take care while installing the connectors. The next thing you need is a basic microcontroller circuit. Ya it will have a MCU and some basic circuitry to run it. Let us see how to do that.

A basic target system

To design a basic target capable of ISP for AVR series of microcontrollers you need to have
  • Power supply for MCU.
  • Crystal Oscillator (for CPU clock)(optional)
  • Proper signal at Reset.
  • ISP connector
  • Aref For ADC.(optional)

Power Supply

Most of the MCUs available works off a 5v power supply except their low voltage versions. They need a clean and stable 5V power supply. This is achieved using the 7805 voltage regulator IC. Also the MCUs have a separate power supply for its analog parts to increase their accuracy and reduce noise. This must not be connected directly with the digital supply but connected via an LC network with the Vcc. You need not care this if you are not going to use the ADC(analog to digital converter) . You can conned AGND to GND and AVcc to Vcc.

Crystal Oscillator

This is like a heart for MCU. It provides a beat that makes the MCU take steps. In AVR series of MCU each clock pulse executes one instruction (some instruction needs more than one clock cycle to execute) for accurate timing in you application you need a crystal oscillator. It provides a clean, voltage and temperature independent clock source. Generally,you can use crystals from 1 MHz to 16 MHz on most AVRs as required for your project. Actually the AVR has a internal oscillator also !!! that means this can be omitted. But one limitation is there the internal oscillator provides maximum frequency of 1 MHz if that’s enough for you, then its ok else you have to go for an external crystal of say 12Mhz or 16 Mhz.

Reset Signal.

This signal must be high (5V) for normal operation and can be pulled low to reset the device. You can connect a switch to reset the device from it.

ISP Connector

For flexibility you should have a nice connector for is so that you can connected/disconnect a programmer easily for programming. The MCU has 3 PINs for the downloading a program in its flash namely • MOSI – Master Out Slave In • MISO – Master In Slave Out • SCK – Serial Clock That’s for date transfer and you also need to connect RESET PIN of MCU to the ISP Connector so that programmer can put it in programming mode. One more pin should be their that is the common or ground of the two system. So all you need is a 5 PIN connector for programming. However, our AVR programmer has one additional PIN that is not connected to any thing so you need a 6 PIN connector in your target system.

Aref

This pin must be provided with the reference voltage for the inbuilt Analog to digital convertor. Also this pin is suggest by Atmel to be decoupled with a 0.1uF capacitor. I am providing this in my schematic to be complete. You can omit this if you are not going to use ADC for now. More on these on tutorial on ADC. A basic target schematic

basic atmega8 development board

Basic Target for ATmega8 MCU.(Download)

 

Components Required.

S.No

Name

Component

Value

Qty

1 IC1 Microcontroller ATmega8 1
2 IC2 7805 voltage regulator 1
3 C1,C2 Electrolytic Capacitors 100uF 1
4 C6 1uf 1
5 R1 Resistor 330 1
6 R2 1K 1
7 C3,C7,C8 Ceramic Disk Type capacitor 0.1uF 3
8 C4,C5 22pF 2
9 LED1 LED 1
10 D1 Diode 1N4007 1
11 Q1 Crystal Oscillator 12MHz 1
12 J1 Power Jack Connector 1
13 6 PIN Connector 1
14 General Purpose PCBs, wire etc

You can make the above in general purpose PCBs (Vero board) or in a Breadboard. After making it, double check the connections. Use a socket for the MCU so that it can be easily removable. Then check the voltage levels at the supply pins in the socket with multi-meter. It should be very close to 5 volts.

See Also

Download PDF version| Get Adobe ReaderFree !!!

Whats next
Now you have the basic hardware tools in the next part we will be downloading and installing software tools.WinAVR – A free C compiler for AVRsAVR Studio – The IDE for AVRs from there manufacturer. This will be our front-end for the above compilerPonyprog – A free serial device programmer.


33 Responses to “Part III – Making Programmer and Target.”

  1. 1
    Home Made AVR Devboard | eXtreme Electronics Says:

    [...] let’s do it! I have described the basic connections required by any AVR MCU in Part III of my AVR tutorial series so I am jumping right to the [...]

  2. 2
    K.Asokan Says:

    Thank you for ur simple circuit solution. I will try out then come back to you.

  3. 3
    Avinash Says:

    Thanks K.Asokan

  4. 4
    PWM Signal Generation using AVR Timers | eXtreme Electronics Says:

    [...] can program the chip using this simple avr programmer or buy a USB Programmer. addthis_url = [...]

  5. 5
    floor jack Says:

    It’s the first time I commented here and I must say that you provide genuine, and quality information for bloggers! Great job.
    p.s. You have an awesome template for your blog. Where have you got it from?

  6. 6
    lorie Says:

    Do you guys have a recommendation section, i’d like to suggest some stuff

  7. 7
    Avinash Says:

    @Lorie,

    Sure you can mail me any recommendations
    avinash@eXtremeElectronics.co.in

  8. 8
    kapil Says:

    Hi Avinash,
    I tried above serial programmer but it not work properly with pony prog.

    I want to use this programmer with CodeVision AVR or AVRStudio for direct programming with these IDE what settings required for that.

    Good Work,
    Waiting for new tutorials,
    Kapil

  9. 9
    DIY AVR Programmers | Embedded Says:

    [...] For complete info check out the webpage:AVR Serial programmer from Extremeelectronics.co.in [...]

  10. 10
    sanjay Says:

    hi avinash
    does it work with all the avr like atmega16 , atmega32 ?

  11. 11
    Avinash Says:

    YES it works with popular AVRs like ATmega16 , ATmega32 and a dozen others too !!!

  12. 12
    sanjay Says:

    hi avinash
    when i use it with ponyprog , it is not passing probe test in interface setup

  13. 13
    utkarsh Says:

    avinash actually i am completely new to this topic that’s why i am getting a bit confused. i have following question for you to answer.

    what is an adapter?
    in pony prog site they gave different kinds of adpter for different kind of ics of atmel

    which site should i visit so that i can learn about these things from scratch?
    plz reply soon. soon for the big blog:)

  14. 14
    cahcyber Says:

    Dear,

    I’ve found from another reference, that ISP for ATMEGA series is not working with MOSI MISO, but will working by using Rx Tx pin (PE0 and PE1 on ATMEGA128).
    So what is the solution for creating the ISP schematic?

    Thanks.

  15. 15
    sanchit Says:

    hi avinash,
    great tutorials.. very resourceful.

    i used the serial isp, avrstudio and ponyprog as indicated by you for serial programming. Moreover i used a usb to serial converter for serial programming from the usb port of my laptop.

    The codes are burnt successfully but the verification of the code done by ponyprog while writing takes about an hour to complete..

    is this normal?
    if not then can you suggest what might be the problem?
    please help..

  16. 16
    Avinash Says:

    Moreover i used a usb to serial converter for serial programming from the usb port of my laptop.

    The codes are burnt successfully but the verification of the code done by ponyprog while writing takes about an hour to complete..

    A very common problem. USB TO SERIAL CONVERTERS CANNOT BE USED WITH THESE TYPE OF PROGRAMMERS !!! SORRY :(

    Get a direct USB Burner from here :)
    http://shop.extremeelectronics.co.in/product_info.php?cPath=21&products_id=28

    We also sell the USB to serial convertors here and WE CLEARLY MENTION THAT IT WON’T BE USED THAT WAY !!!
    http://shop.extremeelectronics.co.in/product_info.php?cPath=26&products_id=34

  17. 17
    Kapil Says:

    Hi ! avinash, thanks for excellent tutorials. i am using ATMEGA32 and ATMEGA8535 microcontroller.
    presently i use internal 1MHz clock , as it is factory preset, but i want to use 12 MHZ external Crystal, what is necessary settings in ponyprog.
    I have 3 new ATMEGA32 and due to some wrong settings they are not working how can i use them again.

    Please reply me. Waiting for your reply.
    thank you.

  18. 18
    kapil Says:

    Hi avinash
    today i done same thing with ATMega8535 when i accessing the port B for LED and then connected with LED ant programmed with PONyprog the suddenly all led’s glow then error displayed in ponyprog software “device missing or unknown device(-24)”. please this is my fourth Microcontroller.

    how can i make them usable.

    thanks in advance.

    waiting for your reply.

  19. 19
    Avinash Says:

    @kapil see the forum.

  20. 20
    Avr serial port Says:

    [...] Part III – Making Programmer and Target. | eXtreme Electronics 14 Mar 2008 … Of these serial port based and parallel port based programmers are …. For complete info check out the webpage:AVR Serial programmer from … extremeelectronics.co.in/avr…/part-iii-making-programmer-and-target/ – [...]

  21. 21
    John Says:

    I have tried Parallel Port AVR programmer but I failed. I would ask that ir really works? Don’t mean it any other way. I want to know it for my self esteem.

  22. 22
    aaron Says:

    hey im going to build this but I have seen references of this same schematic but without a transistor, I would like to know if its absolutely necessary want to program a atmega8

  23. 23
    akhil Says:

    i tried avr insystem programmer
    i using the following config
    atmega8, 12 Mhz crystal osc,
    its always giving “device missing -24 ” error
    were could be the problem. plz reply

  24. 24
    Zvonimir Cicak Says:

    i’m trying to connect my progammer with ponyprog, but it doesn’t work…

    i made a PCB, it is on this link – http://img43.imageshack.us/img43/2571/plocica.jpg

    Can U please tell me if I made any mistake or what, because it doesn’t work…

    P.S.
    Do I have to make ” A basic target system” and connect it to be able to program or I can do that only with this programmer????

  25. 25
    Zvonimir Cicak Says:

    Can you please tell me what is wrong with my programmer, because it won’t work…

    There is picture, and please tell me if I did something wrong in PCB or what…

    Please…

    P.S.
    Do I need to have DEVBoard to be able to program Atmega8 or just having programmer is enogh…

  26. 26
    Avinash Says:

    @Cicak

    i’m trying to connect my progammer with ponyprog, but it doesn’t work… [ clarify "connect" what do u mean by it]

    Can U please tell me if I made any mistake or what, because it doesn’t work…

    P.S.
    Do I have to make ” A basic target system” and connect it to be able to program or I can do that only with this programmer????
    [How Can u program ONLY with this Programmer ???]

  27. 27
    Zvonimir Cicak Says:

    “How Can u program ONLY with this Programmer ???”

    Well, I’m new in programming Atmel, I used to program PIC microcontrollers, and for PIC I found few JDM programmers that are very simple, so I thought that this is similar but just for atmel…

    I didn’t know that I have to make devboard also and connect it with programmer to be able to program atmega8…

  28. 28
    Zvonimir Cicak Says:

    Can You please send Your PCB layout of devboard to email, so I can make one at home…

  29. 29
    Shuvamay Says:

    Can I connect a serial programmer to USB port using USB to serial converter

  30. 30
    Sudipto Says:

    I have made this one to program an ATMEGA8L. Using ponyprog read operation is successfully done.But when I tried to write, program is verified after writing and at last “Write failed” is shown. then I have read it again but it shown 00 as a hole. Also the read write operation is very slow.can u help me to make a successful and faster read write operation?

  31. 31
    Sujoy Roy Says:

    Does this is the exact Programmer found in the shop of extreme electronics.

  32. 32
    sam Says:

    Can I monitor clock frequency at pins 9 or 10 of ATMEGA8?.
    I have tried to probe with a osciloscope but could not see ant trace. How to find that The chip is runnung at the crystal frequency?

  33. 33
    Biswarup Says:

    Hello Avinash,

    Thanks for the informative tutorials. They should be really helpful for any newbie.

    However, In this Serial programmer circuit, I think there should be a connection form the +5V supply of the uC to the collector of the BC547.

    please refer to this circuit: http://electronics-diy.com/avr_programmer.php
    Hope this helps..

    In appreciation
    Biswarup Mukherjee

Leave a Reply

Comments

    • Del Chann: Hello is it possible to use this board to interface with a smoke sensor, motion sensor,...
    • Elijah Nicolia: May I consider part regarding your main guide to my personal site
    • Tifany Wiebusch: I go along with you actually, I believe! Might this become doable for you to have...
    • Sinopteek: When i try to run this software under OpenSuSe 11.2 (x64), i’ll have next error:...
    • kapil: @Dhananjay I used that its working and it can programme 3 to 4 times after that there is a...
    • Dhananjay: Sir, At present I am using progisp to flash AT89SXX with usbasp(with modified firmware)....
    • Shashi Jain: plz dont fight wid each other…k i accept my fault… neway m not a rich person...

Video