You are on page 1of 4

ProgrammingAtmegausingBootLoader

Many expensive programmers exist for the Atmega, but after many hours of research, we have put together this guide to explain how to program the Atmega without the use of a programmer. The programmer like AVR ISP MKII USB or STK500 is required only once before the Atmega can program itself.ThekeytoselfprogrammingisAtmegasbootloadercapability.

Gatherresources
Ensurethatyouhavethefollowingresourcesready: 1. 2. 3. 4. 5. 6. 7. Atmega324(bootloaderhexfilesareprovided) Ensure16Mhzexternalcrystalbecausebootloaderisprogrammedforthisfrequencysetting STK500orAVRISPMKIIUSBProgrammer(onetimeuse) LatestversionofAVRStudioDownloadfromAtmelswebsite InstallMegaLoad.Netprogram(provided) MakeanoteofthelocationofbootLoader_512Byte_Atmega324_9600bps.hexfile. PowerupyourPCBandconnecttheISPprogrammingcabletoyourPCB.

ProgramtheBootLoader
1. OpenAVRStudioandchoosetoconnecttoyourAtmegatoprogramthebootloader AVRStudio Tools ProgramAVR Connect 2. EitherchooseSTK500andCOMportorAVRISPMKIIUSBdependingonyourprogrammer 3. EnsurecorrectchiptypeisselectedbygoingtoProgramtabandselectingAtmega324P

SJVE

Page1of4

4. GotoBoardTabandselect125KhzISPFrequencyandclickWrite

5. GotoFusestabandchoosethefollowingconfigurationnotethe5checkmarksanduncheck everythingelse:

6. ChooseProgramtoprogramthefusebits. 7. GobacktoBoardTabandselect1MhzandclickWrite

SJVE

Page2of4

8. GototheProgramTabandclickonthebuttonnexttoInputHEXFileunderFLASH sectionandbrowsetobootLoader_Atmega324_9600bps.hexfileandhitProgrambutton:

9. Youhavesuccessfullyloadedthebootloadersoftware.

SJVE

Page3of4

Programthechipusingtheselfprogrammingbootloadersoftware
Afterloadingthebootloaderprogram,theactualprogramminghexfilecanbeloadedeasilyusingthe MegaLoad.Netprogram. 1. CompileyourprojectinCodeVisionorsimilarcompiler. 2. LocateyourprogramsHEXfileinyourCodeVisionprojectdirectory 3. ConnectyourserialcabletomicrocontrollersserialinputwhichisPD0andPD1.Referenceyour PCBmanualfordetailsonhowtosetupserialinputandoutput. 4. Turnonyourmicrocontroller. 5. OpenMegaLoad.NetandclickonOPENforFLASHfileandbrowsetothehexfilefromstep2. 6. ClickonOpenPortbuttonuntilPortopensup. 7. YourAtmegashouldhaveprogrammedautomaticallyaftertheCOMPORTopenedup,ifnot, thenhittheresetswitchonthePCB. 8. Toloadnewprogrammingfile,compileyourprojectinCodeVisionandhitAtmegasresetswitch andMegaLoad.Netwillautomaticallyinstallthenewfile.Ifyoudonotwanttoprogramthe chip,simplycloseMegaLoad.Nettoavoidunintentionalprogramming.

Tipsforadvancedusers
1. You could use bootLoader_Atmega324_38400bps.hex file when you programmed the boot loader.Thisway,MegaLoad.netwouldprogram4timesfasterwhenyouopentheCOMPORT at 38400bps. The only slight problem is that if you are using Xbee wireless transceivers to program,youwouldneedtochangetheXbeestransmissionrateto38400bpsaswell.Youcan use XCTU to easily do it. In theory, wireless transmission errors occur more at higher bps so consideritbeforeyouuse38400,althoughXbeestendtobeveryreliable.

References
http://www.microsyl.com/ http://www.imagecraft.com/

SJVE

Page4of4

You might also like