Paths

The Atmega32 Programmer.

Posted in Final Year Project by Rakesh on January 18, 2007

In the wake of this final year project presentation on 22nd January, we sort of started things up with the project. The first thing was the brain of our sensor nodes – the micro-controller – which needed to be get done with. We chose Atmel’s Atmega32 uC for following “good” reasons:

1. Atmega32 puts up a lot of features right on the uC itself. Things like ADC, Internal Oscillator (1 MHz), 32 KB flash memory etc. are built on the chip and thus saving a considerable amount of effort integrating components and it is available for Rs. 200/- from Sigma Electronics in Saddar, Karachi.

2. It works on the AVR architecture. That is to say, it gives 1 MIPS on 1 MHz clock and correspondingly 16 MIPS on 16 MHz clock. While the 89C52 gives 1 MIPS for 4 MHz.

3. The programming help is available in abundance. There is also a popular C-syntax version of programming tools (Open Source: GCC) which saves from getting in detailed assembly coding.

4. Programmers are easily available and can be built by yourself using PC’s parallel port and a software called PonyProg. The schematic is provided below. We have successfully implemented a programmer today and it DOES work finally. :-)

avr-isp.gif

We found them quite interesting for our application of traffic monitoring using Wireless Sensor Networks. If anyone finds them to be interesting enough to be used just drop me an email at gopchandani@gmail.com

About these ads

65 Responses

Subscribe to comments with RSS.

  1. lubz said, on January 19, 2007 at 9:12 pm

    hmm…an intresting read however i wouldnt mind if u give brief overview of AVR architecture for layman like me….glad to see ur back on the blog

  2. mohsin said, on February 6, 2008 at 10:56 pm

    salamz..interesting project ia m doing something simmilar for my final yer project..wireless sensor node for paddy fields….could u guide me in this programmer for some reason its nt working for me…..thanxs

  3. Rakesh said, on February 7, 2008 at 10:11 am

    @Mohsin: Please be more precise on what is not working. Here’s a piece of advice, whenever you ask for help relating to HARDWARE projects, always be very to-the-point about what was it which you found not to be working so that the person whom you are asking for help can reply you quickly and with his full understanding.

    • etrxdude said, on January 16, 2013 at 12:54 am

      can i use AVRdude for this ckt? What changes do i need to make?

  4. mohsin said, on February 7, 2008 at 11:50 am

    i am using atmega 16 l when i connect to the pony prog the probe test is working fiine but when i try to read or write flash it says device missing or unknown device and am using 330 ohms resistors in the programmer instead of 220 ohms….any help would be appreciated?…thanxs…

  5. Rakesh said, on February 7, 2008 at 2:36 pm

    Probe test basically tests using the loop-back connections: 2-12, 3:11, nothing more nothing less.

    330 Ohms is not too high from 220 Ohms to cause this problem. I think the problem may very well be due to dry-soldering or problem of connectivity. Have you checked end-to-end connectivity of parallel port connections? End-to-end meaning from the MCU to the other end of the cable which you are using in the PC.

    Another problem could be improper/wrong connections. I know it sounds a little dumb, but we were constantly doing this mistake when we did it. So check out where you are connecting what AND if that is REALLY connected as you are assuming.

    There is nothing more to this whole thing except this 4-5 wires. It can be easily made to work.

  6. mohsin said, on February 7, 2008 at 3:11 pm

    RAKESH …thanxs a lot its finally working …yeah the breadboards ground line was faulty…:)….

  7. Rakesh said, on February 7, 2008 at 4:37 pm

    My pleasure.

  8. Nonnino said, on March 26, 2008 at 4:53 am

    Hello!
    Which adapter should I choose in PonyProg setup to use this programmer? Are there any other settings to change to make it work?

  9. Rakesh said, on March 26, 2008 at 10:45 am

    This particular schematic is for ISP so you need to choose that along with the relevant LPT/Parallel port in your computer. You need to choose your AVR in one of the menus in the PonyProg.

    That’s about it, I believe, rest the PonyProg handles neatly. What is specifically your problem, though?

  10. Nonnino said, on March 26, 2008 at 9:59 pm

    PonyProg lets me choose among these:
    AVR ISP API
    AVR ISP I/O
    DT-006 API
    DT-006 I/O
    EASY I2C API
    EASY I2C IO

    Which one is ok? I use Windows XP, so I believe it should be AVR ISP I/O.

    My AVR is an ATmega32, 5V, 16Mhz.

    Thanks very much for your advice. I was about to build a buffered interface, which is more reliable, but in my town I can’t find the needed IC.

  11. Rakesh said, on March 26, 2008 at 10:02 pm

    Yes. AVR-ISP I/O it is.

    Yes, a buffered interface would be more reliable, but this one works just nice for a lot of things, unless of course you are planning to really do something jazzy.

    Good Luck, BTW what are you planning to use the AVR for?

  12. Nonnino said, on March 26, 2008 at 11:15 pm

    I’m going to build a variant of the MMC2IEC project. I’ll do this while I wait for a friend of mine to get me the parts to build the 1541-III (I already have 4 PCB’s, an LCD screen and a nice programmer for PIC microcontrollers).

  13. Rakesh said, on March 26, 2008 at 11:24 pm

    Best of luck. :)

  14. Nonnino said, on March 27, 2008 at 9:44 pm

    Thank you! It’s always a challenge for me to do this stuff, because I always have to scavenge the junk for parts and this makes me feel a bit like MacGuyver.

  15. Bushra said, on May 6, 2008 at 9:34 am

    I want to prog atmega32 using pong prog via parallel port. can u plz guide me how to perform this task and the hardware that will be need. i m new in this field. also after programming how to run the program when put on actual circuit board.Thanks

  16. Rakesh said, on May 9, 2008 at 4:13 pm

    Well this post was originally written to ‘guide’ you.
    Can you be more specific as to what help you need? What don’t you understand in this post?

  17. Bushra said, on May 20, 2008 at 10:25 am

    Thanks a lot I have programmed my controller. i am using RFM12BP transceiver module for a WSN and want to cofigure it with atmega32 .has any one used this module.Can i get somr help or any guidance for this.

  18. Rakesh said, on May 20, 2008 at 11:07 am

    RFM12BP. That one is new. :)

    What interface does it talk on? as in SPI, UART or what?

    In case it is UART then you would need to configure Atmega32 UART for the same. I have posted another blog entry for that, check that out, otherwise there are many pages on the internet which would explain how to do it.

    Just to make a strong point of it, always refer to datasheet. That would be your ultimate resource of all knowledge related to Atmega32.

    Good luck.

  19. Bushra said, on May 22, 2008 at 10:13 am

    It takes SPI interface. the data sheet donot exlain a lot about its hardware setting. A sample code is avaliable but I am doutful about the hardware connections. Also how to get a 50ohm antenna. the help or foroums related to this module are not in english :( . Thats y no help from net. if u get any idea or help regarding this issue plz do leyt me know. Thanks :)

  20. Rakesh said, on May 22, 2008 at 10:29 am

    Woo. It is a 500 mW thingy, you sure that you want to use it for Sensor Network application?

    Honestly speaking, I have never worked on this module, but I just checked RFM12BP’s datasheet and it gives SPI input lines. I think you should start interfacing it with Atmega32.

    About the sample code, I am assuming that you are looking for code primarily for running this module, why don’t you first try and hit some generic material on SPI for Atmega32, I think datasheet does explain it and Atmel’s site used to give some document explaining assembly and C coding for it as well.

    And yes, did you check http://www.avrfreaks.net yet?

  21. shahbaz said, on May 26, 2008 at 2:07 pm

    i have tried the circuit its working well. i want to say thanks Rakesh.

  22. chait said, on June 10, 2008 at 9:08 pm

    wid ref to : Programmers are easily available and can be built by yourself using PC’s parallel port and a software called PonyProg. The schematic is provided below. We have successfully implemented a programmer today and it DOES work finally.

    could you plz plz elaborate/give reference/write a post on “how to make a programmer for atmega32″ for an absolute noobie like me…the programmer available in market is pretty costly for a beginner

    sorry if the question is outta place for this post

  23. Rakesh said, on June 10, 2008 at 9:28 pm

    @Chait:

    Well the post was originally intended to beginners, anyway let me elaborate more, I assume you found that schematic to be a bit difficult to interpret. See it is really no big deal, in the schematic above, the left side (ISP) represents your AVR pins (Atmega32 in our case) and you can find out pin numbers for GND, MISO, MOSI, RST, SCK from the datasheet of the AVR you are using. On the right side above, parallel port pins are represented and pin numbering is as per standard parallel port. Here’s a link that you might find helpful:

    http://www.epanorama.net/circuits/parallel_output.html

    and you can search google more for “Parallel Port Interfacing”

    And that’s pretty much all about it. You just need to make sure you are neatly connecting correct pin of AVR on correct pin of Parallel Port and of course don’t forget the two loop-backs on parallel port. A loopback is basically a connection between two pins of parallel port itself. As shown above, to make this programmer work with PonyProg you need loop-backs on pin-pair: 3-11 and 2-12.

  24. chait said, on June 23, 2008 at 3:58 pm

    hi
    yes i have completely followed the instruction stated above. i have make the circuit and double checked for any loose connections. n i found none.

    after putting in the hex file and setting the necessary changes in pony prog and pressing “write program(Flash)” the progress bar appears n immediately it says “Device missing or unknown error -24″

    the error remains the same even after pressing ignore.

    We made the necessary changes in BIOS. In BIOS parallel port setting was set bi-directional mode and address was set to 0X378.

    What should i do?

  25. chait said, on June 26, 2008 at 8:05 pm

    thank you…

    turns out that there was a soldering error!

  26. chait said, on June 26, 2008 at 8:05 pm

    problem solved

  27. Rakesh said, on June 27, 2008 at 9:33 am

    Good to know that Chait. Do update here if you bring something new to this programmer. Share the info. :)

  28. rahul said, on June 28, 2008 at 9:54 pm

    i have made this programmer and it works great with ponyprog.
    thanks !

    can i use winavr or avr studio to program the microcontroller ?

  29. rohan said, on October 10, 2008 at 11:56 pm

    dude i am a total newbie to microcontrollers…. just a hobbist no basic knowledge but i got your programmer designed and used 10k resistros for sck mosi and miso pins and rest is same hope thats fine… now you got to tell me what to do… how does parallel port detect and how to make hex fils using an atmega 32 at 16mhz exrternal oscillator

  30. Geethanjali said, on October 22, 2008 at 9:44 am

    I would like to program atmega32 for multichannel ADC specifically for 4 channel and store the data in PC. How can i do it? I am new to this.

  31. Kushal said, on October 25, 2008 at 3:33 pm

    I have problems with my fuse bits i PonyProg. When i press the READ in security bits optionbox then the bits are read and shown that evry lock bit is checked. So i made the lock bits unchecked so that i can program my AVR(Atmega32). But when i click the write button it doesnt show any interruption but again i read the bits and there is no change. After all i cant write my program in the AVR. Any Suggestions, plz??

  32. riawan said, on October 28, 2008 at 7:47 pm

    I use ponyprog with LPT1 as the interface on PC desktop (running winxp) and it works perfectly. For the programmer I use parallel ISP provided by Lancos.

    When I tried to run ponyprog on laptop (running winxp as well): Interface setup says OK, calibration says OK. When I tried to read/write onto the chip, Ponyprog says “Device missing or unknown device (-24)”. When I click “Ignore” button ponyprog gives FFFFFFFF…..

    I have checked dlportio files in winxp, they are already there. The laptop uses ECP on LPT1. Anyone ever get the same problem?

    Thanks

  33. Rakesh said, on October 28, 2008 at 9:16 pm

    @Kushal: I am not sure what you are trying to do. I assume that you want to program fuse-bits but cannot do so and you see no signs of that happening. As far as I remember, you get some indication when the bits are being programmed, like a message or something.

    @Riawan: Parallel port have a old bone with Windows XP. Windows XP apparently would block parallel port and render applications using it stale. The exact same issue happened to me. You can use a hack callled “User Port”, google it. It fixed this problem on some machines but not all. Good luck and do post your results if you try.

  34. Jason said, on October 31, 2008 at 3:51 pm

    I have a problem to write flash to atmega32, i was successfully probe , read and erase. But when i try to write flash to atmega32, the percentage box wil keep going until 100%,after it finish, a message “write failed” pop out. i tried this out with a few atmega32, can u please give me some advice or solution for it? Do i need external power supply connect to atmega32 Vcc pin? Thanks in advance for ur kind help.

  35. Naveen said, on February 18, 2009 at 11:54 am

    Will this programmer ckt. also work for Atmega 16 MCU?I haven’t been able to make it work this far.

    I had found another ckt for atmega 16 which had used external crystal oscillators. Also there was an extra connection to the RST pin from Vcc through a 10K resistance.

    Do you think that could be the reason?

    Like the earlier post setup, calibration probe are ok for me. But when I try to read or write to the device, I get the error “Device missing or unknown device (-24)” On ignoring it reads all FF bytes.

    Also would there be a difference in the programmer ckts. were I to use PonyProg and AVRDude? avrdude needs something they call a bsd programmer. I don’t exactly know what that is,.

  36. Rakesh said, on February 18, 2009 at 12:42 pm

    Can’t say much Naveen, unless I see the schematic you implemented. As far I recall, the schematic above should work with both Atmega16/32 because they are pin-compatible.

    -24 also occurs due to incorrect/loosed pin connection. I would try and quick test the connectivity of all connections and make sure the connections are from right pin of Parallel port to MCUs.

    I never used AVRDude so am not sure if same schematic is applicable. AVRDude is a linux based program (can also be used in Windows as per their website).

  37. [...] some wire is all you need for a (working) AVR parallel programmer. A nice schematic can be found here. You can either program the AVR out of circuit, or add a header/socket suitable for your programmer [...]

  38. nitlogic said, on March 30, 2009 at 12:06 pm

    where can I read about microcontroller in your blog?! I have searched about the word atmel microcontroller and you blog appeared to me

  39. microcontroller said, on March 30, 2009 at 12:51 pm

    where can I read about microcontroller in your blog?! I have searched about the word “atmel microcontroller” and you blog appeared to me

  40. Arjun said, on April 25, 2009 at 12:36 am

    I am using AVR studio for programming.while compiling the code i get this error…anyone with inputs on this?

    ../test.c:144: fatal error: opening dependency file dep/test.o.d: No such file or directory

  41. Arjun said, on April 25, 2009 at 1:29 am

    pontprog doesnt allow for writing codes in c? any other ways i can yse a c code here?

  42. Rakesh said, on April 25, 2009 at 3:21 am

    @Arjun: PonyProg writes off a given hex file on the MCU memory and you use AVR Studio to generate HEX file from C Code by successfully compiling it. I am not sure what you are trying to do here, maybe if you give more details.

  43. rezaur said, on April 25, 2009 at 5:52 pm

    hello.. i’m new in uC.. i’m having problem with the ponyprog. i’ve build the board as given blog.

    In the ponyprog Setup -> Interface Setup -> Probe result is OK.
    But now if i want to write anything to my Atmega32L it gives error as device not found (-24)

    Where is the problem. I’ve checked the connection twice. Changed the parallel port config to bi-directional in bios. Where is the problem ?????????!!!!!!!!

    I’m not using any external power supply and i’m not using any crystal.. i’m very new so plz help me out. another question, is my mega32L damaged ???

  44. Mohamed said, on June 9, 2009 at 12:48 am

    Hi, I just want to know about the 220R, the calculations that leads to this number.
    Thanks a lot, great work specially in your project.

  45. Ferdous said, on October 8, 2009 at 11:05 am

    Awesome tutorial and schematics for beginners like me.As you said I have to write programs in AVR Studio(v4.17) then save it in .hex file.Then I have to open the file(.hex) in PonyProg and then I have to perform burn operation.

    Ques:
    1.Can I use 10K resistor?will it make any change?
    2.Can I use AVR Studio(v4.17) to burn using this schematics?

    Please inform me asap becoz I have to show it to my faculty within 17.10.09

  46. Pankaj said, on October 9, 2009 at 1:45 pm

    i made the burner & as per the instruction you mentioned
    it works fairly

    thanks a lot

  47. Ankur said, on October 10, 2009 at 5:45 pm

    Hi, i made this burner as given in the circuit.
    >Calibration ok
    >Interface setup.. Test OK
    >Comand >Erase> Device missing or unknown device(-24)
    All connections are right. I don’t know what to do..
    I tried giving external supply to the uC with +5v vcc but no use.
    I also changed BIOS settings i.e parallel port mode> Bidirectiona
    Am i supposed give external clock??
    Any help is greatly appreciated..

  48. Ankur said, on October 11, 2009 at 6:53 pm

    Hi again
    Since i didnt get a reply so i thought to try again..
    Can anybody plz send me the complete schematic of the programmer (I dont think this is the complete one as there’s no crystal or VCC)
    Help plz

  49. Turbocip said, on October 25, 2009 at 1:00 pm

    on win 98 its possible use Pony Prog?
    i have a old computer with parallel input ….
    my new notebook dont have parallel
    thanks in advance

  50. Himel said, on December 21, 2009 at 7:59 pm

    Is there any 1 who can tell me abt the coding for read & write in atmega32.
    I need the coding to read & write at the port D of atmega32.
    I cant find help from others.
    Is their any1 who can tell me so it cud help.

  51. sarfaraj said, on August 4, 2010 at 10:14 pm

    does this programmer works for Atmega644 as well ?

  52. Sandeep Kumar said, on August 12, 2010 at 12:16 pm

    Nice work..thanks…

  53. Sandeep Kumar said, on August 12, 2010 at 4:24 pm

    Dear Rakesh,
    I made the programmer as given in the blog..
    >Calibration ok
    >Interface setup.. Test OK
    I tried to Erase the contents of ATmega 32 but its not working…and gives the message
    “Device missing or unknown device(-24)”
    All connections are right. I don’t know what to do..
    My PC BIOS settings are i.e parallel port mode> Bidirectional..port address 0×378
    Please help…

  54. Miguel said, on August 25, 2010 at 2:55 am

    Hi friends.

    I am using ponyprog for the first time and i want to program an atmega32.
    What AVR should i choose in pony prog to program ATMEGA32?

    ATMEGA323? or AVR auto?

    Hugs

  55. Atteya said, on September 23, 2010 at 1:10 am

    hey, i tried this programmers and many others, but they just don’t seem to work for me, i’m testing on a breadboard, but i did solder up the DB25 connector…

    probe test ok
    Reads the uC as all FF successfully,
    but when i write gives error -24 device missing and when i ignore writes and verifies but gives write failed in the end!!
    parallel port is ECP, and doesn’t recognize it in any other case!!!!!

    does anybody have any idea why this is happening?? i did check all the connections in all the programmers i tried!!

    when i connect an led to any of the wires it lights up but doesn’t blink, but i’m assuming that’s because it’s working at a high frequency!!!

    is there a possibility my parallel port isn’t working?

    thx alot

  56. Santosh Gairhe said, on October 11, 2010 at 5:02 pm

    m new to ATMEGA32…
    M searching for com port programmer and i found ponyprog. m confused do we need external crystal oscillator for programming purpose?

  57. [...] These are probably simplest to build as there is no need to convert any signals coming from port. Buffer chip is used only for safety reasons to protect computer port. Even simpler programmer cable can be found here. [...]

  58. [...] In the wake of this final year project presentation on 22nd January, we sort of started things up with the project. The first thing was the brain of our sensor nodes – the micro-controller – which needed to be get done with. We chose Atmel's Atmega32 uC for following "good" reasons: 1. Atmega32 puts up a lot of features right on the uC itself. Things like ADC, Internal Oscillator (1 MHz), 32 KB flash memory etc. are built on the chip and thus sav … Read More [...]

  59. youssef said, on August 30, 2011 at 5:42 am

    will it work on arduino ide if yes then how ? please send answer to:youssefaly@rocketmail.com

  60. Wavaidiolmeva said, on November 18, 2011 at 9:43 pm

    hosting
    Szukasz bezproblemowego i opłacalnego sposobu, żeby podnieść dochody prywatnej jednostki biznesowej? Posiadam toteż dla Ciebie mądre podejście. Reklama. Dostrzegam, miało być oszczędnie, aliści dostarczam Ci gwarancję, iż tak będzie. Najprostszą i najbardziej wszechstronną, jakkolwiek równolegle w największym stopniu prężną formą reklamy jest witryna. Dzisiaj, o ile Twojej jednostki biznesowej nie ma w Necie to możesz zapomnieć o potężnych dochodach. Każdy poszukuje z początku w sieci, dopiero z kolei możliwie sięga po ogłoszenia w gazecie, lub pyta kolegów. Zerknijmy prawdzie w oczy, strona internetowa jest w rzeczywistości pomocna. Pod warunkiem, że nie jesteś kompetentny w materiach domen i Netu nie martw się. Nasza firma powstała w takim przypadku specjalnie dla Ciebie. Przekazujemy usługi z obrębu hosting od startu do mety. Nasi eksperci odpowiedzą na Twoje wszystkie zapytania i pomogą dostroić najlepszą ofertę dla Ciebie. Dzięki nam zdołasz zwiększyć profity swojej jednosteki przy właściwie małym nakładzie pieniężnym. Jak? Wskutek usługi hosting. Poznasz się tutaj z skończoną propozycją na hosting i wyszperasz dane do kontaktu z nami. Sprawdź w jaki sposób Internet zdoła Cię wesprzeć.

  61. du-doo said, on January 8, 2012 at 12:01 am

    It really works?

  62. site said, on June 4, 2012 at 11:21 am

    Awesome post . Thanks for, visiting my blog dude. I shall email you again. I didnt know that!

  63. Hi would you mind letting me know which hosting company you’re utilizing? I’ve loaded your blog in 3 completely different browsers and I must
    say this blog loads a lot faster then most. Can you suggest a good hosting provider at
    a fair price? Cheers, I appreciate it!

  64. Immigration Solicitors in Romford said, on March 1, 2013 at 11:16 am

    Excellent site you have here.. It’s hard to find quality writing like yours these days. I truly appreciate individuals like you! Take care!!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: